From b87bca514ebc25758be3f8706b179e4b636351a3 Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Mon, 3 Jun 2019 21:51:05 +0200 Subject: [PATCH] remove preprocessor conditionals --- crypto_sign/rainbowIa-classic/clean/blas.h | 4 +- .../rainbowIa-classic/clean/blas_comm.h | 4 +- .../rainbowIa-classic/clean/blas_u32.h | 4 +- crypto_sign/rainbowIa-classic/clean/gf16.h | 4 +- .../rainbowIa-classic/clean/hash_len_config.h | 10 +-- .../clean/parallel_matrix_op.h | 9 +- crypto_sign/rainbowIa-classic/clean/rainbow.h | 14 +-- .../rainbowIa-classic/clean/rainbow_blas.h | 28 +----- .../rainbowIa-classic/clean/rainbow_config.h | 68 +++++++------- .../rainbowIa-classic/clean/rainbow_keypair.h | 4 +- .../clean/rainbow_keypair_computation.c | 12 +-- .../clean/rainbow_keypair_computation.h | 4 +- crypto_sign/rainbowIa-classic/clean/sign.c | 88 +++++++++---------- .../rainbowIa-classic/clean/utils_hash.c | 21 ++--- .../rainbowIa-classic/clean/utils_hash.h | 4 +- .../rainbowIa-classic/clean/utils_prng.h | 4 +- 16 files changed, 114 insertions(+), 168 deletions(-) diff --git a/crypto_sign/rainbowIa-classic/clean/blas.h b/crypto_sign/rainbowIa-classic/clean/blas.h index c54a9269..406a61cf 100644 --- a/crypto_sign/rainbowIa-classic/clean/blas.h +++ b/crypto_sign/rainbowIa-classic/clean/blas.h @@ -1,9 +1,9 @@ +#ifndef _BLAS_H_ +#define _BLAS_H_ /// @file blas.h /// @brief Defining the implementations for linear algebra functions depending on the machine architecture. /// -#ifndef _BLAS_H_ -#define _BLAS_H_ #include "blas_comm.h" #include "blas_u32.h" diff --git a/crypto_sign/rainbowIa-classic/clean/blas_comm.h b/crypto_sign/rainbowIa-classic/clean/blas_comm.h index 5b779430..aab6d3ce 100644 --- a/crypto_sign/rainbowIa-classic/clean/blas_comm.h +++ b/crypto_sign/rainbowIa-classic/clean/blas_comm.h @@ -1,8 +1,8 @@ +#ifndef _BLAS_COMM_H_ +#define _BLAS_COMM_H_ /// @file blas_comm.h /// @brief Common functions for linear algebra. /// -#ifndef _BLAS_COMM_H_ -#define _BLAS_COMM_H_ #include diff --git a/crypto_sign/rainbowIa-classic/clean/blas_u32.h b/crypto_sign/rainbowIa-classic/clean/blas_u32.h index 81ea3411..ba3e2679 100644 --- a/crypto_sign/rainbowIa-classic/clean/blas_u32.h +++ b/crypto_sign/rainbowIa-classic/clean/blas_u32.h @@ -1,9 +1,9 @@ +#ifndef _BLAS_U32_H_ +#define _BLAS_U32_H_ /// @file blas_u32.h /// @brief Inlined functions for implementing basic linear algebra functions for uint32 arch. /// -#ifndef _BLAS_U32_H_ -#define _BLAS_U32_H_ #include "gf16.h" diff --git a/crypto_sign/rainbowIa-classic/clean/gf16.h b/crypto_sign/rainbowIa-classic/clean/gf16.h index ace634d8..349c22a6 100644 --- a/crypto_sign/rainbowIa-classic/clean/gf16.h +++ b/crypto_sign/rainbowIa-classic/clean/gf16.h @@ -1,9 +1,9 @@ +#ifndef _GF16_H_ +#define _GF16_H_ /// @file gf16.h /// @brief Library for arithmetics in GF(16) and GF(256) /// -#ifndef _GF16_H_ -#define _GF16_H_ #include diff --git a/crypto_sign/rainbowIa-classic/clean/hash_len_config.h b/crypto_sign/rainbowIa-classic/clean/hash_len_config.h index eb9da010..253130c9 100644 --- a/crypto_sign/rainbowIa-classic/clean/hash_len_config.h +++ b/crypto_sign/rainbowIa-classic/clean/hash_len_config.h @@ -1,14 +1,12 @@ +#ifndef _HASH_LEN_CONFIG_H_ +#define _HASH_LEN_CONFIG_H_ /// @file hash_len_config.h /// @brief defining the lenght of outputs of the internel hash functions. /// -#ifndef _HASH_LEN_CONFIG_H_ -#define _HASH_LEN_CONFIG_H_ - +// TODO: remove this file /// defining the lenght of outputs of the internel hash functions. -#ifndef _HASH_LEN -#define _HASH_LEN (32) -#endif +//#define _HASH_LEN (32) #endif diff --git a/crypto_sign/rainbowIa-classic/clean/parallel_matrix_op.h b/crypto_sign/rainbowIa-classic/clean/parallel_matrix_op.h index 4881bc53..712bef52 100644 --- a/crypto_sign/rainbowIa-classic/clean/parallel_matrix_op.h +++ b/crypto_sign/rainbowIa-classic/clean/parallel_matrix_op.h @@ -1,15 +1,10 @@ +#ifndef _P_MATRIX_OP_H_ +#define _P_MATRIX_OP_H_ /// @file parallel_matrix_op.h /// @brief Librarys for operations of batched matrixes. /// /// -#ifndef _P_MATRIX_OP_H_ -#define _P_MATRIX_OP_H_ - - - - - //////////////////////////////////////////////////////////////////////// /// Librarys for batched matrix operations. /// A batched matrix is a matrix which each element of the matrix diff --git a/crypto_sign/rainbowIa-classic/clean/rainbow.h b/crypto_sign/rainbowIa-classic/clean/rainbow.h index c1947f67..9aa4a11c 100644 --- a/crypto_sign/rainbowIa-classic/clean/rainbow.h +++ b/crypto_sign/rainbowIa-classic/clean/rainbow.h @@ -1,18 +1,15 @@ +#ifndef _RAINBOW_H_ +#define _RAINBOW_H_ /// @file rainbow.h /// @brief APIs for rainbow. /// -#ifndef _RAINBOW_H_ -#define _RAINBOW_H_ #include "rainbow_config.h" #include "rainbow_keypair.h" #include -#ifdef __cplusplus -extern "C" { -#endif /// @@ -54,11 +51,4 @@ int PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_sign_cyclic( uint8_t *signature, cons /// int PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_verify_cyclic( const uint8_t *digest, const uint8_t *signature, const cpk_t *pk ); - - -#ifdef __cplusplus -} -#endif - - #endif // _RAINBOW_H_ diff --git a/crypto_sign/rainbowIa-classic/clean/rainbow_blas.h b/crypto_sign/rainbowIa-classic/clean/rainbow_blas.h index 8f42efd3..dd463840 100644 --- a/crypto_sign/rainbowIa-classic/clean/rainbow_blas.h +++ b/crypto_sign/rainbowIa-classic/clean/rainbow_blas.h @@ -1,10 +1,10 @@ +#ifndef _RAINBOW_BLAS_H_ +#define _RAINBOW_BLAS_H_ /// @file rainbow_blas.h /// @brief Defining the functions used in rainbow.c acconding to the definitions in rainbow_config.h /// /// Defining the functions used in rainbow.c acconding to the definitions in rainbow_config.h -#ifndef _RAINBOW_BLAS_H_ -#define _RAINBOW_BLAS_H_ #include "blas.h" @@ -12,8 +12,6 @@ #include "rainbow_config.h" -#ifdef _USE_GF16 - #define gfv_get_ele PQCLEAN_RAINBOWIACLASSIC_CLEAN_gf16v_get_ele #define gfv_mul_scalar PQCLEAN_RAINBOWIACLASSIC_CLEAN_gf16v_mul_scalar #define gfv_madd PQCLEAN_RAINBOWIACLASSIC_CLEAN_gf16v_madd @@ -31,27 +29,5 @@ #define batch_quad_trimat_eval PQCLEAN_RAINBOWIACLASSIC_CLEAN_batch_quad_trimat_eval_gf16 #define batch_quad_recmat_eval PQCLEAN_RAINBOWIACLASSIC_CLEAN_batch_quad_recmat_eval_gf16 -#else - -#define gfv_get_ele gf256v_get_ele -#define gfv_mul_scalar gf256v_mul_scalar -#define gfv_madd gf256v_madd - -#define gfmat_prod gf256mat_prod -#define gfmat_inv gf256mat_inv - -#define batch_trimat_madd batch_trimat_madd_gf256 -#define batch_trimatTr_madd batch_trimatTr_madd_gf256 -#define batch_2trimat_madd batch_2trimat_madd_gf256 -#define batch_matTr_madd batch_matTr_madd_gf256 -#define batch_bmatTr_madd batch_bmatTr_madd_gf256 -#define batch_mat_madd batch_mat_madd_gf256 - -#define batch_quad_trimat_eval batch_quad_trimat_eval_gf256 -#define batch_quad_recmat_eval batch_quad_recmat_eval_gf256 - -#endif - - #endif // _RAINBOW_BLAS_H_ diff --git a/crypto_sign/rainbowIa-classic/clean/rainbow_config.h b/crypto_sign/rainbowIa-classic/clean/rainbow_config.h index da952ce4..b7750aa3 100644 --- a/crypto_sign/rainbowIa-classic/clean/rainbow_config.h +++ b/crypto_sign/rainbowIa-classic/clean/rainbow_config.h @@ -1,3 +1,5 @@ +#ifndef _H_RAINBOW_CONFIG_H_ +#define _H_RAINBOW_CONFIG_H_ /// @file rainbow_config.h /// @brief Defining the parameters of the Rainbow and the corresponding constants. /// @@ -6,45 +8,43 @@ /// /// -#ifndef _H_RAINBOW_CONFIG_H_ -#define _H_RAINBOW_CONFIG_H_ // TODO: refactor this /// the defined parameter -#if (!defined(_RAINBOW16_32_32_32))&&(!defined(_RAINBOW256_68_36_36))&&(!defined(_RAINBOW256_92_48_48)) +//#if (!defined(_RAINBOW16_32_32_32))&&(!defined(_RAINBOW256_68_36_36))&&(!defined(_RAINBOW256_92_48_48)) #define _RAINBOW16_32_32_32 //#define _RAINBOW256_68_36_36 //#define _RAINBOW256_92_48_48 -#endif +//#endif -#if defined _RAINBOW16_32_32_32 +//#if defined _RAINBOW16_32_32_32 #define _USE_GF16 #define _GFSIZE 16 #define _V1 32 #define _O1 32 #define _O2 32 #define _HASH_LEN 32 - -#elif defined _RAINBOW256_68_36_36 -#define _GFSIZE 256 -#define _V1 68 -#define _O1 36 -#define _O2 36 -#define _HASH_LEN 48 - -#elif defined _RAINBOW256_92_48_48 -#define _GFSIZE 256 -#define _V1 92 -#define _O1 48 -#define _O2 48 -#define _HASH_LEN 64 - -#else -error here. -#endif +// +//#elif defined _RAINBOW256_68_36_36 +//#define _GFSIZE 256 +//#define _V1 68 +//#define _O1 36 +//#define _O2 36 +//#define _HASH_LEN 48 +// +//#elif defined _RAINBOW256_92_48_48 +//#define _GFSIZE 256 +//#define _V1 92 +//#define _O1 48 +//#define _O2 48 +//#define _HASH_LEN 64 +// +//#else +//error here. +//#endif #define _V2 ((_V1)+(_O1)) @@ -64,7 +64,7 @@ error here. /// size of variables, in # bytes. -#ifdef _USE_GF16 +//#ifdef _USE_GF16 // GF16 #define _V1_BYTE (_V1/2) #define _V2_BYTE (_V2/2) @@ -73,16 +73,16 @@ error here. #define _PUB_N_BYTE (_PUB_N/2) #define _PUB_M_BYTE (_PUB_M/2) -#else -// GF256 -#define _V1_BYTE (_V1) -#define _V2_BYTE (_V2) -#define _O1_BYTE (_O1) -#define _O2_BYTE (_O2) -#define _PUB_N_BYTE (_PUB_N) -#define _PUB_M_BYTE (_PUB_M) - -#endif +//#else +//// GF256 +//#define _V1_BYTE (_V1) +//#define _V2_BYTE (_V2) +//#define _O1_BYTE (_O1) +//#define _O2_BYTE (_O2) +//#define _PUB_N_BYTE (_PUB_N) +//#define _PUB_M_BYTE (_PUB_M) +// +//#endif /// length of seed for public key, in # bytes diff --git a/crypto_sign/rainbowIa-classic/clean/rainbow_keypair.h b/crypto_sign/rainbowIa-classic/clean/rainbow_keypair.h index accee12c..d5996138 100644 --- a/crypto_sign/rainbowIa-classic/clean/rainbow_keypair.h +++ b/crypto_sign/rainbowIa-classic/clean/rainbow_keypair.h @@ -1,10 +1,10 @@ +#ifndef _RAINBOW_KEYPAIR_H_ +#define _RAINBOW_KEYPAIR_H_ /// @file rainbow_keypair.h /// @brief Formats of key pairs and functions for generating key pairs. /// Formats of key pairs and functions for generating key pairs. /// -#ifndef _RAINBOW_KEYPAIR_H_ -#define _RAINBOW_KEYPAIR_H_ #include "rainbow_config.h" diff --git a/crypto_sign/rainbowIa-classic/clean/rainbow_keypair_computation.c b/crypto_sign/rainbowIa-classic/clean/rainbow_keypair_computation.c index 70ebac1e..081eaaac 100644 --- a/crypto_sign/rainbowIa-classic/clean/rainbow_keypair_computation.c +++ b/crypto_sign/rainbowIa-classic/clean/rainbow_keypair_computation.c @@ -119,18 +119,8 @@ void calculate_Q_from_F_ref( ext_cpk_t *Qs, const sk_t *Fs, const sk_t *Ts ) { // l2_Q5 : _O2_BYTE * _V1 * _O1 // l2_Q9 : _O2_BYTE * _V1 * _O2 -#define SIZE_TEMPQ (_O1_BYTE * _O1 * _O1) - #if (_O1_BYTE*_O2*_O2)> SIZE_TEMPQ -#define SIZE_TEMPQ (_O1_BYTE*_O2*_O2) - #endif - #if (_O2_BYTE*_O1*_O1) > SIZE_TEMPQ -#define SIZE_TEMPQ (_O2_BYTE*_O1*_O1) - #endif - #if (_O2_BYTE*_O2*_O2) > SIZE_TEMPQ -#define SIZE_TEMPQ (_O2_BYTE*_O2*_O2) - #endif - unsigned char tempQ[SIZE_TEMPQ + 32]; + unsigned char tempQ[_O1_BYTE * _O1 * _O1 + 32]; memset( tempQ, 0, _O1_BYTE * _O1 * _O1 ); // l1_Q5 batch_matTr_madd( tempQ, Ts->t1, _V1, _V1_BYTE, _O1, Qs->l1_Q2, _O1, _O1_BYTE ); // t1_tr*(F1*T1 + F2) diff --git a/crypto_sign/rainbowIa-classic/clean/rainbow_keypair_computation.h b/crypto_sign/rainbowIa-classic/clean/rainbow_keypair_computation.h index 5aec5ae4..ec27f572 100644 --- a/crypto_sign/rainbowIa-classic/clean/rainbow_keypair_computation.h +++ b/crypto_sign/rainbowIa-classic/clean/rainbow_keypair_computation.h @@ -1,3 +1,5 @@ +#ifndef _RAINBOW_KEYPAIR_COMP_H_ +#define _RAINBOW_KEYPAIR_COMP_H_ /// @file rainbow_keypair_computation.h /// @brief Functions for calculating pk/sk while generating keys. /// @@ -5,8 +7,6 @@ /// Functions for calculating pk/sk for key generation. /// -#ifndef _RAINBOW_KEYPAIR_COMP_H_ -#define _RAINBOW_KEYPAIR_COMP_H_ #include "rainbow_keypair.h" diff --git a/crypto_sign/rainbowIa-classic/clean/sign.c b/crypto_sign/rainbowIa-classic/clean/sign.c index 82d2122d..cfc9280d 100644 --- a/crypto_sign/rainbowIa-classic/clean/sign.c +++ b/crypto_sign/rainbowIa-classic/clean/sign.c @@ -20,25 +20,25 @@ PQCLEAN_RAINBOWIACLASSIC_CLEAN_crypto_sign_keypair(unsigned char *pk, unsigned c unsigned char sk_seed[LEN_SKSEED] = {0}; randombytes( sk_seed, LEN_SKSEED ); - #if defined _RAINBOW_CLASSIC +// #if defined _RAINBOW_CLASSIC PQCLEAN_RAINBOWIACLASSIC_CLEAN_generate_keypair( (pk_t *) pk, (sk_t *) sk, sk_seed ); - #elif defined _RAINBOW_CYCLIC +// #elif defined _RAINBOW_CYCLIC - unsigned char pk_seed[LEN_PKSEED] = {0}; - randombytes( pk_seed, LEN_PKSEED ); - generate_keypair_cyclic( (cpk_t *) pk, (sk_t *) sk, pk_seed, sk_seed ); +// unsigned char pk_seed[LEN_PKSEED] = {0}; +// randombytes( pk_seed, LEN_PKSEED ); +// generate_keypair_cyclic( (cpk_t *) pk, (sk_t *) sk, pk_seed, sk_seed ); - #elif defined _RAINBOW_CYCLIC_COMPRESSED +// #elif defined _RAINBOW_CYCLIC_COMPRESSED - unsigned char pk_seed[LEN_PKSEED] = {0}; - randombytes( pk_seed, LEN_PKSEED ); - generate_compact_keypair_cyclic( (cpk_t *) pk, (csk_t *) sk, pk_seed, sk_seed ); +// unsigned char pk_seed[LEN_PKSEED] = {0}; +// randombytes( pk_seed, LEN_PKSEED ); +// generate_compact_keypair_cyclic( (cpk_t *) pk, (csk_t *) sk, pk_seed, sk_seed ); - #else - error here - #endif +// #else +// error here +// #endif return 0; } @@ -55,21 +55,21 @@ PQCLEAN_RAINBOWIACLASSIC_CLEAN_crypto_sign(unsigned char *sm, size_t *smlen, con memcpy( sm, m, mlen ); smlen[0] = mlen + _SIGNATURE_BYTE; - #if defined _RAINBOW_CLASSIC +// #if defined _RAINBOW_CLASSIC return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_sign( sm + mlen, (const sk_t *)sk, digest ); - #elif defined _RAINBOW_CYCLIC +// #elif defined _RAINBOW_CYCLIC - return rainbow_sign( sm + mlen, (const sk_t *)sk, digest ); +// return rainbow_sign( sm + mlen, (const sk_t *)sk, digest ); - #elif defined _RAINBOW_CYCLIC_COMPRESSED +// #elif defined _RAINBOW_CYCLIC_COMPRESSED - return rainbow_sign_cyclic( sm + mlen, (const csk_t *)sk, digest ); +// return rainbow_sign_cyclic( sm + mlen, (const csk_t *)sk, digest ); - #else - error here - #endif +// #else +// error here +// #endif } @@ -91,21 +91,21 @@ PQCLEAN_RAINBOWIACLASSIC_CLEAN_crypto_sign_open(unsigned char *m, size_t *mlen, unsigned char digest[_HASH_LEN]; PQCLEAN_RAINBOWIACLASSIC_CLEAN_hash_msg( digest, _HASH_LEN, m, *mlen ); - #if defined _RAINBOW_CLASSIC +// #if defined _RAINBOW_CLASSIC return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_verify( digest, sm + mlen[0], (const pk_t *)pk ); - #elif defined _RAINBOW_CYCLIC +// #elif defined _RAINBOW_CYCLIC - return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_verify_cyclic( digest, sm + mlen[0], (const cpk_t *)pk ); +// return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_verify_cyclic( digest, sm + mlen[0], (const cpk_t *)pk ); - #elif defined _RAINBOW_CYCLIC_COMPRESSED +// #elif defined _RAINBOW_CYCLIC_COMPRESSED - return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_verify_cyclic( digest, sm + mlen[0], (const cpk_t *)pk ); +// return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_verify_cyclic( digest, sm + mlen[0], (const cpk_t *)pk ); - #else - error here - #endif +// #else +// error here +// #endif } @@ -117,15 +117,15 @@ int PQCLEAN_RAINBOWIACLASSIC_CLEAN_crypto_sign_signature( PQCLEAN_RAINBOWIACLASSIC_CLEAN_hash_msg( digest, _HASH_LEN, m, mlen ); *siglen = _SIGNATURE_BYTE; - #if defined _RAINBOW_CLASSIC + // #if defined _RAINBOW_CLASSIC return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_sign( sig, (const sk_t *)sk, digest ); - #elif defined _RAINBOW_CYCLIC - return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_sign( sig, (const sk_t *)sk, digest ); - #elif defined _RAINBOW_CYCLIC_COMPRESSED - return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_sign_cyclic( sig, (const csk_t *)sk, digest ); - #else - error here - #endif + // #elif defined _RAINBOW_CYCLIC + // return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_sign( sig, (const sk_t *)sk, digest ); + // #elif defined _RAINBOW_CYCLIC_COMPRESSED + // return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_sign_cyclic( sig, (const csk_t *)sk, digest ); + // #else + // error here + // #endif } @@ -137,14 +137,14 @@ int PQCLEAN_RAINBOWIACLASSIC_CLEAN_crypto_sign_verify( } unsigned char digest[_HASH_LEN]; PQCLEAN_RAINBOWIACLASSIC_CLEAN_hash_msg( digest, _HASH_LEN, m, mlen ); - #if defined _RAINBOW_CLASSIC + // #if defined _RAINBOW_CLASSIC return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_verify( digest, sig, (const pk_t *)pk ); - #elif defined _RAINBOW_CYCLIC - return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_verify_cyclic( digest, sig, (const cpk_t *)pk ); - #elif defined _RAINBOW_CYCLIC_COMPRESSED - return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_verify_cyclic( digest, sig, (const cpk_t *)pk ); - #else - error here - #endif + // #elif defined _RAINBOW_CYCLIC + // return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_verify_cyclic( digest, sig, (const cpk_t *)pk ); + // #elif defined _RAINBOW_CYCLIC_COMPRESSED + // return PQCLEAN_RAINBOWIACLASSIC_CLEAN_rainbow_verify_cyclic( digest, sig, (const cpk_t *)pk ); + // #else + // error here + // #endif } diff --git a/crypto_sign/rainbowIa-classic/clean/utils_hash.c b/crypto_sign/rainbowIa-classic/clean/utils_hash.c index 1b072a3c..8c9e3aab 100644 --- a/crypto_sign/rainbowIa-classic/clean/utils_hash.c +++ b/crypto_sign/rainbowIa-classic/clean/utils_hash.c @@ -4,24 +4,21 @@ /// #include "hash_len_config.h" +#include "rainbow_config.h" #include "sha2.h" #include "utils_hash.h" -#ifndef _HASH_LEN -#define _HASH_LEN (32) -#endif - static inline int _hash( unsigned char *digest, const unsigned char *m, unsigned long long mlen ) { - #if 32 == _HASH_LEN +// #if 32 == _HASH_LEN sha256(digest, m, mlen); - #elif 48 == _HASH_LEN - sha384(digest, m, mlen); - #elif 64 == _HASH_LEN - sha512(digest, m, mlen); - #else -#error "unsupported _HASH_LEN" - #endif +// #elif 48 == _HASH_LEN +// sha384(digest, m, mlen); +// #elif 64 == _HASH_LEN +// sha512(digest, m, mlen); +// #else +//#error "unsupported _HASH_LEN" +// #endif return 0; } diff --git a/crypto_sign/rainbowIa-classic/clean/utils_hash.h b/crypto_sign/rainbowIa-classic/clean/utils_hash.h index 2aeffde4..ba234866 100644 --- a/crypto_sign/rainbowIa-classic/clean/utils_hash.h +++ b/crypto_sign/rainbowIa-classic/clean/utils_hash.h @@ -1,9 +1,9 @@ +#ifndef _UTILS_HASH_H_ +#define _UTILS_HASH_H_ /// @file utils_hash.h /// @brief the interface for adapting hash functions. /// /// -#ifndef _UTILS_HASH_H_ -#define _UTILS_HASH_H_ // for the definition of _HASH_LEN. #include "hash_len_config.h" diff --git a/crypto_sign/rainbowIa-classic/clean/utils_prng.h b/crypto_sign/rainbowIa-classic/clean/utils_prng.h index 6c1f93a9..86f9ea5b 100644 --- a/crypto_sign/rainbowIa-classic/clean/utils_prng.h +++ b/crypto_sign/rainbowIa-classic/clean/utils_prng.h @@ -1,10 +1,10 @@ +#ifndef _UTILS_PRNG_H_ +#define _UTILS_PRNG_H_ /// @file utils_prng.h /// @brief the interface for adapting PRNG functions. /// /// -#ifndef _UTILS_PRNG_H_ -#define _UTILS_PRNG_H_ #include "randombytes.h"