mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-22 23:48:58 +00:00
Remove BITMASK macro
This commit is contained in:
parent
1325ba6dff
commit
6cf952a2ce
@ -10,8 +10,7 @@
|
|||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
|
|
||||||
|
|
||||||
#define CEIL_DIVIDE(a, b) (((a)/(b)) + ((a) % (b) == 0 ? 0 : 1)) /*!< Divide a by b and ceil the result*/
|
#define CEIL_DIVIDE(a, b) (((a)+(b)-1)/(b)) /*!< Divide a by b and ceil the result*/
|
||||||
#define BITMASK(a, size) ((1UL << ((a) % (size))) - 1) /*!< Create a mask*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define PARAM_N Define the parameter n of the scheme
|
#define PARAM_N Define the parameter n of the scheme
|
||||||
|
@ -116,7 +116,7 @@ void PQCLEAN_HQC128_AVX2_vect_set_random(AES_XOF_struct *ctx, uint64_t *v) {
|
|||||||
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
|
|
||||||
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
v[VEC_N_SIZE_64 - 1] &= BITMASK(PARAM_N, 64);
|
v[VEC_N_SIZE_64 - 1] &= RED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
|
|
||||||
|
|
||||||
#define CEIL_DIVIDE(a, b) (((a)/(b)) + ((a) % (b) == 0 ? 0 : 1)) /*!< Divide a by b and ceil the result*/
|
#define CEIL_DIVIDE(a, b) (((a)+(b)-1)/(b)) /*!< Divide a by b and ceil the result*/
|
||||||
#define BITMASK(a, size) ((1UL << ((a) % (size))) - 1) /*!< Create a mask*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define PARAM_N Define the parameter n of the scheme
|
#define PARAM_N Define the parameter n of the scheme
|
||||||
|
@ -148,7 +148,7 @@ void PQCLEAN_HQC128_CLEAN_vect_set_random(AES_XOF_struct *ctx, uint64_t *v) {
|
|||||||
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
|
|
||||||
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
v[VEC_N_SIZE_64 - 1] &= BITMASK(PARAM_N, 64);
|
v[VEC_N_SIZE_64 - 1] &= RED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
|
|
||||||
|
|
||||||
#define CEIL_DIVIDE(a, b) (((a)/(b)) + ((a) % (b) == 0 ? 0 : 1)) /*!< Divide a by b and ceil the result*/
|
#define CEIL_DIVIDE(a, b) (((a)+(b)-1)/(b)) /*!< Divide a by b and ceil the result*/
|
||||||
#define BITMASK(a, size) ((1UL << ((a) % (size))) - 1) /*!< Create a mask*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define PARAM_N Define the parameter n of the scheme
|
#define PARAM_N Define the parameter n of the scheme
|
||||||
|
@ -116,7 +116,7 @@ void PQCLEAN_HQC192_AVX2_vect_set_random(AES_XOF_struct *ctx, uint64_t *v) {
|
|||||||
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
|
|
||||||
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
v[VEC_N_SIZE_64 - 1] &= BITMASK(PARAM_N, 64);
|
v[VEC_N_SIZE_64 - 1] &= RED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
|
|
||||||
|
|
||||||
#define CEIL_DIVIDE(a, b) (((a)/(b)) + ((a) % (b) == 0 ? 0 : 1)) /*!< Divide a by b and ceil the result*/
|
#define CEIL_DIVIDE(a, b) (((a)+(b)-1)/(b)) /*!< Divide a by b and ceil the result*/
|
||||||
#define BITMASK(a, size) ((1UL << ((a) % (size))) - 1) /*!< Create a mask*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define PARAM_N Define the parameter n of the scheme
|
#define PARAM_N Define the parameter n of the scheme
|
||||||
|
@ -148,7 +148,7 @@ void PQCLEAN_HQC192_CLEAN_vect_set_random(AES_XOF_struct *ctx, uint64_t *v) {
|
|||||||
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
|
|
||||||
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
v[VEC_N_SIZE_64 - 1] &= BITMASK(PARAM_N, 64);
|
v[VEC_N_SIZE_64 - 1] &= RED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
|
|
||||||
|
|
||||||
#define CEIL_DIVIDE(a, b) (((a)/(b)) + ((a) % (b) == 0 ? 0 : 1)) /*!< Divide a by b and ceil the result*/
|
#define CEIL_DIVIDE(a, b) (((a)+(b)-1)/(b)) /*!< Divide a by b and ceil the result*/
|
||||||
#define BITMASK(a, size) ((1UL << ((a) % (size))) - 1) /*!< Create a mask*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define PARAM_N Define the parameter n of the scheme
|
#define PARAM_N Define the parameter n of the scheme
|
||||||
|
@ -116,7 +116,7 @@ void PQCLEAN_HQC256_AVX2_vect_set_random(AES_XOF_struct *ctx, uint64_t *v) {
|
|||||||
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
|
|
||||||
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
v[VEC_N_SIZE_64 - 1] &= BITMASK(PARAM_N, 64);
|
v[VEC_N_SIZE_64 - 1] &= RED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
#include "vector.h"
|
#include "vector.h"
|
||||||
|
|
||||||
|
|
||||||
#define CEIL_DIVIDE(a, b) (((a)/(b)) + ((a) % (b) == 0 ? 0 : 1)) /*!< Divide a by b and ceil the result*/
|
#define CEIL_DIVIDE(a, b) (((a)+(b)-1)/(b)) /*!< Divide a by b and ceil the result*/
|
||||||
#define BITMASK(a, size) ((1UL << ((a) % (size))) - 1) /*!< Create a mask*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define PARAM_N Define the parameter n of the scheme
|
#define PARAM_N Define the parameter n of the scheme
|
||||||
|
@ -148,7 +148,7 @@ void PQCLEAN_HQC256_CLEAN_vect_set_random(AES_XOF_struct *ctx, uint64_t *v) {
|
|||||||
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
|
|
||||||
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
v[VEC_N_SIZE_64 - 1] &= BITMASK(PARAM_N, 64);
|
v[VEC_N_SIZE_64 - 1] &= RED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
#include "api.h"
|
#include "api.h"
|
||||||
|
|
||||||
|
|
||||||
#define CEIL_DIVIDE(a, b) (((a)/(b)) + ((a) % (b) == 0 ? 0 : 1)) /*!< Divide a by b and ceil the result*/
|
#define CEIL_DIVIDE(a, b) (((a)+(b)-1)/(b)) /*!< Divide a by b and ceil the result*/
|
||||||
#define BITMASK(a, size) ((1UL << ((a) % (size))) - 1) /*!< Create a mask*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define PARAM_N Define the parameter n of the scheme
|
#define PARAM_N Define the parameter n of the scheme
|
||||||
|
@ -116,7 +116,7 @@ void PQCLEAN_HQCRMRS128_AVX2_vect_set_random(AES_XOF_struct *ctx, uint64_t *v) {
|
|||||||
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
|
|
||||||
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
v[VEC_N_SIZE_64 - 1] &= BITMASK(PARAM_N, 64);
|
v[VEC_N_SIZE_64 - 1] &= RED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
#include "api.h"
|
#include "api.h"
|
||||||
|
|
||||||
|
|
||||||
#define CEIL_DIVIDE(a, b) (((a)/(b)) + ((a) % (b) == 0 ? 0 : 1)) /*!< Divide a by b and ceil the result*/
|
#define CEIL_DIVIDE(a, b) (((a)+(b)-1)/(b)) /*!< Divide a by b and ceil the result*/
|
||||||
#define BITMASK(a, size) ((1UL << ((a) % (size))) - 1) /*!< Create a mask*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define PARAM_N Define the parameter n of the scheme
|
#define PARAM_N Define the parameter n of the scheme
|
||||||
|
@ -148,7 +148,7 @@ void PQCLEAN_HQCRMRS128_CLEAN_vect_set_random(AES_XOF_struct *ctx, uint64_t *v)
|
|||||||
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
|
|
||||||
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
v[VEC_N_SIZE_64 - 1] &= BITMASK(PARAM_N, 64);
|
v[VEC_N_SIZE_64 - 1] &= RED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
#include "api.h"
|
#include "api.h"
|
||||||
|
|
||||||
|
|
||||||
#define CEIL_DIVIDE(a, b) (((a)/(b)) + ((a) % (b) == 0 ? 0 : 1)) /*!< Divide a by b and ceil the result*/
|
#define CEIL_DIVIDE(a, b) (((a)+(b)-1)/(b)) /*!< Divide a by b and ceil the result*/
|
||||||
#define BITMASK(a, size) ((1UL << ((a) % (size))) - 1) /*!< Create a mask*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define PARAM_N Define the parameter n of the scheme
|
#define PARAM_N Define the parameter n of the scheme
|
||||||
|
@ -116,7 +116,7 @@ void PQCLEAN_HQCRMRS192_AVX2_vect_set_random(AES_XOF_struct *ctx, uint64_t *v) {
|
|||||||
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
|
|
||||||
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
v[VEC_N_SIZE_64 - 1] &= BITMASK(PARAM_N, 64);
|
v[VEC_N_SIZE_64 - 1] &= RED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
#include "api.h"
|
#include "api.h"
|
||||||
|
|
||||||
|
|
||||||
#define CEIL_DIVIDE(a, b) (((a)/(b)) + ((a) % (b) == 0 ? 0 : 1)) /*!< Divide a by b and ceil the result*/
|
#define CEIL_DIVIDE(a, b) (((a)+(b)-1)/(b)) /*!< Divide a by b and ceil the result*/
|
||||||
#define BITMASK(a, size) ((1UL << ((a) % (size))) - 1) /*!< Create a mask*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define PARAM_N Define the parameter n of the scheme
|
#define PARAM_N Define the parameter n of the scheme
|
||||||
|
@ -148,7 +148,7 @@ void PQCLEAN_HQCRMRS192_CLEAN_vect_set_random(AES_XOF_struct *ctx, uint64_t *v)
|
|||||||
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
|
|
||||||
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
v[VEC_N_SIZE_64 - 1] &= BITMASK(PARAM_N, 64);
|
v[VEC_N_SIZE_64 - 1] &= RED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
#include "api.h"
|
#include "api.h"
|
||||||
|
|
||||||
|
|
||||||
#define CEIL_DIVIDE(a, b) (((a)/(b)) + ((a) % (b) == 0 ? 0 : 1)) /*!< Divide a by b and ceil the result*/
|
#define CEIL_DIVIDE(a, b) (((a)+(b)-1)/(b)) /*!< Divide a by b and ceil the result*/
|
||||||
#define BITMASK(a, size) ((1UL << ((a) % (size))) - 1) /*!< Create a mask*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define PARAM_N Define the parameter n of the scheme
|
#define PARAM_N Define the parameter n of the scheme
|
||||||
|
@ -116,7 +116,7 @@ void PQCLEAN_HQCRMRS256_AVX2_vect_set_random(AES_XOF_struct *ctx, uint64_t *v) {
|
|||||||
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
|
|
||||||
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
v[VEC_N_SIZE_64 - 1] &= BITMASK(PARAM_N, 64);
|
v[VEC_N_SIZE_64 - 1] &= RED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,9 +11,7 @@
|
|||||||
#include "api.h"
|
#include "api.h"
|
||||||
|
|
||||||
|
|
||||||
#define CEIL_DIVIDE(a, b) (((a)/(b)) + ((a) % (b) == 0 ? 0 : 1)) /*!< Divide a by b and ceil the result*/
|
#define CEIL_DIVIDE(a, b) (((a)+(b)-1)/(b)) /*!< Divide a by b and ceil the result*/
|
||||||
#define BITMASK(a, size) ((1UL << ((a) % (size))) - 1) /*!< Create a mask*/
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#define PARAM_N Define the parameter n of the scheme
|
#define PARAM_N Define the parameter n of the scheme
|
||||||
|
@ -148,7 +148,7 @@ void PQCLEAN_HQCRMRS256_CLEAN_vect_set_random(AES_XOF_struct *ctx, uint64_t *v)
|
|||||||
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
seedexpander(ctx, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
|
|
||||||
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
memcpy(v, rand_bytes, VEC_N_SIZE_BYTES);
|
||||||
v[VEC_N_SIZE_64 - 1] &= BITMASK(PARAM_N, 64);
|
v[VEC_N_SIZE_64 - 1] &= RED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user