mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-22 23:48:58 +00:00
Specify arrays with sizes again
This commit is contained in:
parent
2b9759912d
commit
7dc03bfc44
@ -4,6 +4,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
#define PQCLEAN_DILITHIUM2_AVX2_CRYPTO_PUBLICKEYBYTES 1184U
|
#define PQCLEAN_DILITHIUM2_AVX2_CRYPTO_PUBLICKEYBYTES 1184U
|
||||||
#define PQCLEAN_DILITHIUM2_AVX2_CRYPTO_SECRETKEYBYTES 2800U
|
#define PQCLEAN_DILITHIUM2_AVX2_CRYPTO_SECRETKEYBYTES 2800U
|
||||||
#define PQCLEAN_DILITHIUM2_AVX2_CRYPTO_BYTES 2044U
|
#define PQCLEAN_DILITHIUM2_AVX2_CRYPTO_BYTES 2044U
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
* - const polyveck *t1: pointer to vector t1
|
* - const polyveck *t1: pointer to vector t1
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM2_AVX2_pack_pk(
|
void PQCLEAN_DILITHIUM2_AVX2_pack_pk(
|
||||||
uint8_t *pk,
|
uint8_t pk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_PUBLICKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const polyveck *t1) {
|
const polyveck *t1) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
pk[i] = rho[i];
|
pk[i] = rho[i];
|
||||||
@ -36,9 +36,9 @@ void PQCLEAN_DILITHIUM2_AVX2_pack_pk(
|
|||||||
* - uint8_t pk[]: byte array containing bit-packed pk
|
* - uint8_t pk[]: byte array containing bit-packed pk
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM2_AVX2_unpack_pk(
|
void PQCLEAN_DILITHIUM2_AVX2_unpack_pk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
polyveck *t1,
|
polyveck *t1,
|
||||||
const uint8_t *pk) {
|
const uint8_t pk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_PUBLICKEYBYTES]) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
rho[i] = pk[i];
|
rho[i] = pk[i];
|
||||||
}
|
}
|
||||||
@ -63,10 +63,10 @@ void PQCLEAN_DILITHIUM2_AVX2_unpack_pk(
|
|||||||
* - const polyveck *t0: pointer to vector t0
|
* - const polyveck *t0: pointer to vector t0
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM2_AVX2_pack_sk(
|
void PQCLEAN_DILITHIUM2_AVX2_pack_sk(
|
||||||
uint8_t *sk,
|
uint8_t sk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_SECRETKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *key,
|
const uint8_t key[SEEDBYTES],
|
||||||
const uint8_t *tr,
|
const uint8_t tr[CRHBYTES],
|
||||||
const polyvecl *s1,
|
const polyvecl *s1,
|
||||||
const polyveck *s2,
|
const polyveck *s2,
|
||||||
const polyveck *t0) {
|
const polyveck *t0) {
|
||||||
@ -114,13 +114,13 @@ void PQCLEAN_DILITHIUM2_AVX2_pack_sk(
|
|||||||
* - uint8_t sk[]: byte array containing bit-packed sk
|
* - uint8_t sk[]: byte array containing bit-packed sk
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM2_AVX2_unpack_sk(
|
void PQCLEAN_DILITHIUM2_AVX2_unpack_sk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
uint8_t *key,
|
uint8_t key[SEEDBYTES],
|
||||||
uint8_t *tr,
|
uint8_t tr[CRHBYTES],
|
||||||
polyvecl *s1,
|
polyvecl *s1,
|
||||||
polyveck *s2,
|
polyveck *s2,
|
||||||
polyveck *t0,
|
polyveck *t0,
|
||||||
const uint8_t *sk) {
|
const uint8_t sk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_SECRETKEYBYTES]) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
rho[i] = sk[i];
|
rho[i] = sk[i];
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ void PQCLEAN_DILITHIUM2_AVX2_unpack_sk(
|
|||||||
* - const poly *c: pointer to challenge polynomial
|
* - const poly *c: pointer to challenge polynomial
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM2_AVX2_pack_sig(
|
void PQCLEAN_DILITHIUM2_AVX2_pack_sig(
|
||||||
uint8_t *sig,
|
uint8_t sig[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_SECRETKEYBYTES],
|
||||||
const polyvecl *z,
|
const polyvecl *z,
|
||||||
const polyveck *h,
|
const polyveck *h,
|
||||||
const poly *c) {
|
const poly *c) {
|
||||||
@ -228,7 +228,7 @@ int PQCLEAN_DILITHIUM2_AVX2_unpack_sig(
|
|||||||
polyvecl *z,
|
polyvecl *z,
|
||||||
polyveck *h,
|
polyveck *h,
|
||||||
poly *c,
|
poly *c,
|
||||||
const uint8_t *sig) {
|
const uint8_t sig[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_BYTES]) {
|
||||||
size_t k;
|
size_t k;
|
||||||
uint64_t signs;
|
uint64_t signs;
|
||||||
|
|
||||||
|
@ -1,36 +1,42 @@
|
|||||||
#ifndef PQCLEAN_DILITHIUM2_AVX2_PACKING_H
|
#ifndef PQCLEAN_DILITHIUM2_AVX2_PACKING_H
|
||||||
#define PQCLEAN_DILITHIUM2_AVX2_PACKING_H
|
#define PQCLEAN_DILITHIUM2_AVX2_PACKING_H
|
||||||
|
|
||||||
|
#include "api.h"
|
||||||
#include "params.h"
|
#include "params.h"
|
||||||
#include "polyvec.h"
|
#include "polyvec.h"
|
||||||
|
|
||||||
void PQCLEAN_DILITHIUM2_AVX2_pack_pk(
|
void PQCLEAN_DILITHIUM2_AVX2_pack_pk(
|
||||||
uint8_t *pk,
|
uint8_t pk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_PUBLICKEYBYTES],
|
||||||
const uint8_t *rho, const polyveck *t1);
|
const uint8_t rho[SEEDBYTES],
|
||||||
|
const polyveck *t1);
|
||||||
void PQCLEAN_DILITHIUM2_AVX2_pack_sk(
|
void PQCLEAN_DILITHIUM2_AVX2_pack_sk(
|
||||||
uint8_t *sk,
|
uint8_t sk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_SECRETKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *key,
|
const uint8_t key[SEEDBYTES],
|
||||||
const uint8_t *tr,
|
const uint8_t tr[SEEDBYTES],
|
||||||
const polyvecl *s1,
|
const polyvecl *s1,
|
||||||
const polyveck *s2,
|
const polyveck *s2,
|
||||||
const polyveck *t0);
|
const polyveck *t0);
|
||||||
void PQCLEAN_DILITHIUM2_AVX2_pack_sig(
|
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);
|
const polyvecl *z, const polyveck *h, const poly *c);
|
||||||
|
|
||||||
void PQCLEAN_DILITHIUM2_AVX2_unpack_pk(
|
void PQCLEAN_DILITHIUM2_AVX2_unpack_pk(
|
||||||
uint8_t *rho, polyveck *t1,
|
uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *pk);
|
polyveck *t1,
|
||||||
|
const uint8_t pk[PQCLEAN_DILITHIUM2_AVX2_CRYPTO_PUBLICKEYBYTES]);
|
||||||
void PQCLEAN_DILITHIUM2_AVX2_unpack_sk(
|
void PQCLEAN_DILITHIUM2_AVX2_unpack_sk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
uint8_t *key,
|
uint8_t key[SEEDBYTES],
|
||||||
uint8_t *tr,
|
uint8_t tr[CRHBYTES],
|
||||||
polyvecl *s1,
|
polyvecl *s1,
|
||||||
polyveck *s2,
|
polyveck *s2,
|
||||||
polyveck *t0,
|
polyveck *t0,
|
||||||
const uint8_t *sk);
|
const uint8_t *sk);
|
||||||
int PQCLEAN_DILITHIUM2_AVX2_unpack_sig(
|
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
|
#endif
|
||||||
|
@ -26,8 +26,4 @@
|
|||||||
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
|
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
|
||||||
#define POLW1_SIZE_PACKED ((N*4)/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
|
#endif
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
#define PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_PUBLICKEYBYTES 1184U
|
#define PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_PUBLICKEYBYTES 1184U
|
||||||
#define PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_SECRETKEYBYTES 2800U
|
#define PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_SECRETKEYBYTES 2800U
|
||||||
#define PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_BYTES 2044U
|
#define PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_BYTES 2044U
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
* - const polyveck *t1: pointer to vector t1
|
* - const polyveck *t1: pointer to vector t1
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM2_CLEAN_pack_pk(
|
void PQCLEAN_DILITHIUM2_CLEAN_pack_pk(
|
||||||
uint8_t *pk,
|
uint8_t pk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_PUBLICKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const polyveck *t1) {
|
const polyveck *t1) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
pk[i] = rho[i];
|
pk[i] = rho[i];
|
||||||
@ -36,9 +36,9 @@ void PQCLEAN_DILITHIUM2_CLEAN_pack_pk(
|
|||||||
* - uint8_t pk[]: byte array containing bit-packed pk
|
* - uint8_t pk[]: byte array containing bit-packed pk
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM2_CLEAN_unpack_pk(
|
void PQCLEAN_DILITHIUM2_CLEAN_unpack_pk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
polyveck *t1,
|
polyveck *t1,
|
||||||
const uint8_t *pk) {
|
const uint8_t pk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_PUBLICKEYBYTES]) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
rho[i] = pk[i];
|
rho[i] = pk[i];
|
||||||
}
|
}
|
||||||
@ -63,10 +63,10 @@ void PQCLEAN_DILITHIUM2_CLEAN_unpack_pk(
|
|||||||
* - const polyveck *t0: pointer to vector t0
|
* - const polyveck *t0: pointer to vector t0
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM2_CLEAN_pack_sk(
|
void PQCLEAN_DILITHIUM2_CLEAN_pack_sk(
|
||||||
uint8_t *sk,
|
uint8_t sk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_SECRETKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *key,
|
const uint8_t key[SEEDBYTES],
|
||||||
const uint8_t *tr,
|
const uint8_t tr[CRHBYTES],
|
||||||
const polyvecl *s1,
|
const polyvecl *s1,
|
||||||
const polyveck *s2,
|
const polyveck *s2,
|
||||||
const polyveck *t0) {
|
const polyveck *t0) {
|
||||||
@ -114,13 +114,13 @@ void PQCLEAN_DILITHIUM2_CLEAN_pack_sk(
|
|||||||
* - uint8_t sk[]: byte array containing bit-packed sk
|
* - uint8_t sk[]: byte array containing bit-packed sk
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM2_CLEAN_unpack_sk(
|
void PQCLEAN_DILITHIUM2_CLEAN_unpack_sk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
uint8_t *key,
|
uint8_t key[SEEDBYTES],
|
||||||
uint8_t *tr,
|
uint8_t tr[CRHBYTES],
|
||||||
polyvecl *s1,
|
polyvecl *s1,
|
||||||
polyveck *s2,
|
polyveck *s2,
|
||||||
polyveck *t0,
|
polyveck *t0,
|
||||||
const uint8_t *sk) {
|
const uint8_t sk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_SECRETKEYBYTES]) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
rho[i] = sk[i];
|
rho[i] = sk[i];
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ void PQCLEAN_DILITHIUM2_CLEAN_unpack_sk(
|
|||||||
* - const poly *c: pointer to challenge polynomial
|
* - const poly *c: pointer to challenge polynomial
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM2_CLEAN_pack_sig(
|
void PQCLEAN_DILITHIUM2_CLEAN_pack_sig(
|
||||||
uint8_t *sig,
|
uint8_t sig[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_SECRETKEYBYTES],
|
||||||
const polyvecl *z,
|
const polyvecl *z,
|
||||||
const polyveck *h,
|
const polyveck *h,
|
||||||
const poly *c) {
|
const poly *c) {
|
||||||
@ -228,7 +228,7 @@ int PQCLEAN_DILITHIUM2_CLEAN_unpack_sig(
|
|||||||
polyvecl *z,
|
polyvecl *z,
|
||||||
polyveck *h,
|
polyveck *h,
|
||||||
poly *c,
|
poly *c,
|
||||||
const uint8_t *sig) {
|
const uint8_t sig[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_BYTES]) {
|
||||||
size_t k;
|
size_t k;
|
||||||
uint64_t signs;
|
uint64_t signs;
|
||||||
|
|
||||||
|
@ -1,36 +1,42 @@
|
|||||||
#ifndef PQCLEAN_DILITHIUM2_CLEAN_PACKING_H
|
#ifndef PQCLEAN_DILITHIUM2_CLEAN_PACKING_H
|
||||||
#define PQCLEAN_DILITHIUM2_CLEAN_PACKING_H
|
#define PQCLEAN_DILITHIUM2_CLEAN_PACKING_H
|
||||||
|
|
||||||
|
#include "api.h"
|
||||||
#include "params.h"
|
#include "params.h"
|
||||||
#include "polyvec.h"
|
#include "polyvec.h"
|
||||||
|
|
||||||
void PQCLEAN_DILITHIUM2_CLEAN_pack_pk(
|
void PQCLEAN_DILITHIUM2_CLEAN_pack_pk(
|
||||||
uint8_t *pk,
|
uint8_t pk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_PUBLICKEYBYTES],
|
||||||
const uint8_t *rho, const polyveck *t1);
|
const uint8_t rho[SEEDBYTES],
|
||||||
|
const polyveck *t1);
|
||||||
void PQCLEAN_DILITHIUM2_CLEAN_pack_sk(
|
void PQCLEAN_DILITHIUM2_CLEAN_pack_sk(
|
||||||
uint8_t *sk,
|
uint8_t sk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_SECRETKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *key,
|
const uint8_t key[SEEDBYTES],
|
||||||
const uint8_t *tr,
|
const uint8_t tr[SEEDBYTES],
|
||||||
const polyvecl *s1,
|
const polyvecl *s1,
|
||||||
const polyveck *s2,
|
const polyveck *s2,
|
||||||
const polyveck *t0);
|
const polyveck *t0);
|
||||||
void PQCLEAN_DILITHIUM2_CLEAN_pack_sig(
|
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);
|
const polyvecl *z, const polyveck *h, const poly *c);
|
||||||
|
|
||||||
void PQCLEAN_DILITHIUM2_CLEAN_unpack_pk(
|
void PQCLEAN_DILITHIUM2_CLEAN_unpack_pk(
|
||||||
uint8_t *rho, polyveck *t1,
|
uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *pk);
|
polyveck *t1,
|
||||||
|
const uint8_t pk[PQCLEAN_DILITHIUM2_CLEAN_CRYPTO_PUBLICKEYBYTES]);
|
||||||
void PQCLEAN_DILITHIUM2_CLEAN_unpack_sk(
|
void PQCLEAN_DILITHIUM2_CLEAN_unpack_sk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
uint8_t *key,
|
uint8_t key[SEEDBYTES],
|
||||||
uint8_t *tr,
|
uint8_t tr[CRHBYTES],
|
||||||
polyvecl *s1,
|
polyvecl *s1,
|
||||||
polyveck *s2,
|
polyveck *s2,
|
||||||
polyveck *t0,
|
polyveck *t0,
|
||||||
const uint8_t *sk);
|
const uint8_t *sk);
|
||||||
int PQCLEAN_DILITHIUM2_CLEAN_unpack_sig(
|
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
|
#endif
|
||||||
|
@ -26,8 +26,4 @@
|
|||||||
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
|
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
|
||||||
#define POLW1_SIZE_PACKED ((N*4)/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
|
#endif
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
#define PQCLEAN_DILITHIUM3_AVX2_CRYPTO_PUBLICKEYBYTES 1472U
|
#define PQCLEAN_DILITHIUM3_AVX2_CRYPTO_PUBLICKEYBYTES 1472U
|
||||||
#define PQCLEAN_DILITHIUM3_AVX2_CRYPTO_SECRETKEYBYTES 3504U
|
#define PQCLEAN_DILITHIUM3_AVX2_CRYPTO_SECRETKEYBYTES 3504U
|
||||||
#define PQCLEAN_DILITHIUM3_AVX2_CRYPTO_BYTES 2701U
|
#define PQCLEAN_DILITHIUM3_AVX2_CRYPTO_BYTES 2701U
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
* - const polyveck *t1: pointer to vector t1
|
* - const polyveck *t1: pointer to vector t1
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM3_AVX2_pack_pk(
|
void PQCLEAN_DILITHIUM3_AVX2_pack_pk(
|
||||||
uint8_t *pk,
|
uint8_t pk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_PUBLICKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const polyveck *t1) {
|
const polyveck *t1) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
pk[i] = rho[i];
|
pk[i] = rho[i];
|
||||||
@ -36,9 +36,9 @@ void PQCLEAN_DILITHIUM3_AVX2_pack_pk(
|
|||||||
* - uint8_t pk[]: byte array containing bit-packed pk
|
* - uint8_t pk[]: byte array containing bit-packed pk
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM3_AVX2_unpack_pk(
|
void PQCLEAN_DILITHIUM3_AVX2_unpack_pk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
polyveck *t1,
|
polyveck *t1,
|
||||||
const uint8_t *pk) {
|
const uint8_t pk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_PUBLICKEYBYTES]) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
rho[i] = pk[i];
|
rho[i] = pk[i];
|
||||||
}
|
}
|
||||||
@ -63,10 +63,10 @@ void PQCLEAN_DILITHIUM3_AVX2_unpack_pk(
|
|||||||
* - const polyveck *t0: pointer to vector t0
|
* - const polyveck *t0: pointer to vector t0
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM3_AVX2_pack_sk(
|
void PQCLEAN_DILITHIUM3_AVX2_pack_sk(
|
||||||
uint8_t *sk,
|
uint8_t sk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_SECRETKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *key,
|
const uint8_t key[SEEDBYTES],
|
||||||
const uint8_t *tr,
|
const uint8_t tr[CRHBYTES],
|
||||||
const polyvecl *s1,
|
const polyvecl *s1,
|
||||||
const polyveck *s2,
|
const polyveck *s2,
|
||||||
const polyveck *t0) {
|
const polyveck *t0) {
|
||||||
@ -114,13 +114,13 @@ void PQCLEAN_DILITHIUM3_AVX2_pack_sk(
|
|||||||
* - uint8_t sk[]: byte array containing bit-packed sk
|
* - uint8_t sk[]: byte array containing bit-packed sk
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM3_AVX2_unpack_sk(
|
void PQCLEAN_DILITHIUM3_AVX2_unpack_sk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
uint8_t *key,
|
uint8_t key[SEEDBYTES],
|
||||||
uint8_t *tr,
|
uint8_t tr[CRHBYTES],
|
||||||
polyvecl *s1,
|
polyvecl *s1,
|
||||||
polyveck *s2,
|
polyveck *s2,
|
||||||
polyveck *t0,
|
polyveck *t0,
|
||||||
const uint8_t *sk) {
|
const uint8_t sk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_SECRETKEYBYTES]) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
rho[i] = sk[i];
|
rho[i] = sk[i];
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ void PQCLEAN_DILITHIUM3_AVX2_unpack_sk(
|
|||||||
* - const poly *c: pointer to challenge polynomial
|
* - const poly *c: pointer to challenge polynomial
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM3_AVX2_pack_sig(
|
void PQCLEAN_DILITHIUM3_AVX2_pack_sig(
|
||||||
uint8_t *sig,
|
uint8_t sig[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_SECRETKEYBYTES],
|
||||||
const polyvecl *z,
|
const polyvecl *z,
|
||||||
const polyveck *h,
|
const polyveck *h,
|
||||||
const poly *c) {
|
const poly *c) {
|
||||||
@ -228,7 +228,7 @@ int PQCLEAN_DILITHIUM3_AVX2_unpack_sig(
|
|||||||
polyvecl *z,
|
polyvecl *z,
|
||||||
polyveck *h,
|
polyveck *h,
|
||||||
poly *c,
|
poly *c,
|
||||||
const uint8_t *sig) {
|
const uint8_t sig[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_BYTES]) {
|
||||||
size_t k;
|
size_t k;
|
||||||
uint64_t signs;
|
uint64_t signs;
|
||||||
|
|
||||||
|
@ -1,36 +1,42 @@
|
|||||||
#ifndef PQCLEAN_DILITHIUM3_AVX2_PACKING_H
|
#ifndef PQCLEAN_DILITHIUM3_AVX2_PACKING_H
|
||||||
#define PQCLEAN_DILITHIUM3_AVX2_PACKING_H
|
#define PQCLEAN_DILITHIUM3_AVX2_PACKING_H
|
||||||
|
|
||||||
|
#include "api.h"
|
||||||
#include "params.h"
|
#include "params.h"
|
||||||
#include "polyvec.h"
|
#include "polyvec.h"
|
||||||
|
|
||||||
void PQCLEAN_DILITHIUM3_AVX2_pack_pk(
|
void PQCLEAN_DILITHIUM3_AVX2_pack_pk(
|
||||||
uint8_t *pk,
|
uint8_t pk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_PUBLICKEYBYTES],
|
||||||
const uint8_t *rho, const polyveck *t1);
|
const uint8_t rho[SEEDBYTES],
|
||||||
|
const polyveck *t1);
|
||||||
void PQCLEAN_DILITHIUM3_AVX2_pack_sk(
|
void PQCLEAN_DILITHIUM3_AVX2_pack_sk(
|
||||||
uint8_t *sk,
|
uint8_t sk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_SECRETKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *key,
|
const uint8_t key[SEEDBYTES],
|
||||||
const uint8_t *tr,
|
const uint8_t tr[SEEDBYTES],
|
||||||
const polyvecl *s1,
|
const polyvecl *s1,
|
||||||
const polyveck *s2,
|
const polyveck *s2,
|
||||||
const polyveck *t0);
|
const polyveck *t0);
|
||||||
void PQCLEAN_DILITHIUM3_AVX2_pack_sig(
|
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);
|
const polyvecl *z, const polyveck *h, const poly *c);
|
||||||
|
|
||||||
void PQCLEAN_DILITHIUM3_AVX2_unpack_pk(
|
void PQCLEAN_DILITHIUM3_AVX2_unpack_pk(
|
||||||
uint8_t *rho, polyveck *t1,
|
uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *pk);
|
polyveck *t1,
|
||||||
|
const uint8_t pk[PQCLEAN_DILITHIUM3_AVX2_CRYPTO_PUBLICKEYBYTES]);
|
||||||
void PQCLEAN_DILITHIUM3_AVX2_unpack_sk(
|
void PQCLEAN_DILITHIUM3_AVX2_unpack_sk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
uint8_t *key,
|
uint8_t key[SEEDBYTES],
|
||||||
uint8_t *tr,
|
uint8_t tr[CRHBYTES],
|
||||||
polyvecl *s1,
|
polyvecl *s1,
|
||||||
polyveck *s2,
|
polyveck *s2,
|
||||||
polyveck *t0,
|
polyveck *t0,
|
||||||
const uint8_t *sk);
|
const uint8_t *sk);
|
||||||
int PQCLEAN_DILITHIUM3_AVX2_unpack_sig(
|
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
|
#endif
|
||||||
|
@ -26,8 +26,4 @@
|
|||||||
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
|
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
|
||||||
#define POLW1_SIZE_PACKED ((N*4)/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
|
#endif
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
#define PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_PUBLICKEYBYTES 1472U
|
#define PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_PUBLICKEYBYTES 1472U
|
||||||
#define PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_SECRETKEYBYTES 3504U
|
#define PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_SECRETKEYBYTES 3504U
|
||||||
#define PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_BYTES 2701U
|
#define PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_BYTES 2701U
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
* - const polyveck *t1: pointer to vector t1
|
* - const polyveck *t1: pointer to vector t1
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM3_CLEAN_pack_pk(
|
void PQCLEAN_DILITHIUM3_CLEAN_pack_pk(
|
||||||
uint8_t *pk,
|
uint8_t pk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_PUBLICKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const polyveck *t1) {
|
const polyveck *t1) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
pk[i] = rho[i];
|
pk[i] = rho[i];
|
||||||
@ -36,9 +36,9 @@ void PQCLEAN_DILITHIUM3_CLEAN_pack_pk(
|
|||||||
* - uint8_t pk[]: byte array containing bit-packed pk
|
* - uint8_t pk[]: byte array containing bit-packed pk
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM3_CLEAN_unpack_pk(
|
void PQCLEAN_DILITHIUM3_CLEAN_unpack_pk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
polyveck *t1,
|
polyveck *t1,
|
||||||
const uint8_t *pk) {
|
const uint8_t pk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_PUBLICKEYBYTES]) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
rho[i] = pk[i];
|
rho[i] = pk[i];
|
||||||
}
|
}
|
||||||
@ -63,10 +63,10 @@ void PQCLEAN_DILITHIUM3_CLEAN_unpack_pk(
|
|||||||
* - const polyveck *t0: pointer to vector t0
|
* - const polyveck *t0: pointer to vector t0
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM3_CLEAN_pack_sk(
|
void PQCLEAN_DILITHIUM3_CLEAN_pack_sk(
|
||||||
uint8_t *sk,
|
uint8_t sk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_SECRETKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *key,
|
const uint8_t key[SEEDBYTES],
|
||||||
const uint8_t *tr,
|
const uint8_t tr[CRHBYTES],
|
||||||
const polyvecl *s1,
|
const polyvecl *s1,
|
||||||
const polyveck *s2,
|
const polyveck *s2,
|
||||||
const polyveck *t0) {
|
const polyveck *t0) {
|
||||||
@ -114,13 +114,13 @@ void PQCLEAN_DILITHIUM3_CLEAN_pack_sk(
|
|||||||
* - uint8_t sk[]: byte array containing bit-packed sk
|
* - uint8_t sk[]: byte array containing bit-packed sk
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM3_CLEAN_unpack_sk(
|
void PQCLEAN_DILITHIUM3_CLEAN_unpack_sk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
uint8_t *key,
|
uint8_t key[SEEDBYTES],
|
||||||
uint8_t *tr,
|
uint8_t tr[CRHBYTES],
|
||||||
polyvecl *s1,
|
polyvecl *s1,
|
||||||
polyveck *s2,
|
polyveck *s2,
|
||||||
polyveck *t0,
|
polyveck *t0,
|
||||||
const uint8_t *sk) {
|
const uint8_t sk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_SECRETKEYBYTES]) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
rho[i] = sk[i];
|
rho[i] = sk[i];
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ void PQCLEAN_DILITHIUM3_CLEAN_unpack_sk(
|
|||||||
* - const poly *c: pointer to challenge polynomial
|
* - const poly *c: pointer to challenge polynomial
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM3_CLEAN_pack_sig(
|
void PQCLEAN_DILITHIUM3_CLEAN_pack_sig(
|
||||||
uint8_t *sig,
|
uint8_t sig[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_SECRETKEYBYTES],
|
||||||
const polyvecl *z,
|
const polyvecl *z,
|
||||||
const polyveck *h,
|
const polyveck *h,
|
||||||
const poly *c) {
|
const poly *c) {
|
||||||
@ -228,7 +228,7 @@ int PQCLEAN_DILITHIUM3_CLEAN_unpack_sig(
|
|||||||
polyvecl *z,
|
polyvecl *z,
|
||||||
polyveck *h,
|
polyveck *h,
|
||||||
poly *c,
|
poly *c,
|
||||||
const uint8_t *sig) {
|
const uint8_t sig[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_BYTES]) {
|
||||||
size_t k;
|
size_t k;
|
||||||
uint64_t signs;
|
uint64_t signs;
|
||||||
|
|
||||||
|
@ -1,36 +1,42 @@
|
|||||||
#ifndef PQCLEAN_DILITHIUM3_CLEAN_PACKING_H
|
#ifndef PQCLEAN_DILITHIUM3_CLEAN_PACKING_H
|
||||||
#define PQCLEAN_DILITHIUM3_CLEAN_PACKING_H
|
#define PQCLEAN_DILITHIUM3_CLEAN_PACKING_H
|
||||||
|
|
||||||
|
#include "api.h"
|
||||||
#include "params.h"
|
#include "params.h"
|
||||||
#include "polyvec.h"
|
#include "polyvec.h"
|
||||||
|
|
||||||
void PQCLEAN_DILITHIUM3_CLEAN_pack_pk(
|
void PQCLEAN_DILITHIUM3_CLEAN_pack_pk(
|
||||||
uint8_t *pk,
|
uint8_t pk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_PUBLICKEYBYTES],
|
||||||
const uint8_t *rho, const polyveck *t1);
|
const uint8_t rho[SEEDBYTES],
|
||||||
|
const polyveck *t1);
|
||||||
void PQCLEAN_DILITHIUM3_CLEAN_pack_sk(
|
void PQCLEAN_DILITHIUM3_CLEAN_pack_sk(
|
||||||
uint8_t *sk,
|
uint8_t sk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_SECRETKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *key,
|
const uint8_t key[SEEDBYTES],
|
||||||
const uint8_t *tr,
|
const uint8_t tr[SEEDBYTES],
|
||||||
const polyvecl *s1,
|
const polyvecl *s1,
|
||||||
const polyveck *s2,
|
const polyveck *s2,
|
||||||
const polyveck *t0);
|
const polyveck *t0);
|
||||||
void PQCLEAN_DILITHIUM3_CLEAN_pack_sig(
|
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);
|
const polyvecl *z, const polyveck *h, const poly *c);
|
||||||
|
|
||||||
void PQCLEAN_DILITHIUM3_CLEAN_unpack_pk(
|
void PQCLEAN_DILITHIUM3_CLEAN_unpack_pk(
|
||||||
uint8_t *rho, polyveck *t1,
|
uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *pk);
|
polyveck *t1,
|
||||||
|
const uint8_t pk[PQCLEAN_DILITHIUM3_CLEAN_CRYPTO_PUBLICKEYBYTES]);
|
||||||
void PQCLEAN_DILITHIUM3_CLEAN_unpack_sk(
|
void PQCLEAN_DILITHIUM3_CLEAN_unpack_sk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
uint8_t *key,
|
uint8_t key[SEEDBYTES],
|
||||||
uint8_t *tr,
|
uint8_t tr[CRHBYTES],
|
||||||
polyvecl *s1,
|
polyvecl *s1,
|
||||||
polyveck *s2,
|
polyveck *s2,
|
||||||
polyveck *t0,
|
polyveck *t0,
|
||||||
const uint8_t *sk);
|
const uint8_t *sk);
|
||||||
int PQCLEAN_DILITHIUM3_CLEAN_unpack_sig(
|
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
|
#endif
|
||||||
|
@ -26,8 +26,4 @@
|
|||||||
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
|
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
|
||||||
#define POLW1_SIZE_PACKED ((N*4)/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
|
#endif
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
#define PQCLEAN_DILITHIUM4_AVX2_CRYPTO_PUBLICKEYBYTES 1760U
|
#define PQCLEAN_DILITHIUM4_AVX2_CRYPTO_PUBLICKEYBYTES 1760U
|
||||||
#define PQCLEAN_DILITHIUM4_AVX2_CRYPTO_SECRETKEYBYTES 3856U
|
#define PQCLEAN_DILITHIUM4_AVX2_CRYPTO_SECRETKEYBYTES 3856U
|
||||||
#define PQCLEAN_DILITHIUM4_AVX2_CRYPTO_BYTES 3366U
|
#define PQCLEAN_DILITHIUM4_AVX2_CRYPTO_BYTES 3366U
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
* - const polyveck *t1: pointer to vector t1
|
* - const polyveck *t1: pointer to vector t1
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM4_AVX2_pack_pk(
|
void PQCLEAN_DILITHIUM4_AVX2_pack_pk(
|
||||||
uint8_t *pk,
|
uint8_t pk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_PUBLICKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const polyveck *t1) {
|
const polyveck *t1) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
pk[i] = rho[i];
|
pk[i] = rho[i];
|
||||||
@ -36,9 +36,9 @@ void PQCLEAN_DILITHIUM4_AVX2_pack_pk(
|
|||||||
* - uint8_t pk[]: byte array containing bit-packed pk
|
* - uint8_t pk[]: byte array containing bit-packed pk
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM4_AVX2_unpack_pk(
|
void PQCLEAN_DILITHIUM4_AVX2_unpack_pk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
polyveck *t1,
|
polyveck *t1,
|
||||||
const uint8_t *pk) {
|
const uint8_t pk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_PUBLICKEYBYTES]) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
rho[i] = pk[i];
|
rho[i] = pk[i];
|
||||||
}
|
}
|
||||||
@ -63,10 +63,10 @@ void PQCLEAN_DILITHIUM4_AVX2_unpack_pk(
|
|||||||
* - const polyveck *t0: pointer to vector t0
|
* - const polyveck *t0: pointer to vector t0
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM4_AVX2_pack_sk(
|
void PQCLEAN_DILITHIUM4_AVX2_pack_sk(
|
||||||
uint8_t *sk,
|
uint8_t sk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_SECRETKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *key,
|
const uint8_t key[SEEDBYTES],
|
||||||
const uint8_t *tr,
|
const uint8_t tr[CRHBYTES],
|
||||||
const polyvecl *s1,
|
const polyvecl *s1,
|
||||||
const polyveck *s2,
|
const polyveck *s2,
|
||||||
const polyveck *t0) {
|
const polyveck *t0) {
|
||||||
@ -114,13 +114,13 @@ void PQCLEAN_DILITHIUM4_AVX2_pack_sk(
|
|||||||
* - uint8_t sk[]: byte array containing bit-packed sk
|
* - uint8_t sk[]: byte array containing bit-packed sk
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM4_AVX2_unpack_sk(
|
void PQCLEAN_DILITHIUM4_AVX2_unpack_sk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
uint8_t *key,
|
uint8_t key[SEEDBYTES],
|
||||||
uint8_t *tr,
|
uint8_t tr[CRHBYTES],
|
||||||
polyvecl *s1,
|
polyvecl *s1,
|
||||||
polyveck *s2,
|
polyveck *s2,
|
||||||
polyveck *t0,
|
polyveck *t0,
|
||||||
const uint8_t *sk) {
|
const uint8_t sk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_SECRETKEYBYTES]) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
rho[i] = sk[i];
|
rho[i] = sk[i];
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ void PQCLEAN_DILITHIUM4_AVX2_unpack_sk(
|
|||||||
* - const poly *c: pointer to challenge polynomial
|
* - const poly *c: pointer to challenge polynomial
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM4_AVX2_pack_sig(
|
void PQCLEAN_DILITHIUM4_AVX2_pack_sig(
|
||||||
uint8_t *sig,
|
uint8_t sig[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_SECRETKEYBYTES],
|
||||||
const polyvecl *z,
|
const polyvecl *z,
|
||||||
const polyveck *h,
|
const polyveck *h,
|
||||||
const poly *c) {
|
const poly *c) {
|
||||||
@ -228,7 +228,7 @@ int PQCLEAN_DILITHIUM4_AVX2_unpack_sig(
|
|||||||
polyvecl *z,
|
polyvecl *z,
|
||||||
polyveck *h,
|
polyveck *h,
|
||||||
poly *c,
|
poly *c,
|
||||||
const uint8_t *sig) {
|
const uint8_t sig[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_BYTES]) {
|
||||||
size_t k;
|
size_t k;
|
||||||
uint64_t signs;
|
uint64_t signs;
|
||||||
|
|
||||||
|
@ -1,36 +1,42 @@
|
|||||||
#ifndef PQCLEAN_DILITHIUM4_AVX2_PACKING_H
|
#ifndef PQCLEAN_DILITHIUM4_AVX2_PACKING_H
|
||||||
#define PQCLEAN_DILITHIUM4_AVX2_PACKING_H
|
#define PQCLEAN_DILITHIUM4_AVX2_PACKING_H
|
||||||
|
|
||||||
|
#include "api.h"
|
||||||
#include "params.h"
|
#include "params.h"
|
||||||
#include "polyvec.h"
|
#include "polyvec.h"
|
||||||
|
|
||||||
void PQCLEAN_DILITHIUM4_AVX2_pack_pk(
|
void PQCLEAN_DILITHIUM4_AVX2_pack_pk(
|
||||||
uint8_t *pk,
|
uint8_t pk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_PUBLICKEYBYTES],
|
||||||
const uint8_t *rho, const polyveck *t1);
|
const uint8_t rho[SEEDBYTES],
|
||||||
|
const polyveck *t1);
|
||||||
void PQCLEAN_DILITHIUM4_AVX2_pack_sk(
|
void PQCLEAN_DILITHIUM4_AVX2_pack_sk(
|
||||||
uint8_t *sk,
|
uint8_t sk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_SECRETKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *key,
|
const uint8_t key[SEEDBYTES],
|
||||||
const uint8_t *tr,
|
const uint8_t tr[SEEDBYTES],
|
||||||
const polyvecl *s1,
|
const polyvecl *s1,
|
||||||
const polyveck *s2,
|
const polyveck *s2,
|
||||||
const polyveck *t0);
|
const polyveck *t0);
|
||||||
void PQCLEAN_DILITHIUM4_AVX2_pack_sig(
|
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);
|
const polyvecl *z, const polyveck *h, const poly *c);
|
||||||
|
|
||||||
void PQCLEAN_DILITHIUM4_AVX2_unpack_pk(
|
void PQCLEAN_DILITHIUM4_AVX2_unpack_pk(
|
||||||
uint8_t *rho, polyveck *t1,
|
uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *pk);
|
polyveck *t1,
|
||||||
|
const uint8_t pk[PQCLEAN_DILITHIUM4_AVX2_CRYPTO_PUBLICKEYBYTES]);
|
||||||
void PQCLEAN_DILITHIUM4_AVX2_unpack_sk(
|
void PQCLEAN_DILITHIUM4_AVX2_unpack_sk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
uint8_t *key,
|
uint8_t key[SEEDBYTES],
|
||||||
uint8_t *tr,
|
uint8_t tr[CRHBYTES],
|
||||||
polyvecl *s1,
|
polyvecl *s1,
|
||||||
polyveck *s2,
|
polyveck *s2,
|
||||||
polyveck *t0,
|
polyveck *t0,
|
||||||
const uint8_t *sk);
|
const uint8_t *sk);
|
||||||
int PQCLEAN_DILITHIUM4_AVX2_unpack_sig(
|
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
|
#endif
|
||||||
|
@ -26,8 +26,4 @@
|
|||||||
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
|
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
|
||||||
#define POLW1_SIZE_PACKED ((N*4)/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
|
#endif
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
||||||
#define PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_PUBLICKEYBYTES 1760U
|
#define PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_PUBLICKEYBYTES 1760U
|
||||||
#define PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_SECRETKEYBYTES 3856U
|
#define PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_SECRETKEYBYTES 3856U
|
||||||
#define PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_BYTES 3366U
|
#define PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_BYTES 3366U
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
* - const polyveck *t1: pointer to vector t1
|
* - const polyveck *t1: pointer to vector t1
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM4_CLEAN_pack_pk(
|
void PQCLEAN_DILITHIUM4_CLEAN_pack_pk(
|
||||||
uint8_t *pk,
|
uint8_t pk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_PUBLICKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const polyveck *t1) {
|
const polyveck *t1) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
pk[i] = rho[i];
|
pk[i] = rho[i];
|
||||||
@ -36,9 +36,9 @@ void PQCLEAN_DILITHIUM4_CLEAN_pack_pk(
|
|||||||
* - uint8_t pk[]: byte array containing bit-packed pk
|
* - uint8_t pk[]: byte array containing bit-packed pk
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM4_CLEAN_unpack_pk(
|
void PQCLEAN_DILITHIUM4_CLEAN_unpack_pk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
polyveck *t1,
|
polyveck *t1,
|
||||||
const uint8_t *pk) {
|
const uint8_t pk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_PUBLICKEYBYTES]) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
rho[i] = pk[i];
|
rho[i] = pk[i];
|
||||||
}
|
}
|
||||||
@ -63,10 +63,10 @@ void PQCLEAN_DILITHIUM4_CLEAN_unpack_pk(
|
|||||||
* - const polyveck *t0: pointer to vector t0
|
* - const polyveck *t0: pointer to vector t0
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM4_CLEAN_pack_sk(
|
void PQCLEAN_DILITHIUM4_CLEAN_pack_sk(
|
||||||
uint8_t *sk,
|
uint8_t sk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_SECRETKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *key,
|
const uint8_t key[SEEDBYTES],
|
||||||
const uint8_t *tr,
|
const uint8_t tr[CRHBYTES],
|
||||||
const polyvecl *s1,
|
const polyvecl *s1,
|
||||||
const polyveck *s2,
|
const polyveck *s2,
|
||||||
const polyveck *t0) {
|
const polyveck *t0) {
|
||||||
@ -114,13 +114,13 @@ void PQCLEAN_DILITHIUM4_CLEAN_pack_sk(
|
|||||||
* - uint8_t sk[]: byte array containing bit-packed sk
|
* - uint8_t sk[]: byte array containing bit-packed sk
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM4_CLEAN_unpack_sk(
|
void PQCLEAN_DILITHIUM4_CLEAN_unpack_sk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
uint8_t *key,
|
uint8_t key[SEEDBYTES],
|
||||||
uint8_t *tr,
|
uint8_t tr[CRHBYTES],
|
||||||
polyvecl *s1,
|
polyvecl *s1,
|
||||||
polyveck *s2,
|
polyveck *s2,
|
||||||
polyveck *t0,
|
polyveck *t0,
|
||||||
const uint8_t *sk) {
|
const uint8_t sk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_SECRETKEYBYTES]) {
|
||||||
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
for (size_t i = 0; i < SEEDBYTES; ++i) {
|
||||||
rho[i] = sk[i];
|
rho[i] = sk[i];
|
||||||
}
|
}
|
||||||
@ -162,7 +162,7 @@ void PQCLEAN_DILITHIUM4_CLEAN_unpack_sk(
|
|||||||
* - const poly *c: pointer to challenge polynomial
|
* - const poly *c: pointer to challenge polynomial
|
||||||
**************************************************/
|
**************************************************/
|
||||||
void PQCLEAN_DILITHIUM4_CLEAN_pack_sig(
|
void PQCLEAN_DILITHIUM4_CLEAN_pack_sig(
|
||||||
uint8_t *sig,
|
uint8_t sig[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_SECRETKEYBYTES],
|
||||||
const polyvecl *z,
|
const polyvecl *z,
|
||||||
const polyveck *h,
|
const polyveck *h,
|
||||||
const poly *c) {
|
const poly *c) {
|
||||||
@ -228,7 +228,7 @@ int PQCLEAN_DILITHIUM4_CLEAN_unpack_sig(
|
|||||||
polyvecl *z,
|
polyvecl *z,
|
||||||
polyveck *h,
|
polyveck *h,
|
||||||
poly *c,
|
poly *c,
|
||||||
const uint8_t *sig) {
|
const uint8_t sig[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_BYTES]) {
|
||||||
size_t k;
|
size_t k;
|
||||||
uint64_t signs;
|
uint64_t signs;
|
||||||
|
|
||||||
|
@ -1,36 +1,42 @@
|
|||||||
#ifndef PQCLEAN_DILITHIUM4_CLEAN_PACKING_H
|
#ifndef PQCLEAN_DILITHIUM4_CLEAN_PACKING_H
|
||||||
#define PQCLEAN_DILITHIUM4_CLEAN_PACKING_H
|
#define PQCLEAN_DILITHIUM4_CLEAN_PACKING_H
|
||||||
|
|
||||||
|
#include "api.h"
|
||||||
#include "params.h"
|
#include "params.h"
|
||||||
#include "polyvec.h"
|
#include "polyvec.h"
|
||||||
|
|
||||||
void PQCLEAN_DILITHIUM4_CLEAN_pack_pk(
|
void PQCLEAN_DILITHIUM4_CLEAN_pack_pk(
|
||||||
uint8_t *pk,
|
uint8_t pk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_PUBLICKEYBYTES],
|
||||||
const uint8_t *rho, const polyveck *t1);
|
const uint8_t rho[SEEDBYTES],
|
||||||
|
const polyveck *t1);
|
||||||
void PQCLEAN_DILITHIUM4_CLEAN_pack_sk(
|
void PQCLEAN_DILITHIUM4_CLEAN_pack_sk(
|
||||||
uint8_t *sk,
|
uint8_t sk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_SECRETKEYBYTES],
|
||||||
const uint8_t *rho,
|
const uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *key,
|
const uint8_t key[SEEDBYTES],
|
||||||
const uint8_t *tr,
|
const uint8_t tr[SEEDBYTES],
|
||||||
const polyvecl *s1,
|
const polyvecl *s1,
|
||||||
const polyveck *s2,
|
const polyveck *s2,
|
||||||
const polyveck *t0);
|
const polyveck *t0);
|
||||||
void PQCLEAN_DILITHIUM4_CLEAN_pack_sig(
|
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);
|
const polyvecl *z, const polyveck *h, const poly *c);
|
||||||
|
|
||||||
void PQCLEAN_DILITHIUM4_CLEAN_unpack_pk(
|
void PQCLEAN_DILITHIUM4_CLEAN_unpack_pk(
|
||||||
uint8_t *rho, polyveck *t1,
|
uint8_t rho[SEEDBYTES],
|
||||||
const uint8_t *pk);
|
polyveck *t1,
|
||||||
|
const uint8_t pk[PQCLEAN_DILITHIUM4_CLEAN_CRYPTO_PUBLICKEYBYTES]);
|
||||||
void PQCLEAN_DILITHIUM4_CLEAN_unpack_sk(
|
void PQCLEAN_DILITHIUM4_CLEAN_unpack_sk(
|
||||||
uint8_t *rho,
|
uint8_t rho[SEEDBYTES],
|
||||||
uint8_t *key,
|
uint8_t key[SEEDBYTES],
|
||||||
uint8_t *tr,
|
uint8_t tr[CRHBYTES],
|
||||||
polyvecl *s1,
|
polyvecl *s1,
|
||||||
polyveck *s2,
|
polyveck *s2,
|
||||||
polyveck *t0,
|
polyveck *t0,
|
||||||
const uint8_t *sk);
|
const uint8_t *sk);
|
||||||
int PQCLEAN_DILITHIUM4_CLEAN_unpack_sig(
|
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
|
#endif
|
||||||
|
@ -26,8 +26,4 @@
|
|||||||
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
|
#define POLZ_SIZE_PACKED ((N*(QBITS - 3))/8)
|
||||||
#define POLW1_SIZE_PACKED ((N*4)/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
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user