use size_t for index in aes xof buffer and not for index of digits
Tento commit je obsažen v:
rodič
e5da5da9a6
revize
98e643e5c7
@ -20,7 +20,7 @@ static inline void gf2x_add_asymm(const size_t nr, DIGIT Res[],
|
||||
}
|
||||
|
||||
/* PRE: MAX ALLOWED ROTATION AMOUNT : DIGIT_SIZE_b */
|
||||
void PQCLEAN_LEDAKEMLT12_CLEAN_right_bit_shift_n(size_t length, DIGIT in[], unsigned int amount) {
|
||||
void PQCLEAN_LEDAKEMLT12_CLEAN_right_bit_shift_n(int length, DIGIT in[], unsigned int amount) {
|
||||
assert(amount < DIGIT_SIZE_b);
|
||||
if ( amount == 0 ) {
|
||||
return;
|
||||
@ -36,12 +36,12 @@ void PQCLEAN_LEDAKEMLT12_CLEAN_right_bit_shift_n(size_t length, DIGIT in[], unsi
|
||||
}
|
||||
|
||||
/* PRE: MAX ALLOWED ROTATION AMOUNT : DIGIT_SIZE_b */
|
||||
void PQCLEAN_LEDAKEMLT12_CLEAN_left_bit_shift_n(size_t length, DIGIT in[], unsigned int amount) {
|
||||
void PQCLEAN_LEDAKEMLT12_CLEAN_left_bit_shift_n(int length, DIGIT in[], unsigned int amount) {
|
||||
assert(amount < DIGIT_SIZE_b);
|
||||
if ( amount == 0 ) {
|
||||
return;
|
||||
}
|
||||
size_t j;
|
||||
int j;
|
||||
DIGIT mask;
|
||||
mask = ~(((DIGIT)0x01 << (DIGIT_SIZE_b - amount)) - 1);
|
||||
for (j = 0 ; j < length - 1 ; j++) {
|
||||
|
@ -50,14 +50,14 @@ typedef uint64_t DIGIT;
|
||||
|
||||
#define GF2X_MUL PQCLEAN_LEDAKEMLT12_CLEAN_gf2x_mul_comb
|
||||
|
||||
static inline void gf2x_add(DIGIT Res[], const DIGIT A[], const DIGIT B[], size_t nr) {
|
||||
for (size_t i = 0; i < nr; i++) {
|
||||
static inline void gf2x_add(DIGIT Res[], const DIGIT A[], const DIGIT B[], int nr) {
|
||||
for (int i = 0; i < nr; i++) {
|
||||
Res[i] = A[i] ^ B[i];
|
||||
}
|
||||
}
|
||||
|
||||
void PQCLEAN_LEDAKEMLT12_CLEAN_right_bit_shift_n(size_t length, DIGIT in[], unsigned int amount);
|
||||
void PQCLEAN_LEDAKEMLT12_CLEAN_left_bit_shift_n(size_t length, DIGIT in[], unsigned int amount);
|
||||
void PQCLEAN_LEDAKEMLT12_CLEAN_right_bit_shift_n(int length, DIGIT in[], unsigned int amount);
|
||||
void PQCLEAN_LEDAKEMLT12_CLEAN_left_bit_shift_n(int length, DIGIT in[], unsigned int amount);
|
||||
void GF2X_MUL(int nr, DIGIT Res[], int na, const DIGIT A[], int nb, const DIGIT B[]);
|
||||
|
||||
#endif
|
||||
|
@ -15,7 +15,7 @@
|
||||
static int seedexpander_init(AES_XOF_struct *ctx,
|
||||
unsigned char *seed,
|
||||
unsigned char *diversifier,
|
||||
uint64_t maxlen) {
|
||||
size_t maxlen) {
|
||||
if ( maxlen >= 0x100000000 ) {
|
||||
return RNG_BAD_MAXLEN;
|
||||
}
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
typedef struct {
|
||||
unsigned char buffer[16];
|
||||
unsigned int buffer_pos;
|
||||
uint64_t length_remaining;
|
||||
size_t buffer_pos;
|
||||
size_t length_remaining;
|
||||
unsigned char key[32];
|
||||
unsigned char ctr[16];
|
||||
} AES_XOF_struct;
|
||||
|
@ -5,12 +5,12 @@
|
||||
|
||||
/* allows the second operand to be shorter than the first */
|
||||
/* the result should be as large as the first operand*/
|
||||
static inline void gf2x_add_asymm(const size_t nr, DIGIT Res[],
|
||||
const size_t na, const DIGIT A[],
|
||||
const size_t nb, const DIGIT B[]) {
|
||||
static inline void gf2x_add_asymm(const int nr, DIGIT Res[],
|
||||
const int na, const DIGIT A[],
|
||||
const int nb, const DIGIT B[]) {
|
||||
assert(nr >= na && na >= nb);
|
||||
size_t i;
|
||||
size_t delta = na - nb;
|
||||
int i;
|
||||
int delta = na - nb;
|
||||
for (i = 0; i < delta; i++) {
|
||||
Res[i] = A[i];
|
||||
}
|
||||
@ -20,7 +20,7 @@ static inline void gf2x_add_asymm(const size_t nr, DIGIT Res[],
|
||||
}
|
||||
|
||||
/* PRE: MAX ALLOWED ROTATION AMOUNT : DIGIT_SIZE_b */
|
||||
void PQCLEAN_LEDAKEMLT32_CLEAN_right_bit_shift_n(size_t length, DIGIT in[], unsigned int amount) {
|
||||
void PQCLEAN_LEDAKEMLT32_CLEAN_right_bit_shift_n(int length, DIGIT in[], unsigned int amount) {
|
||||
assert(amount < DIGIT_SIZE_b);
|
||||
if ( amount == 0 ) {
|
||||
return;
|
||||
@ -36,12 +36,12 @@ void PQCLEAN_LEDAKEMLT32_CLEAN_right_bit_shift_n(size_t length, DIGIT in[], unsi
|
||||
}
|
||||
|
||||
/* PRE: MAX ALLOWED ROTATION AMOUNT : DIGIT_SIZE_b */
|
||||
void PQCLEAN_LEDAKEMLT32_CLEAN_left_bit_shift_n(size_t length, DIGIT in[], unsigned int amount) {
|
||||
void PQCLEAN_LEDAKEMLT32_CLEAN_left_bit_shift_n(int length, DIGIT in[], unsigned int amount) {
|
||||
assert(amount < DIGIT_SIZE_b);
|
||||
if ( amount == 0 ) {
|
||||
return;
|
||||
}
|
||||
size_t j;
|
||||
int j;
|
||||
DIGIT mask;
|
||||
mask = ~(((DIGIT)0x01 << (DIGIT_SIZE_b - amount)) - 1);
|
||||
for (j = 0 ; j < length - 1 ; j++) {
|
||||
|
@ -50,14 +50,14 @@ typedef uint64_t DIGIT;
|
||||
|
||||
#define GF2X_MUL PQCLEAN_LEDAKEMLT32_CLEAN_gf2x_mul_comb
|
||||
|
||||
static inline void gf2x_add(DIGIT Res[], const DIGIT A[], const DIGIT B[], size_t nr) {
|
||||
for (size_t i = 0; i < nr; i++) {
|
||||
static inline void gf2x_add(DIGIT Res[], const DIGIT A[], const DIGIT B[], int nr) {
|
||||
for (int i = 0; i < nr; i++) {
|
||||
Res[i] = A[i] ^ B[i];
|
||||
}
|
||||
}
|
||||
|
||||
void PQCLEAN_LEDAKEMLT32_CLEAN_right_bit_shift_n(size_t length, DIGIT in[], unsigned int amount);
|
||||
void PQCLEAN_LEDAKEMLT32_CLEAN_left_bit_shift_n(size_t length, DIGIT in[], unsigned int amount);
|
||||
void PQCLEAN_LEDAKEMLT32_CLEAN_right_bit_shift_n(int length, DIGIT in[], unsigned int amount);
|
||||
void PQCLEAN_LEDAKEMLT32_CLEAN_left_bit_shift_n(int length, DIGIT in[], unsigned int amount);
|
||||
void GF2X_MUL(int nr, DIGIT Res[], int na, const DIGIT A[], int nb, const DIGIT B[]);
|
||||
|
||||
#endif
|
||||
|
@ -15,7 +15,7 @@
|
||||
static int seedexpander_init(AES_XOF_struct *ctx,
|
||||
unsigned char *seed,
|
||||
unsigned char *diversifier,
|
||||
uint64_t maxlen) {
|
||||
size_t maxlen) {
|
||||
if ( maxlen >= 0x100000000 ) {
|
||||
return RNG_BAD_MAXLEN;
|
||||
}
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
typedef struct {
|
||||
unsigned char buffer[16];
|
||||
unsigned int buffer_pos;
|
||||
uint64_t length_remaining;
|
||||
size_t buffer_pos;
|
||||
size_t length_remaining;
|
||||
unsigned char key[32];
|
||||
unsigned char ctr[16];
|
||||
} AES_XOF_struct;
|
||||
|
@ -20,7 +20,7 @@ static inline void gf2x_add_asymm(const size_t nr, DIGIT Res[],
|
||||
}
|
||||
|
||||
/* PRE: MAX ALLOWED ROTATION AMOUNT : DIGIT_SIZE_b */
|
||||
void PQCLEAN_LEDAKEMLT52_CLEAN_right_bit_shift_n(size_t length, DIGIT in[], unsigned int amount) {
|
||||
void PQCLEAN_LEDAKEMLT52_CLEAN_right_bit_shift_n(int length, DIGIT in[], unsigned int amount) {
|
||||
assert(amount < DIGIT_SIZE_b);
|
||||
if ( amount == 0 ) {
|
||||
return;
|
||||
@ -36,12 +36,12 @@ void PQCLEAN_LEDAKEMLT52_CLEAN_right_bit_shift_n(size_t length, DIGIT in[], unsi
|
||||
}
|
||||
|
||||
/* PRE: MAX ALLOWED ROTATION AMOUNT : DIGIT_SIZE_b */
|
||||
void PQCLEAN_LEDAKEMLT52_CLEAN_left_bit_shift_n(size_t length, DIGIT in[], unsigned int amount) {
|
||||
void PQCLEAN_LEDAKEMLT52_CLEAN_left_bit_shift_n(int length, DIGIT in[], unsigned int amount) {
|
||||
assert(amount < DIGIT_SIZE_b);
|
||||
if ( amount == 0 ) {
|
||||
return;
|
||||
}
|
||||
size_t j;
|
||||
int j;
|
||||
DIGIT mask;
|
||||
mask = ~(((DIGIT)0x01 << (DIGIT_SIZE_b - amount)) - 1);
|
||||
for (j = 0 ; j < length - 1 ; j++) {
|
||||
|
@ -50,14 +50,14 @@ typedef uint64_t DIGIT;
|
||||
|
||||
#define GF2X_MUL PQCLEAN_LEDAKEMLT52_CLEAN_gf2x_mul_comb
|
||||
|
||||
static inline void gf2x_add(DIGIT Res[], const DIGIT A[], const DIGIT B[], size_t nr) {
|
||||
for (size_t i = 0; i < nr; i++) {
|
||||
static inline void gf2x_add(DIGIT Res[], const DIGIT A[], const DIGIT B[], int nr) {
|
||||
for (int i = 0; i < nr; i++) {
|
||||
Res[i] = A[i] ^ B[i];
|
||||
}
|
||||
}
|
||||
|
||||
void PQCLEAN_LEDAKEMLT52_CLEAN_right_bit_shift_n(size_t length, DIGIT in[], unsigned int amount);
|
||||
void PQCLEAN_LEDAKEMLT52_CLEAN_left_bit_shift_n(size_t length, DIGIT in[], unsigned int amount);
|
||||
void PQCLEAN_LEDAKEMLT52_CLEAN_right_bit_shift_n(int length, DIGIT in[], unsigned int amount);
|
||||
void PQCLEAN_LEDAKEMLT52_CLEAN_left_bit_shift_n(int length, DIGIT in[], unsigned int amount);
|
||||
void GF2X_MUL(int nr, DIGIT Res[], int na, const DIGIT A[], int nb, const DIGIT B[]);
|
||||
|
||||
#endif
|
||||
|
@ -15,7 +15,7 @@
|
||||
static int seedexpander_init(AES_XOF_struct *ctx,
|
||||
unsigned char *seed,
|
||||
unsigned char *diversifier,
|
||||
uint64_t maxlen) {
|
||||
size_t maxlen) {
|
||||
if ( maxlen >= 0x100000000 ) {
|
||||
return RNG_BAD_MAXLEN;
|
||||
}
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
typedef struct {
|
||||
unsigned char buffer[16];
|
||||
unsigned int buffer_pos;
|
||||
uint64_t length_remaining;
|
||||
size_t buffer_pos;
|
||||
size_t length_remaining;
|
||||
unsigned char key[32];
|
||||
unsigned char ctr[16];
|
||||
} AES_XOF_struct;
|
||||
|
Načítá se…
Odkázat v novém úkolu
Zablokovat Uživatele