forked from pool/liboqs
* Key encapsulation mechanisms: - HQC: Disabled compiler optimizations to avoid secret-dependent branching in certain configurations. HQC remains disabled by default. - ML-KEM: Updated the default ML-KEM implementation to [PQCP's mlkem-native v1.0.0](https://github.com/pq-code-package/mlkem-native/releases/tag/v1.0.0). * Digital signature schemes: - New API: added an API function to check if a signature scheme supports signing with a context string. - SNOVA: added [SNOVA](https://snova.pqclab.org/) from NIST Additional Signature Schemes Round 2. * Other changes: - Added an AVX512VL-optimized backend for SHA3. - Improved memory management throughout the codebase. - CVE-2025-52473: Disabled compiler optimizations for HQC to avoid secret-dependent branches. Thank you to Zhenzhi Lai and Zhiyuan Zhang from from the University of Melbourne and the Max Planck Institute for Security and Privacy for identifying the issue. (bsc#1246301) - new major library version liboqs.so.8 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/liboqs?expand=0&rev=36
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;
|