* This release updates ML-KEM implementations to their final FIPS 203 https://csrc.nist.gov/pubs/fips/203/final versions . * This release still includes the NIST Round 3 version of Kyber for interoperability purposes, but we plan to remove Kyber Round 3 in a future release. * Additionally, this release adds support for MAYO and CROSS digital signature schemes from [NIST Additional Signatures Round 1 https://csrc.nist.gov/Projects/pqc-dig-sig/round-1-additional-signatures along with stateful hash-based signature schemes XMSS https://datatracker.ietf.org/doc/html/rfc8391 and LMS https://datatracker.ietf.org/doc/html/rfc8554. * Finally, this release provides formally verified implementations of Kyber-512 and Kyber-768 from libjade https://github.com/formosa-crypto/libjade/releases/tag/release%2F2023.05-2 * LMS and XMSS are disabled by default due to the security risks associated with their use in software. See the note on stateful hash-based signatures in CONFIGURE.md * Key encapsulation mechanisms: - Kyber: Added formally-verified portable C and AVX2 implementations of Kyber-512 and Kyber-768 from libjade. - ML-KEM: Updated portable C and AVX2 implementations of ML-KEM-512, ML-KEM-768, and ML-KEM-1024 to FIP 203 version. - Kyber: Patched ARM64 implementations of Kyber-512, Kyber-768, and Kyber-1024 to work with AddressSanitizer. * Digital signature schemes: - LMS/XMSS: Added implementations of stateful hash-based signature schemes: XMSS and LMS - MAYO: Added portable C and AVX2 implementations of MAYO signature scheme from NIST Additional Signatures Round 1. - CROSS: Added portable C and AVX2 implementations of CROSS signature OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/liboqs?expand=0&rev=25
175 lines
7.2 KiB
Diff
175 lines
7.2 KiB
Diff
Index: liboqs-0.8.0/src/kem/kyber/pqcrystals-kyber_kyber1024_ref/kem.h
|
|
===================================================================
|
|
--- liboqs-0.8.0.orig/src/kem/kyber/pqcrystals-kyber_kyber1024_ref/kem.h
|
|
+++ liboqs-0.8.0/src/kem/kyber/pqcrystals-kyber_kyber1024_ref/kem.h
|
|
@@ -30,12 +30,13 @@
|
|
#endif
|
|
|
|
#define crypto_kem_keypair KYBER_NAMESPACE(keypair)
|
|
-int crypto_kem_keypair(uint8_t *pk, uint8_t *sk);
|
|
+int crypto_kem_keypair(uint8_t pk[KYBER_PUBLICKEYBYTES], uint8_t sk[KYBER_SECRETKEYBYTES]);
|
|
+
|
|
|
|
#define crypto_kem_enc KYBER_NAMESPACE(enc)
|
|
-int crypto_kem_enc(uint8_t *ct, uint8_t *ss, const uint8_t *pk);
|
|
+int crypto_kem_enc(uint8_t ct[KYBER_CIPHERTEXTBYTES], uint8_t ss[KYBER_SSBYTES], const uint8_t pk[KYBER_PUBLICKEYBYTES]);
|
|
|
|
#define crypto_kem_dec KYBER_NAMESPACE(dec)
|
|
-int crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk);
|
|
+int crypto_kem_dec(uint8_t ss[KYBER_SSBYTES], const uint8_t ct[KYBER_CIPHERTEXTBYTES], const uint8_t sk[KYBER_SECRETKEYBYTES]);
|
|
|
|
#endif
|
|
Index: liboqs-0.8.0/src/kem/kyber/pqcrystals-kyber_kyber512_ref/kem.h
|
|
===================================================================
|
|
--- liboqs-0.8.0.orig/src/kem/kyber/pqcrystals-kyber_kyber512_ref/kem.h
|
|
+++ liboqs-0.8.0/src/kem/kyber/pqcrystals-kyber_kyber512_ref/kem.h
|
|
@@ -30,12 +30,15 @@
|
|
#endif
|
|
|
|
#define crypto_kem_keypair KYBER_NAMESPACE(keypair)
|
|
-int crypto_kem_keypair(uint8_t *pk, uint8_t *sk);
|
|
+int crypto_kem_keypair(uint8_t pk[KYBER_PUBLICKEYBYTES], uint8_t sk[KYBER_SECRETKEYBYTES]);
|
|
+
|
|
|
|
#define crypto_kem_enc KYBER_NAMESPACE(enc)
|
|
-int crypto_kem_enc(uint8_t *ct, uint8_t *ss, const uint8_t *pk);
|
|
+int crypto_kem_enc(uint8_t ct[KYBER_CIPHERTEXTBYTES], uint8_t ss[KYBER_SSBYTES], const uint8_t pk[KYBER_PUBLICKEYBYTES]);
|
|
+
|
|
|
|
#define crypto_kem_dec KYBER_NAMESPACE(dec)
|
|
-int crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk);
|
|
+int crypto_kem_dec(uint8_t ss[KYBER_SSBYTES], const uint8_t ct[KYBER_CIPHERTEXTBYTES], const uint8_t sk[KYBER_SECRETKEYBYTES]);
|
|
+
|
|
|
|
#endif
|
|
Index: liboqs-0.8.0/src/kem/kyber/pqcrystals-kyber_kyber768_ref/kem.h
|
|
===================================================================
|
|
--- liboqs-0.8.0.orig/src/kem/kyber/pqcrystals-kyber_kyber768_ref/kem.h
|
|
+++ liboqs-0.8.0/src/kem/kyber/pqcrystals-kyber_kyber768_ref/kem.h
|
|
@@ -30,12 +30,14 @@
|
|
#endif
|
|
|
|
#define crypto_kem_keypair KYBER_NAMESPACE(keypair)
|
|
-int crypto_kem_keypair(uint8_t *pk, uint8_t *sk);
|
|
+int crypto_kem_keypair(uint8_t pk[KYBER_PUBLICKEYBYTES], uint8_t sk[KYBER_SECRETKEYBYTES]);
|
|
+
|
|
|
|
#define crypto_kem_enc KYBER_NAMESPACE(enc)
|
|
-int crypto_kem_enc(uint8_t *ct, uint8_t *ss, const uint8_t *pk);
|
|
+int crypto_kem_enc(uint8_t ct[KYBER_CIPHERTEXTBYTES], uint8_t ss[KYBER_SSBYTES], const uint8_t pk[KYBER_PUBLICKEYBYTES]);
|
|
+
|
|
|
|
#define crypto_kem_dec KYBER_NAMESPACE(dec)
|
|
-int crypto_kem_dec(uint8_t *ss, const uint8_t *ct, const uint8_t *sk);
|
|
+int crypto_kem_dec(uint8_t ss[KYBER_SSBYTES], const uint8_t ct[KYBER_CIPHERTEXTBYTES], const uint8_t sk[KYBER_SECRETKEYBYTES]);
|
|
|
|
#endif
|
|
Index: liboqs-0.8.0/src/kem/kyber/pqcrystals-kyber_kyber512_ref/kem.c
|
|
===================================================================
|
|
--- liboqs-0.8.0.orig/src/kem/kyber/pqcrystals-kyber_kyber512_ref/kem.c
|
|
+++ liboqs-0.8.0/src/kem/kyber/pqcrystals-kyber_kyber512_ref/kem.c
|
|
@@ -20,8 +20,7 @@
|
|
*
|
|
* Returns 0 (success)
|
|
**************************************************/
|
|
-int crypto_kem_keypair(uint8_t *pk,
|
|
- uint8_t *sk)
|
|
+int crypto_kem_keypair(uint8_t pk[KYBER_PUBLICKEYBYTES], uint8_t sk[KYBER_SECRETKEYBYTES])
|
|
{
|
|
size_t i;
|
|
indcpa_keypair(pk, sk);
|
|
@@ -48,9 +47,7 @@ int crypto_kem_keypair(uint8_t *pk,
|
|
*
|
|
* Returns 0 (success)
|
|
**************************************************/
|
|
-int crypto_kem_enc(uint8_t *ct,
|
|
- uint8_t *ss,
|
|
- const uint8_t *pk)
|
|
+int crypto_kem_enc(uint8_t ct[KYBER_CIPHERTEXTBYTES], uint8_t ss[KYBER_SSBYTES], const uint8_t pk[KYBER_PUBLICKEYBYTES])
|
|
{
|
|
uint8_t buf[2*KYBER_SYMBYTES];
|
|
/* Will contain key, coins */
|
|
@@ -91,9 +88,7 @@ int crypto_kem_enc(uint8_t *ct,
|
|
*
|
|
* On failure, ss will contain a pseudo-random value.
|
|
**************************************************/
|
|
-int crypto_kem_dec(uint8_t *ss,
|
|
- const uint8_t *ct,
|
|
- const uint8_t *sk)
|
|
+int crypto_kem_dec(uint8_t ss[KYBER_SSBYTES], const uint8_t ct[KYBER_CIPHERTEXTBYTES], const uint8_t sk[KYBER_SECRETKEYBYTES])
|
|
{
|
|
size_t i;
|
|
int fail;
|
|
Index: liboqs-0.8.0/src/kem/kyber/pqcrystals-kyber_kyber768_ref/kem.c
|
|
===================================================================
|
|
--- liboqs-0.8.0.orig/src/kem/kyber/pqcrystals-kyber_kyber768_ref/kem.c
|
|
+++ liboqs-0.8.0/src/kem/kyber/pqcrystals-kyber_kyber768_ref/kem.c
|
|
@@ -20,8 +20,7 @@
|
|
*
|
|
* Returns 0 (success)
|
|
**************************************************/
|
|
-int crypto_kem_keypair(uint8_t *pk,
|
|
- uint8_t *sk)
|
|
+int crypto_kem_keypair(uint8_t pk[KYBER_PUBLICKEYBYTES], uint8_t sk[KYBER_SECRETKEYBYTES])
|
|
{
|
|
size_t i;
|
|
indcpa_keypair(pk, sk);
|
|
@@ -48,9 +47,7 @@ int crypto_kem_keypair(uint8_t *pk,
|
|
*
|
|
* Returns 0 (success)
|
|
**************************************************/
|
|
-int crypto_kem_enc(uint8_t *ct,
|
|
- uint8_t *ss,
|
|
- const uint8_t *pk)
|
|
+int crypto_kem_enc(uint8_t ct[KYBER_CIPHERTEXTBYTES], uint8_t ss[KYBER_SSBYTES], const uint8_t pk[KYBER_PUBLICKEYBYTES])
|
|
{
|
|
uint8_t buf[2*KYBER_SYMBYTES];
|
|
/* Will contain key, coins */
|
|
@@ -91,9 +88,7 @@ int crypto_kem_enc(uint8_t *ct,
|
|
*
|
|
* On failure, ss will contain a pseudo-random value.
|
|
**************************************************/
|
|
-int crypto_kem_dec(uint8_t *ss,
|
|
- const uint8_t *ct,
|
|
- const uint8_t *sk)
|
|
+int crypto_kem_dec(uint8_t ss[KYBER_SSBYTES], const uint8_t ct[KYBER_CIPHERTEXTBYTES], const uint8_t sk[KYBER_SECRETKEYBYTES])
|
|
{
|
|
size_t i;
|
|
int fail;
|
|
Index: liboqs-0.8.0/src/kem/kyber/pqcrystals-kyber_kyber1024_ref/kem.c
|
|
===================================================================
|
|
--- liboqs-0.8.0.orig/src/kem/kyber/pqcrystals-kyber_kyber1024_ref/kem.c
|
|
+++ liboqs-0.8.0/src/kem/kyber/pqcrystals-kyber_kyber1024_ref/kem.c
|
|
@@ -20,8 +20,7 @@
|
|
*
|
|
* Returns 0 (success)
|
|
**************************************************/
|
|
-int crypto_kem_keypair(uint8_t *pk,
|
|
- uint8_t *sk)
|
|
+int crypto_kem_keypair(uint8_t pk[KYBER_PUBLICKEYBYTES], uint8_t sk[KYBER_SECRETKEYBYTES])
|
|
{
|
|
size_t i;
|
|
indcpa_keypair(pk, sk);
|
|
@@ -48,9 +47,7 @@ int crypto_kem_keypair(uint8_t *pk,
|
|
*
|
|
* Returns 0 (success)
|
|
**************************************************/
|
|
-int crypto_kem_enc(uint8_t *ct,
|
|
- uint8_t *ss,
|
|
- const uint8_t *pk)
|
|
+int crypto_kem_enc(uint8_t ct[KYBER_CIPHERTEXTBYTES], uint8_t ss[KYBER_SSBYTES], const uint8_t pk[KYBER_PUBLICKEYBYTES])
|
|
{
|
|
uint8_t buf[2*KYBER_SYMBYTES];
|
|
/* Will contain key, coins */
|
|
@@ -91,9 +88,7 @@ int crypto_kem_enc(uint8_t *ct,
|
|
*
|
|
* On failure, ss will contain a pseudo-random value.
|
|
**************************************************/
|
|
-int crypto_kem_dec(uint8_t *ss,
|
|
- const uint8_t *ct,
|
|
- const uint8_t *sk)
|
|
+int crypto_kem_dec(uint8_t ss[KYBER_SSBYTES], const uint8_t ct[KYBER_CIPHERTEXTBYTES], const uint8_t sk[KYBER_SECRETKEYBYTES])
|
|
{
|
|
size_t i;
|
|
int fail;
|