mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-22 15:39:07 +00:00
Namespace the #define constants.
This commit is contained in:
parent
751e05e887
commit
05b0f6d9cc
@ -5,12 +5,12 @@
|
||||
|
||||
#include "params.h"
|
||||
|
||||
#define CRYPTO_SECRETKEYBYTES KYBER_SECRETKEYBYTES
|
||||
#define CRYPTO_PUBLICKEYBYTES KYBER_PUBLICKEYBYTES
|
||||
#define CRYPTO_CIPHERTEXTBYTES KYBER_CIPHERTEXTBYTES
|
||||
#define CRYPTO_BYTES KYBER_SYMBYTES
|
||||
#define PQCLEAN_KYBER768_CLEAN_CRYPTO_SECRETKEYBYTES KYBER_SECRETKEYBYTES
|
||||
#define PQCLEAN_KYBER768_CLEAN_CRYPTO_PUBLICKEYBYTES KYBER_PUBLICKEYBYTES
|
||||
#define PQCLEAN_KYBER768_CLEAN_CRYPTO_CIPHERTEXTBYTES KYBER_CIPHERTEXTBYTES
|
||||
#define PQCLEAN_KYBER768_CLEAN_CRYPTO_BYTES KYBER_SYMBYTES
|
||||
|
||||
#define CRYPTO_ALGNAME "Kyber768"
|
||||
#define PQCLEAN_KYBER768_CLEAN_CRYPTO_ALGNAME "Kyber768"
|
||||
|
||||
int PQCLEAN_KYBER768_CLEAN_crypto_kem_keypair(uint8_t *pk, uint8_t *sk);
|
||||
|
||||
|
@ -7,11 +7,11 @@
|
||||
|
||||
#define MODE 2
|
||||
|
||||
#define CRYPTO_PUBLICKEYBYTES 1472U
|
||||
#define CRYPTO_SECRETKEYBYTES 3504U
|
||||
#define CRYPTO_BYTES 2701U
|
||||
#define PQCLEAN_DILITHIUMIII_CLEAN_CRYPTO_PUBLICKEYBYTES 1472U
|
||||
#define PQCLEAN_DILITHIUMIII_CLEAN_CRYPTO_SECRETKEYBYTES 3504U
|
||||
#define PQCLEAN_DILITHIUMIII_CLEAN_CRYPTO_BYTES 2701U
|
||||
|
||||
#define CRYPTO_ALGNAME "Dilithium-III"
|
||||
#define PQCLEAN_DILITHIUMIII_CLEAN_CRYPTO_ALGNAME "Dilithium-III"
|
||||
|
||||
int PQCLEAN_DILITHIUMIII_CLEAN_crypto_sign_keypair(uint8_t *pk,
|
||||
uint8_t *sk);
|
||||
|
@ -34,6 +34,12 @@ static int check_canary(const uint8_t *d) {
|
||||
#define EVALUATOR(x, y) PASTER(x, y)
|
||||
#define NAMESPACE(fun) EVALUATOR(PQCLEAN_NAMESPACE, fun)
|
||||
|
||||
#define CRYPTO_BYTES NAMESPACE(CRYPTO_BYTES)
|
||||
#define CRYPTO_PUBLICKEYBYTES NAMESPACE(CRYPTO_PUBLICKEYBYTES)
|
||||
#define CRYPTO_SECRETKEYBYTES NAMESPACE(CRYPTO_SECRETKEYBYTES)
|
||||
#define CRYPTO_CIPHERTEXTBYTES NAMESPACE(CRYPTO_CIPHERTEXTBYTES)
|
||||
#define CRYPTO_ALGNAME NAMESPACE(CRYPTO_ALGNAME)
|
||||
|
||||
#define crypto_kem_keypair NAMESPACE(crypto_kem_keypair)
|
||||
#define crypto_kem_enc NAMESPACE(crypto_kem_enc)
|
||||
#define crypto_kem_dec NAMESPACE(crypto_kem_dec)
|
||||
@ -190,6 +196,7 @@ static int test_invalid_ciphertext(void) {
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
puts(CRYPTO_ALGNAME);
|
||||
int result = 0;
|
||||
result += test_keys();
|
||||
result += test_invalid_sk_a();
|
||||
|
@ -21,6 +21,11 @@ static void printbytes(const uint8_t *x, size_t xlen) {
|
||||
#define EVALUATOR(x, y) PASTER(x, y)
|
||||
#define NAMESPACE(fun) EVALUATOR(PQCLEAN_NAMESPACE, fun)
|
||||
|
||||
#define CRYPTO_BYTES NAMESPACE(CRYPTO_BYTES)
|
||||
#define CRYPTO_PUBLICKEYBYTES NAMESPACE(CRYPTO_PUBLICKEYBYTES)
|
||||
#define CRYPTO_SECRETKEYBYTES NAMESPACE(CRYPTO_SECRETKEYBYTES)
|
||||
#define CRYPTO_CIPHERTEXTBYTES NAMESPACE(CRYPTO_CIPHERTEXTBYTES)
|
||||
|
||||
#define crypto_kem_keypair NAMESPACE(crypto_kem_keypair)
|
||||
#define crypto_kem_enc NAMESPACE(crypto_kem_enc)
|
||||
#define crypto_kem_dec NAMESPACE(crypto_kem_dec)
|
||||
|
@ -36,6 +36,11 @@ static int check_canary(const uint8_t *d) {
|
||||
#define EVALUATOR(x, y) PASTER(x, y)
|
||||
#define NAMESPACE(fun) EVALUATOR(PQCLEAN_NAMESPACE, fun)
|
||||
|
||||
#define CRYPTO_PUBLICKEYBYTES NAMESPACE(CRYPTO_PUBLICKEYBYTES)
|
||||
#define CRYPTO_SECRETKEYBYTES NAMESPACE(CRYPTO_SECRETKEYBYTES)
|
||||
#define CRYPTO_BYTES NAMESPACE(CRYPTO_BYTES)
|
||||
#define CRYPTO_ALGNAME NAMESPACE(CRYPTO_ALGNAME)
|
||||
|
||||
#define crypto_sign_keypair NAMESPACE(crypto_sign_keypair)
|
||||
#define crypto_sign NAMESPACE(crypto_sign)
|
||||
#define crypto_sign_open NAMESPACE(crypto_sign_open)
|
||||
@ -155,6 +160,7 @@ static int test_wrong_pk(void) {
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
puts(CRYPTO_ALGNAME);
|
||||
int result = 0;
|
||||
result += test_sign();
|
||||
result += test_wrong_pk();
|
||||
|
@ -22,6 +22,10 @@ static void printbytes(const uint8_t *x, size_t xlen) {
|
||||
#define EVALUATOR(x, y) PASTER(x, y)
|
||||
#define NAMESPACE(fun) EVALUATOR(PQCLEAN_NAMESPACE, fun)
|
||||
|
||||
#define CRYPTO_PUBLICKEYBYTES NAMESPACE(CRYPTO_PUBLICKEYBYTES)
|
||||
#define CRYPTO_SECRETKEYBYTES NAMESPACE(CRYPTO_SECRETKEYBYTES)
|
||||
#define CRYPTO_BYTES NAMESPACE(CRYPTO_BYTES)
|
||||
|
||||
#define crypto_sign_keypair NAMESPACE(crypto_sign_keypair)
|
||||
#define crypto_sign NAMESPACE(crypto_sign)
|
||||
#define crypto_sign_open NAMESPACE(crypto_sign_open)
|
||||
|
Loading…
Reference in New Issue
Block a user