1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-22 15:39:07 +00:00

Specify arrays with sizes again

This commit is contained in:
Thom Wiggers 2019-12-12 14:11:12 +01:00 committed by Kris Kwiatkowski
parent 2b9759912d
commit 7dc03bfc44
24 changed files with 204 additions and 186 deletions

View File

@ -4,6 +4,7 @@
#include <stddef.h>
#include <stdint.h>
#define PQCLEAN_DILITHIUM2_AVX2_CRYPTO_PUBLICKEYBYTES 1184U
#define PQCLEAN_DILITHIUM2_AVX2_CRYPTO_SECRETKEYBYTES 2800U
#define PQCLEAN_DILITHIUM2_AVX2_CRYPTO_BYTES 2044U

View File

@ -13,8 +13,8 @@
* - const polyveck *t1: pointer to vector t1
**************************************************/
void PQCLEAN_DILITHIUM2_AVX2_pack_pk(
uint8_t *pk,
const uint8_t *rho,
uint8_t pk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_PUBLICKEYBYTES],
const uint8_t rho[SEEDBYTES],
const polyveck *t1) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
pk[i] = rho[i];
@ -36,9 +36,9 @@ void PQCLEAN_DILITHIUM2_AVX2_pack_pk(
* - uint8_t pk[]: byte array containing bit-packed pk
**************************************************/
void PQCLEAN_DILITHIUM2_AVX2_unpack_pk(
uint8_t *rho,
uint8_t rho[SEEDBYTES],
polyveck *t1,
const uint8_t *pk) {
const uint8_t pk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_PUBLICKEYBYTES]) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
rho[i] = pk[i];
}
@ -63,10 +63,10 @@ void PQCLEAN_DILITHIUM2_AVX2_unpack_pk(
* - const polyveck *t0: pointer to vector t0
**************************************************/
void PQCLEAN_DILITHIUM2_AVX2_pack_sk(
uint8_t *sk,
const uint8_t *rho,
const uint8_t *key,
const uint8_t *tr,
uint8_t sk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_SECRETKEYBYTES],
const uint8_t rho[SEEDBYTES],
const uint8_t key[SEEDBYTES],
const uint8_t tr[CRHBYTES],
const polyvecl *s1,
const polyveck *s2,
const polyveck *t0) {
@ -114,13 +114,13 @@ void PQCLEAN_DILITHIUM2_AVX2_pack_sk(
* - uint8_t sk[]: byte array containing bit-packed sk
**************************************************/
void PQCLEAN_DILITHIUM2_AVX2_unpack_sk(
uint8_t *rho,
uint8_t *key,
uint8_t *tr,
uint8_t rho[SEEDBYTES],
uint8_t key[SEEDBYTES],
uint8_t tr[CRHBYTES],
polyvecl *s1,
polyveck *s2,
polyveck *t0,
const uint8_t *sk) {
const uint8_t sk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_SECRETKEYBYTES]) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
rho[i] = sk[i];
}
@ -162,7 +162,7 @@ void PQCLEAN_DILITHIUM2_AVX2_unpack_sk(
* - const poly *c: pointer to challenge polynomial
**************************************************/
void PQCLEAN_DILITHIUM2_AVX2_pack_sig(
uint8_t *sig,
uint8_t sig[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_SECRETKEYBYTES],
const polyvecl *z,
const polyveck *h,
const poly *c) {
@ -228,7 +228,7 @@ int PQCLEAN_DILITHIUM2_AVX2_unpack_sig(
polyvecl *z,
polyveck *h,
poly *c,
const uint8_t *sig) {
const uint8_t sig[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_BYTES]) {
size_t k;
uint64_t signs;

View File

@ -1,36 +1,42 @@
#ifndef PQCLEAN_DILITHIUM2_AVX2_PACKING_H
#define PQCLEAN_DILITHIUM2_AVX2_PACKING_H
#include "api.h"
#include "params.h"
#include "polyvec.h"
void PQCLEAN_DILITHIUM2_AVX2_pack_pk(
uint8_t *pk,
const uint8_t *rho, const polyveck *t1);
uint8_t pk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_PUBLICKEYBYTES],
const uint8_t rho[SEEDBYTES],
const polyveck *t1);
void PQCLEAN_DILITHIUM2_AVX2_pack_sk(
uint8_t *sk,
const uint8_t *rho,
const uint8_t *key,
const uint8_t *tr,
uint8_t sk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_SECRETKEYBYTES],
const uint8_t rho[SEEDBYTES],
const uint8_t key[SEEDBYTES],
const uint8_t tr[SEEDBYTES],
const polyvecl *s1,
const polyveck *s2,
const polyveck *t0);
void PQCLEAN_DILITHIUM2_AVX2_pack_sig(
uint8_t *sig,
uint8_t sig[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_SECRETKEYBYTES],
const polyvecl *z, const polyveck *h, const poly *c);
void PQCLEAN_DILITHIUM2_AVX2_unpack_pk(
uint8_t *rho, polyveck *t1,
const uint8_t *pk);
uint8_t rho[SEEDBYTES],
polyveck *t1,
const uint8_t pk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_PUBLICKEYBYTES]);
void PQCLEAN_DILITHIUM2_AVX2_unpack_sk(
uint8_t *rho,
uint8_t *key,
uint8_t *tr,
uint8_t rho[SEEDBYTES],
uint8_t key[SEEDBYTES],
uint8_t tr[CRHBYTES],
polyvecl *s1,
polyveck *s2,
polyveck *t0,
const uint8_t *sk);
int PQCLEAN_DILITHIUM2_AVX2_unpack_sig(
polyvecl *z, polyveck *h, poly *c, const uint8_t *sig);
polyvecl *z,
polyveck *h,
poly *c,
const uint8_t sig[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_BYTES]);
#endif

View File

@ -26,8 +26,4 @@
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
#define POLW1_SIZE_PACKED ((N*4)/8)
#define CRYPTO_PUBLICKEYBYTES (SEEDBYTES + K*POLT1_SIZE_PACKED)
#define CRYPTO_SECRETKEYBYTES (2*SEEDBYTES + (L + K)*POLETA_SIZE_PACKED + CRHBYTES + K*POLT0_SIZE_PACKED)
#define CRYPTO_BYTES (L*POLZ_SIZE_PACKED + (OMEGA + K) + (N/8 + 8))
#endif

View File

@ -4,6 +4,7 @@
#include <stddef.h>
#include <stdint.h>
#define PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_PUBLICKEYBYTES 1184U
#define PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_SECRETKEYBYTES 2800U
#define PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_BYTES 2044U

View File

@ -13,8 +13,8 @@
* - const polyveck *t1: pointer to vector t1
**************************************************/
void PQCLEAN_DILITHIUM2_CLEAN_pack_pk(
uint8_t *pk,
const uint8_t *rho,
uint8_t pk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_PUBLICKEYBYTES],
const uint8_t rho[SEEDBYTES],
const polyveck *t1) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
pk[i] = rho[i];
@ -36,9 +36,9 @@ void PQCLEAN_DILITHIUM2_CLEAN_pack_pk(
* - uint8_t pk[]: byte array containing bit-packed pk
**************************************************/
void PQCLEAN_DILITHIUM2_CLEAN_unpack_pk(
uint8_t *rho,
uint8_t rho[SEEDBYTES],
polyveck *t1,
const uint8_t *pk) {
const uint8_t pk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_PUBLICKEYBYTES]) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
rho[i] = pk[i];
}
@ -63,10 +63,10 @@ void PQCLEAN_DILITHIUM2_CLEAN_unpack_pk(
* - const polyveck *t0: pointer to vector t0
**************************************************/
void PQCLEAN_DILITHIUM2_CLEAN_pack_sk(
uint8_t *sk,
const uint8_t *rho,
const uint8_t *key,
const uint8_t *tr,
uint8_t sk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_SECRETKEYBYTES],
const uint8_t rho[SEEDBYTES],
const uint8_t key[SEEDBYTES],
const uint8_t tr[CRHBYTES],
const polyvecl *s1,
const polyveck *s2,
const polyveck *t0) {
@ -114,13 +114,13 @@ void PQCLEAN_DILITHIUM2_CLEAN_pack_sk(
* - uint8_t sk[]: byte array containing bit-packed sk
**************************************************/
void PQCLEAN_DILITHIUM2_CLEAN_unpack_sk(
uint8_t *rho,
uint8_t *key,
uint8_t *tr,
uint8_t rho[SEEDBYTES],
uint8_t key[SEEDBYTES],
uint8_t tr[CRHBYTES],
polyvecl *s1,
polyveck *s2,
polyveck *t0,
const uint8_t *sk) {
const uint8_t sk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_SECRETKEYBYTES]) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
rho[i] = sk[i];
}
@ -162,7 +162,7 @@ void PQCLEAN_DILITHIUM2_CLEAN_unpack_sk(
* - const poly *c: pointer to challenge polynomial
**************************************************/
void PQCLEAN_DILITHIUM2_CLEAN_pack_sig(
uint8_t *sig,
uint8_t sig[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_SECRETKEYBYTES],
const polyvecl *z,
const polyveck *h,
const poly *c) {
@ -228,7 +228,7 @@ int PQCLEAN_DILITHIUM2_CLEAN_unpack_sig(
polyvecl *z,
polyveck *h,
poly *c,
const uint8_t *sig) {
const uint8_t sig[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_BYTES]) {
size_t k;
uint64_t signs;

View File

@ -1,36 +1,42 @@
#ifndef PQCLEAN_DILITHIUM2_CLEAN_PACKING_H
#define PQCLEAN_DILITHIUM2_CLEAN_PACKING_H
#include "api.h"
#include "params.h"
#include "polyvec.h"
void PQCLEAN_DILITHIUM2_CLEAN_pack_pk(
uint8_t *pk,
const uint8_t *rho, const polyveck *t1);
uint8_t pk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_PUBLICKEYBYTES],
const uint8_t rho[SEEDBYTES],
const polyveck *t1);
void PQCLEAN_DILITHIUM2_CLEAN_pack_sk(
uint8_t *sk,
const uint8_t *rho,
const uint8_t *key,
const uint8_t *tr,
uint8_t sk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_SECRETKEYBYTES],
const uint8_t rho[SEEDBYTES],
const uint8_t key[SEEDBYTES],
const uint8_t tr[SEEDBYTES],
const polyvecl *s1,
const polyveck *s2,
const polyveck *t0);
void PQCLEAN_DILITHIUM2_CLEAN_pack_sig(
uint8_t *sig,
uint8_t sig[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_SECRETKEYBYTES],
const polyvecl *z, const polyveck *h, const poly *c);
void PQCLEAN_DILITHIUM2_CLEAN_unpack_pk(
uint8_t *rho, polyveck *t1,
const uint8_t *pk);
uint8_t rho[SEEDBYTES],
polyveck *t1,
const uint8_t pk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_PUBLICKEYBYTES]);
void PQCLEAN_DILITHIUM2_CLEAN_unpack_sk(
uint8_t *rho,
uint8_t *key,
uint8_t *tr,
uint8_t rho[SEEDBYTES],
uint8_t key[SEEDBYTES],
uint8_t tr[CRHBYTES],
polyvecl *s1,
polyveck *s2,
polyveck *t0,
const uint8_t *sk);
int PQCLEAN_DILITHIUM2_CLEAN_unpack_sig(
polyvecl *z, polyveck *h, poly *c, const uint8_t *sig);
polyvecl *z,
polyveck *h,
poly *c,
const uint8_t sig[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_BYTES]);
#endif

View File

@ -26,8 +26,4 @@
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
#define POLW1_SIZE_PACKED ((N*4)/8)
#define CRYPTO_PUBLICKEYBYTES (SEEDBYTES + K*POLT1_SIZE_PACKED)
#define CRYPTO_SECRETKEYBYTES (2*SEEDBYTES + (L + K)*POLETA_SIZE_PACKED + CRHBYTES + K*POLT0_SIZE_PACKED)
#define CRYPTO_BYTES (L*POLZ_SIZE_PACKED + (OMEGA + K) + (N/8 + 8))
#endif

View File

@ -4,6 +4,7 @@
#include <stddef.h>
#include <stdint.h>
#define PQCLEAN_DILITHIUM3_AVX2_CRYPTO_PUBLICKEYBYTES 1472U
#define PQCLEAN_DILITHIUM3_AVX2_CRYPTO_SECRETKEYBYTES 3504U
#define PQCLEAN_DILITHIUM3_AVX2_CRYPTO_BYTES 2701U

View File

@ -13,8 +13,8 @@
* - const polyveck *t1: pointer to vector t1
**************************************************/
void PQCLEAN_DILITHIUM3_AVX2_pack_pk(
uint8_t *pk,
const uint8_t *rho,
uint8_t pk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_PUBLICKEYBYTES],
const uint8_t rho[SEEDBYTES],
const polyveck *t1) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
pk[i] = rho[i];
@ -36,9 +36,9 @@ void PQCLEAN_DILITHIUM3_AVX2_pack_pk(
* - uint8_t pk[]: byte array containing bit-packed pk
**************************************************/
void PQCLEAN_DILITHIUM3_AVX2_unpack_pk(
uint8_t *rho,
uint8_t rho[SEEDBYTES],
polyveck *t1,
const uint8_t *pk) {
const uint8_t pk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_PUBLICKEYBYTES]) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
rho[i] = pk[i];
}
@ -63,10 +63,10 @@ void PQCLEAN_DILITHIUM3_AVX2_unpack_pk(
* - const polyveck *t0: pointer to vector t0
**************************************************/
void PQCLEAN_DILITHIUM3_AVX2_pack_sk(
uint8_t *sk,
const uint8_t *rho,
const uint8_t *key,
const uint8_t *tr,
uint8_t sk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_SECRETKEYBYTES],
const uint8_t rho[SEEDBYTES],
const uint8_t key[SEEDBYTES],
const uint8_t tr[CRHBYTES],
const polyvecl *s1,
const polyveck *s2,
const polyveck *t0) {
@ -114,13 +114,13 @@ void PQCLEAN_DILITHIUM3_AVX2_pack_sk(
* - uint8_t sk[]: byte array containing bit-packed sk
**************************************************/
void PQCLEAN_DILITHIUM3_AVX2_unpack_sk(
uint8_t *rho,
uint8_t *key,
uint8_t *tr,
uint8_t rho[SEEDBYTES],
uint8_t key[SEEDBYTES],
uint8_t tr[CRHBYTES],
polyvecl *s1,
polyveck *s2,
polyveck *t0,
const uint8_t *sk) {
const uint8_t sk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_SECRETKEYBYTES]) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
rho[i] = sk[i];
}
@ -162,7 +162,7 @@ void PQCLEAN_DILITHIUM3_AVX2_unpack_sk(
* - const poly *c: pointer to challenge polynomial
**************************************************/
void PQCLEAN_DILITHIUM3_AVX2_pack_sig(
uint8_t *sig,
uint8_t sig[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_SECRETKEYBYTES],
const polyvecl *z,
const polyveck *h,
const poly *c) {
@ -228,7 +228,7 @@ int PQCLEAN_DILITHIUM3_AVX2_unpack_sig(
polyvecl *z,
polyveck *h,
poly *c,
const uint8_t *sig) {
const uint8_t sig[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_BYTES]) {
size_t k;
uint64_t signs;

View File

@ -1,36 +1,42 @@
#ifndef PQCLEAN_DILITHIUM3_AVX2_PACKING_H
#define PQCLEAN_DILITHIUM3_AVX2_PACKING_H
#include "api.h"
#include "params.h"
#include "polyvec.h"
void PQCLEAN_DILITHIUM3_AVX2_pack_pk(
uint8_t *pk,
const uint8_t *rho, const polyveck *t1);
uint8_t pk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_PUBLICKEYBYTES],
const uint8_t rho[SEEDBYTES],
const polyveck *t1);
void PQCLEAN_DILITHIUM3_AVX2_pack_sk(
uint8_t *sk,
const uint8_t *rho,
const uint8_t *key,
const uint8_t *tr,
uint8_t sk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_SECRETKEYBYTES],
const uint8_t rho[SEEDBYTES],
const uint8_t key[SEEDBYTES],
const uint8_t tr[SEEDBYTES],
const polyvecl *s1,
const polyveck *s2,
const polyveck *t0);
void PQCLEAN_DILITHIUM3_AVX2_pack_sig(
uint8_t *sig,
uint8_t sig[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_SECRETKEYBYTES],
const polyvecl *z, const polyveck *h, const poly *c);
void PQCLEAN_DILITHIUM3_AVX2_unpack_pk(
uint8_t *rho, polyveck *t1,
const uint8_t *pk);
uint8_t rho[SEEDBYTES],
polyveck *t1,
const uint8_t pk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_PUBLICKEYBYTES]);
void PQCLEAN_DILITHIUM3_AVX2_unpack_sk(
uint8_t *rho,
uint8_t *key,
uint8_t *tr,
uint8_t rho[SEEDBYTES],
uint8_t key[SEEDBYTES],
uint8_t tr[CRHBYTES],
polyvecl *s1,
polyveck *s2,
polyveck *t0,
const uint8_t *sk);
int PQCLEAN_DILITHIUM3_AVX2_unpack_sig(
polyvecl *z, polyveck *h, poly *c, const uint8_t *sig);
polyvecl *z,
polyveck *h,
poly *c,
const uint8_t sig[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_BYTES]);
#endif

View File

@ -26,8 +26,4 @@
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
#define POLW1_SIZE_PACKED ((N*4)/8)
#define CRYPTO_PUBLICKEYBYTES (SEEDBYTES + K*POLT1_SIZE_PACKED)
#define CRYPTO_SECRETKEYBYTES (2*SEEDBYTES + (L + K)*POLETA_SIZE_PACKED + CRHBYTES + K*POLT0_SIZE_PACKED)
#define CRYPTO_BYTES (L*POLZ_SIZE_PACKED + (OMEGA + K) + (N/8 + 8))
#endif

View File

@ -4,6 +4,7 @@
#include <stddef.h>
#include <stdint.h>
#define PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_PUBLICKEYBYTES 1472U
#define PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_SECRETKEYBYTES 3504U
#define PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_BYTES 2701U

View File

@ -13,8 +13,8 @@
* - const polyveck *t1: pointer to vector t1
**************************************************/
void PQCLEAN_DILITHIUM3_CLEAN_pack_pk(
uint8_t *pk,
const uint8_t *rho,
uint8_t pk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_PUBLICKEYBYTES],
const uint8_t rho[SEEDBYTES],
const polyveck *t1) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
pk[i] = rho[i];
@ -36,9 +36,9 @@ void PQCLEAN_DILITHIUM3_CLEAN_pack_pk(
* - uint8_t pk[]: byte array containing bit-packed pk
**************************************************/
void PQCLEAN_DILITHIUM3_CLEAN_unpack_pk(
uint8_t *rho,
uint8_t rho[SEEDBYTES],
polyveck *t1,
const uint8_t *pk) {
const uint8_t pk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_PUBLICKEYBYTES]) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
rho[i] = pk[i];
}
@ -63,10 +63,10 @@ void PQCLEAN_DILITHIUM3_CLEAN_unpack_pk(
* - const polyveck *t0: pointer to vector t0
**************************************************/
void PQCLEAN_DILITHIUM3_CLEAN_pack_sk(
uint8_t *sk,
const uint8_t *rho,
const uint8_t *key,
const uint8_t *tr,
uint8_t sk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_SECRETKEYBYTES],
const uint8_t rho[SEEDBYTES],
const uint8_t key[SEEDBYTES],
const uint8_t tr[CRHBYTES],
const polyvecl *s1,
const polyveck *s2,
const polyveck *t0) {
@ -114,13 +114,13 @@ void PQCLEAN_DILITHIUM3_CLEAN_pack_sk(
* - uint8_t sk[]: byte array containing bit-packed sk
**************************************************/
void PQCLEAN_DILITHIUM3_CLEAN_unpack_sk(
uint8_t *rho,
uint8_t *key,
uint8_t *tr,
uint8_t rho[SEEDBYTES],
uint8_t key[SEEDBYTES],
uint8_t tr[CRHBYTES],
polyvecl *s1,
polyveck *s2,
polyveck *t0,
const uint8_t *sk) {
const uint8_t sk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_SECRETKEYBYTES]) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
rho[i] = sk[i];
}
@ -162,7 +162,7 @@ void PQCLEAN_DILITHIUM3_CLEAN_unpack_sk(
* - const poly *c: pointer to challenge polynomial
**************************************************/
void PQCLEAN_DILITHIUM3_CLEAN_pack_sig(
uint8_t *sig,
uint8_t sig[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_SECRETKEYBYTES],
const polyvecl *z,
const polyveck *h,
const poly *c) {
@ -228,7 +228,7 @@ int PQCLEAN_DILITHIUM3_CLEAN_unpack_sig(
polyvecl *z,
polyveck *h,
poly *c,
const uint8_t *sig) {
const uint8_t sig[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_BYTES]) {
size_t k;
uint64_t signs;

View File

@ -1,36 +1,42 @@
#ifndef PQCLEAN_DILITHIUM3_CLEAN_PACKING_H
#define PQCLEAN_DILITHIUM3_CLEAN_PACKING_H
#include "api.h"
#include "params.h"
#include "polyvec.h"
void PQCLEAN_DILITHIUM3_CLEAN_pack_pk(
uint8_t *pk,
const uint8_t *rho, const polyveck *t1);
uint8_t pk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_PUBLICKEYBYTES],
const uint8_t rho[SEEDBYTES],
const polyveck *t1);
void PQCLEAN_DILITHIUM3_CLEAN_pack_sk(
uint8_t *sk,
const uint8_t *rho,
const uint8_t *key,
const uint8_t *tr,
uint8_t sk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_SECRETKEYBYTES],
const uint8_t rho[SEEDBYTES],
const uint8_t key[SEEDBYTES],
const uint8_t tr[SEEDBYTES],
const polyvecl *s1,
const polyveck *s2,
const polyveck *t0);
void PQCLEAN_DILITHIUM3_CLEAN_pack_sig(
uint8_t *sig,
uint8_t sig[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_SECRETKEYBYTES],
const polyvecl *z, const polyveck *h, const poly *c);
void PQCLEAN_DILITHIUM3_CLEAN_unpack_pk(
uint8_t *rho, polyveck *t1,
const uint8_t *pk);
uint8_t rho[SEEDBYTES],
polyveck *t1,
const uint8_t pk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_PUBLICKEYBYTES]);
void PQCLEAN_DILITHIUM3_CLEAN_unpack_sk(
uint8_t *rho,
uint8_t *key,
uint8_t *tr,
uint8_t rho[SEEDBYTES],
uint8_t key[SEEDBYTES],
uint8_t tr[CRHBYTES],
polyvecl *s1,
polyveck *s2,
polyveck *t0,
const uint8_t *sk);
int PQCLEAN_DILITHIUM3_CLEAN_unpack_sig(
polyvecl *z, polyveck *h, poly *c, const uint8_t *sig);
polyvecl *z,
polyveck *h,
poly *c,
const uint8_t sig[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_BYTES]);
#endif

View File

@ -26,8 +26,4 @@
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
#define POLW1_SIZE_PACKED ((N*4)/8)
#define CRYPTO_PUBLICKEYBYTES (SEEDBYTES + K*POLT1_SIZE_PACKED)
#define CRYPTO_SECRETKEYBYTES (2*SEEDBYTES + (L + K)*POLETA_SIZE_PACKED + CRHBYTES + K*POLT0_SIZE_PACKED)
#define CRYPTO_BYTES (L*POLZ_SIZE_PACKED + (OMEGA + K) + (N/8 + 8))
#endif

View File

@ -4,6 +4,7 @@
#include <stddef.h>
#include <stdint.h>
#define PQCLEAN_DILITHIUM4_AVX2_CRYPTO_PUBLICKEYBYTES 1760U
#define PQCLEAN_DILITHIUM4_AVX2_CRYPTO_SECRETKEYBYTES 3856U
#define PQCLEAN_DILITHIUM4_AVX2_CRYPTO_BYTES 3366U

View File

@ -13,8 +13,8 @@
* - const polyveck *t1: pointer to vector t1
**************************************************/
void PQCLEAN_DILITHIUM4_AVX2_pack_pk(
uint8_t *pk,
const uint8_t *rho,
uint8_t pk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_PUBLICKEYBYTES],
const uint8_t rho[SEEDBYTES],
const polyveck *t1) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
pk[i] = rho[i];
@ -36,9 +36,9 @@ void PQCLEAN_DILITHIUM4_AVX2_pack_pk(
* - uint8_t pk[]: byte array containing bit-packed pk
**************************************************/
void PQCLEAN_DILITHIUM4_AVX2_unpack_pk(
uint8_t *rho,
uint8_t rho[SEEDBYTES],
polyveck *t1,
const uint8_t *pk) {
const uint8_t pk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_PUBLICKEYBYTES]) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
rho[i] = pk[i];
}
@ -63,10 +63,10 @@ void PQCLEAN_DILITHIUM4_AVX2_unpack_pk(
* - const polyveck *t0: pointer to vector t0
**************************************************/
void PQCLEAN_DILITHIUM4_AVX2_pack_sk(
uint8_t *sk,
const uint8_t *rho,
const uint8_t *key,
const uint8_t *tr,
uint8_t sk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_SECRETKEYBYTES],
const uint8_t rho[SEEDBYTES],
const uint8_t key[SEEDBYTES],
const uint8_t tr[CRHBYTES],
const polyvecl *s1,
const polyveck *s2,
const polyveck *t0) {
@ -114,13 +114,13 @@ void PQCLEAN_DILITHIUM4_AVX2_pack_sk(
* - uint8_t sk[]: byte array containing bit-packed sk
**************************************************/
void PQCLEAN_DILITHIUM4_AVX2_unpack_sk(
uint8_t *rho,
uint8_t *key,
uint8_t *tr,
uint8_t rho[SEEDBYTES],
uint8_t key[SEEDBYTES],
uint8_t tr[CRHBYTES],
polyvecl *s1,
polyveck *s2,
polyveck *t0,
const uint8_t *sk) {
const uint8_t sk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_SECRETKEYBYTES]) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
rho[i] = sk[i];
}
@ -162,7 +162,7 @@ void PQCLEAN_DILITHIUM4_AVX2_unpack_sk(
* - const poly *c: pointer to challenge polynomial
**************************************************/
void PQCLEAN_DILITHIUM4_AVX2_pack_sig(
uint8_t *sig,
uint8_t sig[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_SECRETKEYBYTES],
const polyvecl *z,
const polyveck *h,
const poly *c) {
@ -228,7 +228,7 @@ int PQCLEAN_DILITHIUM4_AVX2_unpack_sig(
polyvecl *z,
polyveck *h,
poly *c,
const uint8_t *sig) {
const uint8_t sig[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_BYTES]) {
size_t k;
uint64_t signs;

View File

@ -1,36 +1,42 @@
#ifndef PQCLEAN_DILITHIUM4_AVX2_PACKING_H
#define PQCLEAN_DILITHIUM4_AVX2_PACKING_H
#include "api.h"
#include "params.h"
#include "polyvec.h"
void PQCLEAN_DILITHIUM4_AVX2_pack_pk(
uint8_t *pk,
const uint8_t *rho, const polyveck *t1);
uint8_t pk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_PUBLICKEYBYTES],
const uint8_t rho[SEEDBYTES],
const polyveck *t1);
void PQCLEAN_DILITHIUM4_AVX2_pack_sk(
uint8_t *sk,
const uint8_t *rho,
const uint8_t *key,
const uint8_t *tr,
uint8_t sk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_SECRETKEYBYTES],
const uint8_t rho[SEEDBYTES],
const uint8_t key[SEEDBYTES],
const uint8_t tr[SEEDBYTES],
const polyvecl *s1,
const polyveck *s2,
const polyveck *t0);
void PQCLEAN_DILITHIUM4_AVX2_pack_sig(
uint8_t *sig,
uint8_t sig[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_SECRETKEYBYTES],
const polyvecl *z, const polyveck *h, const poly *c);
void PQCLEAN_DILITHIUM4_AVX2_unpack_pk(
uint8_t *rho, polyveck *t1,
const uint8_t *pk);
uint8_t rho[SEEDBYTES],
polyveck *t1,
const uint8_t pk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_PUBLICKEYBYTES]);
void PQCLEAN_DILITHIUM4_AVX2_unpack_sk(
uint8_t *rho,
uint8_t *key,
uint8_t *tr,
uint8_t rho[SEEDBYTES],
uint8_t key[SEEDBYTES],
uint8_t tr[CRHBYTES],
polyvecl *s1,
polyveck *s2,
polyveck *t0,
const uint8_t *sk);
int PQCLEAN_DILITHIUM4_AVX2_unpack_sig(
polyvecl *z, polyveck *h, poly *c, const uint8_t *sig);
polyvecl *z,
polyveck *h,
poly *c,
const uint8_t sig[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_BYTES]);
#endif

View File

@ -26,8 +26,4 @@
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
#define POLW1_SIZE_PACKED ((N*4)/8)
#define CRYPTO_PUBLICKEYBYTES (SEEDBYTES + K*POLT1_SIZE_PACKED)
#define CRYPTO_SECRETKEYBYTES (2*SEEDBYTES + (L + K)*POLETA_SIZE_PACKED + CRHBYTES + K*POLT0_SIZE_PACKED)
#define CRYPTO_BYTES (L*POLZ_SIZE_PACKED + (OMEGA + K) + (N/8 + 8))
#endif

View File

@ -4,6 +4,7 @@
#include <stddef.h>
#include <stdint.h>
#define PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_PUBLICKEYBYTES 1760U
#define PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_SECRETKEYBYTES 3856U
#define PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_BYTES 3366U

View File

@ -13,8 +13,8 @@
* - const polyveck *t1: pointer to vector t1
**************************************************/
void PQCLEAN_DILITHIUM4_CLEAN_pack_pk(
uint8_t *pk,
const uint8_t *rho,
uint8_t pk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_PUBLICKEYBYTES],
const uint8_t rho[SEEDBYTES],
const polyveck *t1) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
pk[i] = rho[i];
@ -36,9 +36,9 @@ void PQCLEAN_DILITHIUM4_CLEAN_pack_pk(
* - uint8_t pk[]: byte array containing bit-packed pk
**************************************************/
void PQCLEAN_DILITHIUM4_CLEAN_unpack_pk(
uint8_t *rho,
uint8_t rho[SEEDBYTES],
polyveck *t1,
const uint8_t *pk) {
const uint8_t pk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_PUBLICKEYBYTES]) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
rho[i] = pk[i];
}
@ -63,10 +63,10 @@ void PQCLEAN_DILITHIUM4_CLEAN_unpack_pk(
* - const polyveck *t0: pointer to vector t0
**************************************************/
void PQCLEAN_DILITHIUM4_CLEAN_pack_sk(
uint8_t *sk,
const uint8_t *rho,
const uint8_t *key,
const uint8_t *tr,
uint8_t sk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_SECRETKEYBYTES],
const uint8_t rho[SEEDBYTES],
const uint8_t key[SEEDBYTES],
const uint8_t tr[CRHBYTES],
const polyvecl *s1,
const polyveck *s2,
const polyveck *t0) {
@ -114,13 +114,13 @@ void PQCLEAN_DILITHIUM4_CLEAN_pack_sk(
* - uint8_t sk[]: byte array containing bit-packed sk
**************************************************/
void PQCLEAN_DILITHIUM4_CLEAN_unpack_sk(
uint8_t *rho,
uint8_t *key,
uint8_t *tr,
uint8_t rho[SEEDBYTES],
uint8_t key[SEEDBYTES],
uint8_t tr[CRHBYTES],
polyvecl *s1,
polyveck *s2,
polyveck *t0,
const uint8_t *sk) {
const uint8_t sk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_SECRETKEYBYTES]) {
for (size_t i = 0; i < SEEDBYTES; ++i) {
rho[i] = sk[i];
}
@ -162,7 +162,7 @@ void PQCLEAN_DILITHIUM4_CLEAN_unpack_sk(
* - const poly *c: pointer to challenge polynomial
**************************************************/
void PQCLEAN_DILITHIUM4_CLEAN_pack_sig(
uint8_t *sig,
uint8_t sig[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_SECRETKEYBYTES],
const polyvecl *z,
const polyveck *h,
const poly *c) {
@ -228,7 +228,7 @@ int PQCLEAN_DILITHIUM4_CLEAN_unpack_sig(
polyvecl *z,
polyveck *h,
poly *c,
const uint8_t *sig) {
const uint8_t sig[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_BYTES]) {
size_t k;
uint64_t signs;

View File

@ -1,36 +1,42 @@
#ifndef PQCLEAN_DILITHIUM4_CLEAN_PACKING_H
#define PQCLEAN_DILITHIUM4_CLEAN_PACKING_H
#include "api.h"
#include "params.h"
#include "polyvec.h"
void PQCLEAN_DILITHIUM4_CLEAN_pack_pk(
uint8_t *pk,
const uint8_t *rho, const polyveck *t1);
uint8_t pk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_PUBLICKEYBYTES],
const uint8_t rho[SEEDBYTES],
const polyveck *t1);
void PQCLEAN_DILITHIUM4_CLEAN_pack_sk(
uint8_t *sk,
const uint8_t *rho,
const uint8_t *key,
const uint8_t *tr,
uint8_t sk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_SECRETKEYBYTES],
const uint8_t rho[SEEDBYTES],
const uint8_t key[SEEDBYTES],
const uint8_t tr[SEEDBYTES],
const polyvecl *s1,
const polyveck *s2,
const polyveck *t0);
void PQCLEAN_DILITHIUM4_CLEAN_pack_sig(
uint8_t *sig,
uint8_t sig[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_SECRETKEYBYTES],
const polyvecl *z, const polyveck *h, const poly *c);
void PQCLEAN_DILITHIUM4_CLEAN_unpack_pk(
uint8_t *rho, polyveck *t1,
const uint8_t *pk);
uint8_t rho[SEEDBYTES],
polyveck *t1,
const uint8_t pk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_PUBLICKEYBYTES]);
void PQCLEAN_DILITHIUM4_CLEAN_unpack_sk(
uint8_t *rho,
uint8_t *key,
uint8_t *tr,
uint8_t rho[SEEDBYTES],
uint8_t key[SEEDBYTES],
uint8_t tr[CRHBYTES],
polyvecl *s1,
polyveck *s2,
polyveck *t0,
const uint8_t *sk);
int PQCLEAN_DILITHIUM4_CLEAN_unpack_sig(
polyvecl *z, polyveck *h, poly *c, const uint8_t *sig);
polyvecl *z,
polyveck *h,
poly *c,
const uint8_t sig[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_BYTES]);
#endif

View File

@ -26,8 +26,4 @@
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
#define POLW1_SIZE_PACKED ((N*4)/8)
#define CRYPTO_PUBLICKEYBYTES (SEEDBYTES + K*POLT1_SIZE_PACKED)
#define CRYPTO_SECRETKEYBYTES (2*SEEDBYTES + (L + K)*POLETA_SIZE_PACKED + CRHBYTES + K*POLT0_SIZE_PACKED)
#define CRYPTO_BYTES (L*POLZ_SIZE_PACKED + (OMEGA + K) + (N/8 + 8))
#endif