Skip to content

Commit

Permalink
Merge pull request #332 from mupq/nistdraftkyberdilithium
Browse files Browse the repository at this point in the history
NIST Draft version of Kyber and Dilithium; remove divisions by KYBER_Q
  • Loading branch information
rpls committed Feb 27, 2024
2 parents 62244ef + c4fd63c commit 403c694
Show file tree
Hide file tree
Showing 203 changed files with 771 additions and 1,449 deletions.
1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/aes256ctr.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/aes256ctr.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/api.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/cbd.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/cbd.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/fastaddsub.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/fastbasemul.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/fastinvntt.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/fastntt.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/indcpa.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/indcpa.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/kem.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/macros.i

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/matacc.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/matacc.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/matacc.i

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/matacc_asm.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/ntt.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/ntt.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/params.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/poly.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/poly.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/poly_asm.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/polyvec.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/polyvec.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/reduce.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/symmetric.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/verify.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fspeed/verify.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/aes256ctr.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/aes256ctr.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/api.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/cbd.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/cbd.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/fastaddsub.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/fastbasemul.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/fastinvntt.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/fastntt.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/indcpa.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/indcpa.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/kem.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/macros.i

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/matacc.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/matacc.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/matacc.i

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/matacc_asm.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/ntt.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/ntt.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/params.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/poly.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/poly.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/poly_asm.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/polyvec.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/polyvec.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/reduce.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/symmetric.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/verify.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber1024-90s/m4fstack/verify.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/aes256ctr.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/aes256ctr.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/api.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/cbd.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/cbd.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/fastaddsub.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/fastbasemul.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/fastinvntt.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/fastntt.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/indcpa.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/indcpa.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/kem.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/macros.i

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/matacc.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/matacc.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/matacc.i

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/matacc_asm.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/ntt.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/ntt.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/params.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/poly.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/poly.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/poly_asm.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/polyvec.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/polyvec.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/reduce.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/symmetric.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/verify.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fspeed/verify.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/aes256ctr.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/aes256ctr.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/api.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/cbd.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/cbd.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/fastaddsub.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/fastbasemul.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/fastinvntt.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/fastntt.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/indcpa.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/indcpa.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/kem.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/macros.i

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/matacc.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/matacc.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/matacc.i

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/matacc_asm.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/ntt.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/ntt.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/params.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/poly.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/poly.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/poly_asm.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/polyvec.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/polyvec.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/reduce.S

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/symmetric.h

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/verify.c

This file was deleted.

1 change: 0 additions & 1 deletion crypto_kem/kyber512-90s/m4fstack/verify.h

This file was deleted.

18 changes: 12 additions & 6 deletions crypto_kem/kyber512/m4fspeed/indcpa.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,23 @@
#include <string.h>
#include <stdint.h>


/*************************************************
* Name: indcpa_keypair
* Name: indcpa_keypair_derand
*
* Description: Generates public and private key for the CPA-secure
* public-key encryption scheme underlying Kyber
*
* Arguments: - unsigned char *pk: pointer to output public key (of length KYBER_INDCPA_PUBLICKEYBYTES bytes)
* - unsigned char *sk: pointer to output private key (of length KYBER_INDCPA_SECRETKEYBYTES bytes)
* Arguments: - uint8_t *pk: pointer to output public key
* (of length KYBER_INDCPA_PUBLICKEYBYTES bytes)
* - uint8_t *sk: pointer to output private key
* (of length KYBER_INDCPA_SECRETKEYBYTES bytes)
* - const uint8_t *coins: pointer to input randomness
* (of length KYBER_SYMBYTES bytes)
**************************************************/
void indcpa_keypair(unsigned char *pk, unsigned char *sk) {
void indcpa_keypair_derand(unsigned char *pk,
unsigned char *sk,
const unsigned char *coins){
polyvec skpv, skpv_prime;
poly pkp;
unsigned char buf[2 * KYBER_SYMBYTES];
Expand All @@ -27,8 +34,7 @@ void indcpa_keypair(unsigned char *pk, unsigned char *sk) {
int i;
unsigned char nonce = 0;

randombytes(buf, KYBER_SYMBYTES);
hash_g(buf, buf, KYBER_SYMBYTES);
hash_g(buf, coins, KYBER_SYMBYTES);

for (i = 0; i < KYBER_K; i++)
poly_getnoise_eta1(skpv.vec + i, noiseseed, nonce++);
Expand Down
Loading

0 comments on commit 403c694

Please sign in to comment.