Skip to content

Commit ecd7cbd

Browse files
committed
Do not refer to NIST draft standard anymore
Signed-off-by: Anjan Roy <hello@itzmeanjan.in>
1 parent afc3e41 commit ecd7cbd

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Ascon Permutation-based Lightweight Cryptography Standards for Constrained Devices: Authenticated Encryption, Hash, and Extendable Output Functions.
33

44
## Overview
5-
This header-only C++ library implements the whole Ascon LwC cipher-suite i.e. Ascon-AEAD128, Ascon-Hash256, Ascon-XOF128, and Ascon-CXOF128. These algorithms, suitable for constrained environments, are part of the Ascon family designed for resource-limited devices, prioritizing security, performance, and efficiency. The library offers `constexpr` functions where possible for enhanced performance and simplifies integration. The implementation conforms to the Ascon draft standard defined in [NIST SP 800-232](https://doi.org/10.6028/NIST.SP.800-232.ipd).
5+
This header-only C++ library implements the whole Ascon LwC cipher-suite i.e. Ascon-AEAD128, Ascon-Hash256, Ascon-XOF128, and Ascon-CXOF128. These algorithms, suitable for constrained environments, are part of the Ascon family designed for resource-limited devices, prioritizing security, performance, and efficiency. The library offers `constexpr` functions where possible for enhanced performance and simplifies integration. The implementation conforms to the Ascon standard defined in [NIST SP 800-232](https://doi.org/10.6028/NIST.SP.800-232).
66

77
The library includes the following core Ascon cryptographic primitives:
88

include/ascon/aead/duplex.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace ascon_duplex_mode {
1010

11-
// See table 12 of Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
11+
// See table 12 of Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
1212
static constexpr uint8_t UNIQUE_ALGORITHM_ID = 1;
1313

1414
static constexpr size_t ASCON_PERM_NUM_ROUNDS_A = 12;
@@ -24,7 +24,7 @@ static constexpr size_t TAG_BYTE_LEN = BIT_SECURITY_LEVEL / std::numeric_limits<
2424

2525
/**
2626
* @brief Initializes the Ascon permutation state with the given key and nonce.
27-
* See point 1 of section 4.1.1 in Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
27+
* See point 1 of section 4.1.1 in Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
2828
*
2929
* @param state Ascon permutation state.
3030
* @param key Encryption key.
@@ -51,7 +51,7 @@ initialize(ascon_perm::ascon_perm_t& state, std::span<const uint8_t, KEY_BYTE_LE
5151
/**
5252
* @brief Absorbs arbitrary-length associated data into the Ascon permutation state.
5353
* This function can be called multiple times with different spans of associated data before calling `finalize_associated_data`.
54-
* See point 2 of section 4.1.1 in Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
54+
* See point 2 of section 4.1.1 in Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
5555
*
5656
* @param state Ascon permutation state.
5757
* @param block_offset Offset within the current block, must be <= `RATE_BYTES`.
@@ -90,7 +90,7 @@ absorb_associated_data(ascon_perm::ascon_perm_t& state, size_t& block_offset, st
9090
/**
9191
* @brief Finalizes the associated data absorption process by adding a 1-bit domain separator.
9292
* No more associated data can be absorbed after calling this function.
93-
* See point 2 of section 4.1.1 in Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
93+
* See point 2 of section 4.1.1 in Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
9494
*
9595
* @param state Ascon permutation state.
9696
* @param block_offset Offset within the current block, must be <= `RATE_BYTES`.
@@ -119,7 +119,7 @@ finalize_associated_data(ascon_perm::ascon_perm_t& state, size_t& block_offset,
119119
/**
120120
* @brief Absorbs arbitrary-length plaintext into the Ascon permutation state and produces ciphertext.
121121
* This function can be called multiple times with different spans of plaintext before calling `finalize_ciphering`.
122-
* See point 3 of section 4.1.1 in Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
122+
* See point 3 of section 4.1.1 in Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
123123
*
124124
* @param state Ascon permutation state.
125125
* @param block_offset Offset within the current block, must be <= `RATE_BYTES`.
@@ -164,7 +164,7 @@ encrypt_plaintext(ascon_perm::ascon_perm_t& state, size_t& block_offset, std::sp
164164
/**
165165
* @brief Absorbs arbitrary-length ciphertext into the Ascon permutation state and produces decrypted plaintext.
166166
* This function can be called multiple times with different spans of ciphertext before calling `finalize_ciphering`.
167-
* See point 3 of section 4.1.2 in Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
167+
* See point 3 of section 4.1.2 in Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
168168
*
169169
* @param state Ascon permutation state.
170170
* @param block_offset Offset within the current block, must be <= `RATE_BYTES`.
@@ -211,7 +211,7 @@ decrypt_ciphertext(ascon_perm::ascon_perm_t& state, size_t& block_offset, std::s
211211
/**
212212
* @brief Finalizes the plaintext/ciphertext absorption process by adding a 1-bit domain separator to be permutation state.
213213
* No more plaintext/ciphertext can be encrypted/decrypted after calling this function.
214-
* See point 3 of section 4.1.1 in Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
214+
* See point 3 of section 4.1.1 in Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
215215
*
216216
* @param state Ascon permutation state.
217217
* @param block_offset Offset within the current block, must be <= `RATE_BYTES`.
@@ -232,7 +232,7 @@ finalize_ciphering(ascon_perm::ascon_perm_t& state, size_t& block_offset)
232232

233233
/**
234234
* @brief Finalizes the Ascon permutation state and produces a tag.
235-
* See point 4 of section 4.1.1 in Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
235+
* See point 4 of section 4.1.1 in Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
236236
*
237237
* @param state Ascon permutation state.
238238
* @param key Key used for encryption/decryption.

include/ascon/hashes/ascon_cxof128.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace ascon_cxof128 {
55

6-
// See table 12 of Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
6+
// See table 12 of Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
77
static constexpr uint8_t UNIQUE_ALGORITHM_ID = 4;
88
static constexpr auto INITIAL_PERMUTATION_STATE = ascon_sponge_mode::compute_init_state(ascon_common_utils::compute_iv(UNIQUE_ALGORITHM_ID,
99
ascon_sponge_mode::ASCON_PERM_NUM_ROUNDS,

include/ascon/hashes/ascon_hash256.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace ascon_hash256 {
55

66
static constexpr size_t DIGEST_BYTE_LEN = (ascon_perm::PERMUTATION_STATE_BITWIDTH - ascon_sponge_mode::RATE_BITS) / std::numeric_limits<uint8_t>::digits;
77

8-
// See table 12 of Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
8+
// See table 12 of Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
99
static constexpr uint8_t UNIQUE_ALGORITHM_ID = 2;
1010
static constexpr auto INITIAL_PERMUTATION_STATE = ascon_sponge_mode::compute_init_state(ascon_common_utils::compute_iv(UNIQUE_ALGORITHM_ID,
1111
ascon_sponge_mode::ASCON_PERM_NUM_ROUNDS,

include/ascon/hashes/ascon_xof128.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace ascon_xof128 {
55

6-
// See table 12 of Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
6+
// See table 12 of Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
77
static constexpr uint8_t UNIQUE_ALGORITHM_ID = 3;
88
static constexpr auto INITIAL_PERMUTATION_STATE = ascon_sponge_mode::compute_init_state(ascon_common_utils::compute_iv(UNIQUE_ALGORITHM_ID,
99
ascon_sponge_mode::ASCON_PERM_NUM_ROUNDS,

include/ascon/permutation/ascon.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static constexpr size_t PERMUTATION_STATE_BITWIDTH = 320;
1414
static constexpr size_t PERMUTATION_STATE_WORD_BITWIDTH = std::numeric_limits<uint64_t>::digits;
1515
static constexpr size_t PERMUTATION_STATE_WORD_COUNT = PERMUTATION_STATE_BITWIDTH / PERMUTATION_STATE_WORD_BITWIDTH;
1616

17-
// Ascon permutation round constants; taken from table 5 in Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
17+
// Ascon permutation round constants; taken from table 5 in Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
1818
static constexpr std::array<uint8_t, ASCON_PERMUTATION_MAX_ROUNDS> ASCON_PERMUTATION_ROUND_CONSTANTS{ 0x3c, 0x2d, 0x1e, 0x0f, 0xf0, 0xe1, 0xd2, 0xc3,
1919
0xb4, 0xa5, 0x96, 0x87, 0x78, 0x69, 0x5a, 0x4b };
2020

@@ -26,7 +26,7 @@ struct ascon_perm_t
2626
std::array<uint64_t, PERMUTATION_STATE_WORD_COUNT> state{};
2727
static_assert(sizeof(state) * std::numeric_limits<uint8_t>::digits == PERMUTATION_STATE_BITWIDTH);
2828

29-
// Addition of constants step; see section 3.2 of Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
29+
// Addition of constants step; see section 3.2 of Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
3030
forceinline constexpr void p_c(const uint64_t rc) { state[2] ^= rc; }
3131

3232
// Substitution layer i.e. 5 -bit S-box S(x) applied on Ascon state; taken from figure 5 in Ascon specification
@@ -50,7 +50,7 @@ struct ascon_perm_t
5050
state[2] = ~row2;
5151
}
5252

53-
// Linear diffusion layer; taken from section 3.4 of Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
53+
// Linear diffusion layer; taken from section 3.4 of Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
5454
forceinline constexpr void p_l()
5555
{
5656
const uint64_t row0 = state[0] ^ std::rotr(state[0], 19);
@@ -66,7 +66,7 @@ struct ascon_perm_t
6666
state[4] = row4 ^ std::rotr(state[4], 41);
6767
}
6868

69-
// Single round of Ascon permutation; taken from section 3 of Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
69+
// Single round of Ascon permutation; taken from section 3 of Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
7070
forceinline constexpr void round(const uint64_t rc)
7171
{
7272
p_c(rc);
@@ -103,7 +103,7 @@ struct ascon_perm_t
103103
}
104104
forceinline constexpr void reset() { state.fill(0); }
105105

106-
// Applies Ascon permutation round for R -many times | R <= 16; taken from section 3 of Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
106+
// Applies Ascon permutation round for R -many times | R <= 16; taken from section 3 of Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
107107
template<const size_t R>
108108
forceinline constexpr void permute()
109109
requires(R <= ASCON_PERMUTATION_MAX_ROUNDS)

include/ascon/utils/common.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace ascon_common_utils {
99

1010
// Compile-time evaluated function for computing initial values for Ascon variants.
11-
// See appendix B of Ascon draft standard @ https://doi.org/10.6028/NIST.SP.800-232.ipd.
11+
// See appendix B of Ascon standard @ https://doi.org/10.6028/NIST.SP.800-232.
1212
[[nodiscard]]
1313
forceinline consteval uint64_t
1414
compute_iv(const uint8_t unique_algo_id,

0 commit comments

Comments
 (0)