Skip to content

Commit d807df9

Browse files
committed
fix confusing Aes constructor signature
1 parent 1b6e3f6 commit d807df9

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

AES.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#ifndef MRDCVLSC_AES_IMPLEMENTATION
22
#define MRDCVLSC_AES_IMPLEMENTATION
33

4+
#include <iostream>
5+
#include <limits>
6+
#include <climits>
7+
#include <cstring>
8+
#include <exception>
49
#include <iostream>
510

611
#if defined(USE_NEON_AES)
@@ -68,10 +73,6 @@
6873
#endif
6974
#endif
7075

71-
#include <cstring>
72-
#include <exception>
73-
#include <iostream>
74-
7576
namespace Cipher {
7677
template <size_t key_bits = 128>
7778
class Aes {
@@ -80,6 +81,7 @@ namespace Cipher {
8081
static constexpr size_t Nk = key_bits / 32;
8182
static constexpr size_t Nr = Nk + 6;
8283
static constexpr size_t round_keys_size = 4 * Nb * (Nr + 1);
84+
static constexpr size_t key_bytes = key_bits / sizeof(char);
8385

8486
unsigned char round_keys[round_keys_size];
8587

@@ -607,7 +609,7 @@ namespace Cipher {
607609
* @param key A `unsigned char *` array that contains the AES key.
608610
* This key should either be **16, 24, 32** bytes, or `128`, `192`, `256` bits.
609611
*/
610-
Aes(unsigned char key[key_bits]) : round_keys() {
612+
Aes(unsigned char key[key_bytes]) : round_keys() {
611613
constexpr bool invalid_aes_key_bit_size = key_bits == 128 || key_bits == 192 || key_bits == 256;
612614
static_assert(invalid_aes_key_bit_size, "The valid values are only: 128, 192 & 256");
613615

0 commit comments

Comments
 (0)