Skip to content

Commit ffd1bbc

Browse files
TJ-91antonsviridenko
authored andcommitted
address review comments
1 parent 8ce74df commit ffd1bbc

File tree

12 files changed

+55
-26
lines changed

12 files changed

+55
-26
lines changed

CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,15 @@ tristate_feature_auto(ENABLE_CAST5 "Enable CAST5 cipher support.")
8080
tristate_feature_auto(ENABLE_RIPEMD160 "Enable RIPEMD-160 hash support.")
8181

8282
option(ENABLE_CRYPTO_REFRESH "Enable crypto-refresh support (v6)")
83-
option(ENABLE_PQC "Enable PQC support - requires ENABLE_CRYPTO_REFRESH")
84-
option(ENABLE_PQC_MLKEM_IPD "Use ML-KEM-ipd instead of Kyber")
85-
option(ENABLE_PQC_DBG_LOG "If enabled, logs intermediate values of computations. Used for debugging, do not enable for productive use.")
83+
option(ENABLE_PQC "Enable PQC support")
84+
85+
# Note: The following two flags are only temporary and will be removed once POC is in a stable state
86+
if (DEFINED ENABLE_PQC_MLKEM_IPD)
87+
add_definitions(-DENABLE_PQC_MLKEM_IPD)
88+
endif()
89+
if (DEFINED ENABLE_PQC_DBG_LOG)
90+
add_definitions(-DENABLE_PQC_DBG_LOG)
91+
endif()
8692

8793
set(ENABLE_DOC Auto CACHE STRING "Enable building documentation.")
8894
set_property(CACHE ENABLE_DOC PROPERTY STRINGS ${TRISTATE_VALUES})

include/rnp/rnp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,7 @@ RNP_API rnp_result_t rnp_key_get_default_key(rnp_key_handle_t primary_key,
19481948
*/
19491949
RNP_API rnp_result_t rnp_key_get_alg(rnp_key_handle_t key, char **alg);
19501950

1951+
#if defined(RNP_EXPERIMENTAL_PQC)
19511952
/** Get a SPHINCS+ key's parameter string
19521953
*
19531954
* @param key key handle
@@ -1958,6 +1959,7 @@ RNP_API rnp_result_t rnp_key_get_alg(rnp_key_handle_t key, char **alg);
19581959
* time.
19591960
*/
19601961
RNP_API rnp_result_t rnp_key_sphincsplus_get_param(rnp_key_handle_t handle, char **param);
1962+
#endif
19611963

19621964
/** Get number of bits in the key. For EC-based keys it will return size of the curve.
19631965
*

src/lib/config.h.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@
6363
#cmakedefine ENABLE_IDEA
6464
#cmakedefine ENABLE_CRYPTO_REFRESH
6565
#cmakedefine ENABLE_PQC
66-
#cmakedefine ENABLE_PQC_MLKEM_IPD
67-
#cmakedefine ENABLE_PQC_DBG_LOG
6866
#cmakedefine ENABLE_BLOWFISH
6967
#cmakedefine ENABLE_CAST5
7068
#cmakedefine ENABLE_RIPEMD160

src/lib/logging.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,4 @@ class LogStop {
124124
} while (0)
125125
#endif
126126

127-
#endif
127+
#endif

src/lib/rnp.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6793,10 +6793,10 @@ try {
67936793
}
67946794
FFI_GUARD
67956795

6796+
#if defined(RNP_EXPERIMENTAL_PQC)
67966797
rnp_result_t
67976798
rnp_key_sphincsplus_get_param(rnp_key_handle_t handle, char **param)
67986799
try {
6799-
#if defined(ENABLE_PQC)
68006800
if (!handle || !param) {
68016801
return RNP_ERROR_NULL_POINTER;
68026802
}
@@ -6807,11 +6807,9 @@ try {
68076807

68086808
return get_map_value(
68096809
sphincsplus_params_map, key->material().sphincsplus.pub.param(), param);
6810-
#else
6811-
return RNP_ERROR_NOT_IMPLEMENTED;
6812-
#endif
68136810
}
68146811
FFI_GUARD
6812+
#endif
68156813

68166814
rnp_result_t
68176815
rnp_key_get_bits(rnp_key_handle_t handle, uint32_t *bits)

src/lib/types.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ typedef struct pgp_sig_subpkt_t {
294294
} preferred; /* 5.2.3.7. Preferred Symmetric Algorithms */
295295
/* 5.2.3.8. Preferred Hash Algorithms */
296296
/* 5.2.3.9. Preferred Compression Algorithms */
297-
/* Crypto Refresh 5.2.3.15. Preferred AEAD Ciphersuites */
298297
struct {
299298
uint8_t revclass;
300299
pgp_pubkey_alg_t pkalg;

src/librepgp/stream-parse.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,10 +1519,15 @@ do_enforce_aes_v3pkesk(pgp_pubkey_alg_t alg)
15191519
switch (alg) {
15201520
#if defined(ENABLE_PQC)
15211521
case PGP_PKA_KYBER768_X25519:
1522+
FALLTHROUGH_STATEMENT;
15221523
case PGP_PKA_KYBER768_P256:
1524+
FALLTHROUGH_STATEMENT;
15231525
case PGP_PKA_KYBER1024_P384:
1526+
FALLTHROUGH_STATEMENT;
15241527
case PGP_PKA_KYBER768_BP256:
1528+
FALLTHROUGH_STATEMENT;
15251529
case PGP_PKA_KYBER1024_BP384:
1530+
FALLTHROUGH_STATEMENT;
15261531
#endif
15271532
#if defined(ENABLE_CRYPTO_REFRESH)
15281533
case PGP_PKA_X25519:

src/rnp/fficli.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ ffi_pass_callback_stdin(rnp_ffi_t ffi,
420420
}
421421

422422
rnp->reuse_password_for_subkey--;
423-
if (rnp->reuse_password_for_subkey == 0) {
423+
if (!rnp->reuse_password_for_subkey) {
424424
rnp_buffer_clear(rnp->reused_password, strnlen(rnp->reused_password, buf_len));
425425
free(rnp->reused_password);
426426
rnp->reused_password = NULL;

src/rnp/rnpcfg.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,28 @@
115115
#define CFG_KG_SUBKEY_BITS "kg-subkey-bits"
116116
#define CFG_KG_SUBKEY_CURVE "kg-subkey-curve"
117117
#define CFG_KG_SUBKEY_EXPIRATION "kg-subkey-expiration"
118+
#if defined(ENABLE_PQC)
118119
#define CFG_KG_SUBKEY_2_ALG "kg-subkey-2-alg"
119120
#define CFG_KG_SUBKEY_2_BITS "kg-subkey-2-bits"
120121
#define CFG_KG_SUBKEY_2_CURVE "kg-subkey-2-curve"
121122
#define CFG_KG_SUBKEY_2_EXPIRATION "kg-subkey-2-expiration"
123+
#endif
122124
#define CFG_KG_HASH "kg-hash"
123125
#define CFG_KG_PROT_HASH "kg-prot-hash"
124126
#define CFG_KG_PROT_ALG "kg-prot-alg"
125127
#define CFG_KG_PROT_ITERATIONS "kg-prot-iterations"
128+
#if defined(ENABLE_CRYPTO_REFRESH)
126129
#define CFG_KG_V6_KEY \
127130
"kg-v6-key" /* represents a boolean property: non-empty string means 'true' */
131+
#endif
132+
#if defined(ENABLE_PQC)
128133
#define CFG_KG_PRIMARY_SPHINCSPLUS_PARAM \
129134
"kg-primary-sphincsplus-param" /* 128f, 128s, 192f, 192s, 256f, 256s */
130135
#define CFG_KG_SUBKEY_SPHINCSPLUS_PARAM \
131136
"kg-subkey-sphincsplus-param" /* 128f, 128s, 192f, 192s, 256f, 256s */
132137
#define CFG_KG_SUBKEY_2_SPHINCSPLUS_PARAM \
133138
"kg-subkey-2-sphincsplus-param" /* 128f, 128s, 192f, 192s, 256f, 256s */
139+
#endif
134140

135141
/* rnp CLI config : contains all the system-dependent and specified by the user configuration
136142
* options */

src/rnpkeys/tui.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#endif
3333
#include <errno.h>
3434
#include <iterator>
35+
#include "config.h"
3536
#include "rnp/rnpcfg.h"
3637
#include "rnpkeys.h"
3738
#include "defaults.h"

0 commit comments

Comments
 (0)