remove commented code, update license
このコミットが含まれているのは:
コミット
c0aa560186
@ -15,11 +15,11 @@ void PQCLEAN_LEDAKEMLT12_CLEAN_generateHPosOnes_HtrPosOnes(
|
|||||||
/* Obtain directly the sparse representation of the block of H */
|
/* Obtain directly the sparse representation of the block of H */
|
||||||
for (int k = 0; k < DV; k++) {
|
for (int k = 0; k < DV; k++) {
|
||||||
HPosOnes[i][k] = (P - HtrPosOnes[i][k]) % P; /* transposes indexes */
|
HPosOnes[i][k] = (P - HtrPosOnes[i][k]) % P; /* transposes indexes */
|
||||||
}// end for k
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PQCLEAN_LEDAKEMLT12_CLEAN_generateQsparse(
|
void PQCLEAN_LEDAKEMLT12_CLEAN_generateQsparse(
|
||||||
POSITION_T pos_ones[N0][M],
|
POSITION_T pos_ones[N0][M],
|
||||||
AES_XOF_struct *keys_expander) {
|
AES_XOF_struct *keys_expander) {
|
||||||
for (int i = 0; i < N0; i++) {
|
for (int i = 0; i < N0; i++) {
|
||||||
@ -29,6 +29,6 @@ void PQCLEAN_LEDAKEMLT12_CLEAN_generateQsparse(
|
|||||||
qBlockWeights[i][j],
|
qBlockWeights[i][j],
|
||||||
keys_expander);
|
keys_expander);
|
||||||
placed_ones += qBlockWeights[i][j];
|
placed_ones += qBlockWeights[i][j];
|
||||||
} // end for j
|
}
|
||||||
} // end for i
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @version 2.0 (March 2019)
|
* @version 2.0 (March 2019)
|
||||||
*
|
*
|
||||||
* Reference ISO-C11 Implementation of the LEDAcrypt KEM-LT cipher using GCC built-ins.
|
* Adapted code from reference ISO-C11 Implementation of the LEDAcrypt KEM-LT cipher.
|
||||||
* Also contains public domain implementations of AES and Keccak
|
|
||||||
*
|
*
|
||||||
* In alphabetical order:
|
* In alphabetical order:
|
||||||
*
|
*
|
||||||
|
@ -13,15 +13,6 @@ static void gf2x_mod(DIGIT out[], const DIGIT in[]) {
|
|||||||
memcpy(aux, in, 2 * NUM_DIGITS_GF2X_ELEMENT * DIGIT_SIZE_B);
|
memcpy(aux, in, 2 * NUM_DIGITS_GF2X_ELEMENT * DIGIT_SIZE_B);
|
||||||
memset(out, 0x00, NUM_DIGITS_GF2X_ELEMENT * DIGIT_SIZE_B);
|
memset(out, 0x00, NUM_DIGITS_GF2X_ELEMENT * DIGIT_SIZE_B);
|
||||||
|
|
||||||
/* not true for parameter set
|
|
||||||
if (2 * NUM_DIGITS_GF2X_ELEMENT < NUM_DIGITS_GF2X_MODULUS) {
|
|
||||||
for (i = 0; i < 2 * NUM_DIGITS_GF2X_ELEMENT; i++) {
|
|
||||||
out[NUM_DIGITS_GF2X_ELEMENT - 1 - i] = in[2 * NUM_DIGITS_GF2X_ELEMENT - 1 - i];
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (i = 0; i < (2 * NUM_DIGITS_GF2X_ELEMENT) - NUM_DIGITS_GF2X_MODULUS; i += 1) {
|
for (i = 0; i < (2 * NUM_DIGITS_GF2X_ELEMENT) - NUM_DIGITS_GF2X_MODULUS; i += 1) {
|
||||||
for (j = DIGIT_SIZE_b - 1; j >= 0; j--) {
|
for (j = DIGIT_SIZE_b - 1; j >= 0; j--) {
|
||||||
mask = ((DIGIT)0x1) << j;
|
mask = ((DIGIT)0x1) << j;
|
||||||
|
@ -164,7 +164,7 @@ int PQCLEAN_LEDAKEMLT12_CLEAN_niederreiter_decrypt(DIGIT *err, const privateKeyN
|
|||||||
PQCLEAN_LEDAKEMLT12_CLEAN_gf2x_mod_add_sparse(DV * M, Ln0trSparse,
|
PQCLEAN_LEDAKEMLT12_CLEAN_gf2x_mod_add_sparse(DV * M, Ln0trSparse,
|
||||||
DV * M, Ln0trSparse,
|
DV * M, Ln0trSparse,
|
||||||
DV * M, auxSparse);
|
DV * M, auxSparse);
|
||||||
} // end for i
|
}
|
||||||
|
|
||||||
PQCLEAN_LEDAKEMLT12_CLEAN_gf2x_transpose_in_place_sparse(DV * M, Ln0trSparse);
|
PQCLEAN_LEDAKEMLT12_CLEAN_gf2x_transpose_in_place_sparse(DV * M, Ln0trSparse);
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ int PQCLEAN_LEDAKEMLT12_CLEAN_niederreiter_decrypt(DIGIT *err, const privateKeyN
|
|||||||
}
|
}
|
||||||
decryptOk = decryptOk && (err_weight == NUM_ERRORS_T);
|
decryptOk = decryptOk && (err_weight == NUM_ERRORS_T);
|
||||||
|
|
||||||
if (!decryptOk) { // TODO: not constant time
|
if (!decryptOk) { // TODO: not constant time, replace with cmov?
|
||||||
memcpy(err, mockup_error_vector, N0 * NUM_DIGITS_GF2X_ELEMENT * DIGIT_SIZE_B);
|
memcpy(err, mockup_error_vector, N0 * NUM_DIGITS_GF2X_ELEMENT * DIGIT_SIZE_B);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
読み込み中…
新しいイシューから参照
ユーザーをブロックする