Browse Source

Specify arrays with sizes again

kyber
Thom Wiggers 5 years ago
committed by Kris Kwiatkowski
parent
commit
7dc03bfc44
24 changed files with 204 additions and 186 deletions
  1. +1
    -0
      crypto_sign/dilithium2/avx2/api.h
  2. +14
    -14
      crypto_sign/dilithium2/avx2/packing.c
  3. +19
    -13
      crypto_sign/dilithium2/avx2/packing.h
  4. +0
    -4
      crypto_sign/dilithium2/avx2/params.h
  5. +1
    -0
      crypto_sign/dilithium2/clean/api.h
  6. +14
    -14
      crypto_sign/dilithium2/clean/packing.c
  7. +19
    -13
      crypto_sign/dilithium2/clean/packing.h
  8. +0
    -4
      crypto_sign/dilithium2/clean/params.h
  9. +1
    -0
      crypto_sign/dilithium3/avx2/api.h
  10. +14
    -14
      crypto_sign/dilithium3/avx2/packing.c
  11. +19
    -13
      crypto_sign/dilithium3/avx2/packing.h
  12. +0
    -4
      crypto_sign/dilithium3/avx2/params.h
  13. +1
    -0
      crypto_sign/dilithium3/clean/api.h
  14. +14
    -14
      crypto_sign/dilithium3/clean/packing.c
  15. +19
    -13
      crypto_sign/dilithium3/clean/packing.h
  16. +0
    -4
      crypto_sign/dilithium3/clean/params.h
  17. +1
    -0
      crypto_sign/dilithium4/avx2/api.h
  18. +14
    -14
      crypto_sign/dilithium4/avx2/packing.c
  19. +19
    -13
      crypto_sign/dilithium4/avx2/packing.h
  20. +0
    -4
      crypto_sign/dilithium4/avx2/params.h
  21. +1
    -0
      crypto_sign/dilithium4/clean/api.h
  22. +14
    -14
      crypto_sign/dilithium4/clean/packing.c
  23. +19
    -13
      crypto_sign/dilithium4/clean/packing.h
  24. +0
    -4
      crypto_sign/dilithium4/clean/params.h

+ 1
- 0
crypto_sign/dilithium2/avx2/api.h 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


+ 14
- 14
crypto_sign/dilithium2/avx2/packing.c 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;



+ 19
- 13
crypto_sign/dilithium2/avx2/packing.h 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

+ 0
- 4
crypto_sign/dilithium2/avx2/params.h 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

+ 1
- 0
crypto_sign/dilithium2/clean/api.h 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


+ 14
- 14
crypto_sign/dilithium2/clean/packing.c 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;



+ 19
- 13
crypto_sign/dilithium2/clean/packing.h 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

+ 0
- 4
crypto_sign/dilithium2/clean/params.h 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

+ 1
- 0
crypto_sign/dilithium3/avx2/api.h 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


+ 14
- 14
crypto_sign/dilithium3/avx2/packing.c 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;



+ 19
- 13
crypto_sign/dilithium3/avx2/packing.h 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

+ 0
- 4
crypto_sign/dilithium3/avx2/params.h 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

+ 1
- 0
crypto_sign/dilithium3/clean/api.h 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


+ 14
- 14
crypto_sign/dilithium3/clean/packing.c 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;



+ 19
- 13
crypto_sign/dilithium3/clean/packing.h 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

+ 0
- 4
crypto_sign/dilithium3/clean/params.h 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

+ 1
- 0
crypto_sign/dilithium4/avx2/api.h 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


+ 14
- 14
crypto_sign/dilithium4/avx2/packing.c 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;



+ 19
- 13
crypto_sign/dilithium4/avx2/packing.h 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

+ 0
- 4
crypto_sign/dilithium4/avx2/params.h 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

+ 1
- 0
crypto_sign/dilithium4/clean/api.h 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


+ 14
- 14
crypto_sign/dilithium4/clean/packing.c 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;



+ 19
- 13
crypto_sign/dilithium4/clean/packing.h 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

+ 0
- 4
crypto_sign/dilithium4/clean/params.h 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

Loading…
Cancel
Save