Skip to content

Commit

Permalink
Merge pull request #7497 from douzzer/20240501-fix-pqcrypto-private_k…
Browse files Browse the repository at this point in the history
…ey-callback-names

20240501-fix-pqcrypto-private_key-callback-names
  • Loading branch information
philljj authored May 1, 2024
2 parents ba89e07 + 5905f92 commit b61a6ba
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions wolfcrypt/src/ext_lms.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ void wc_LmsKey_Free(LmsKey* key)
*
* Returns 0 on success.
* */
int wc_LmsKey_SetWriteCb(LmsKey * key, write_private_key_cb write_cb)
int wc_LmsKey_SetWriteCb(LmsKey * key, wc_lms_write_private_key_cb write_cb)
{
if (key == NULL || write_cb == NULL) {
return BAD_FUNC_ARG;
Expand All @@ -610,7 +610,7 @@ int wc_LmsKey_SetWriteCb(LmsKey * key, write_private_key_cb write_cb)
*
* Returns 0 on success.
* */
int wc_LmsKey_SetReadCb(LmsKey * key, read_private_key_cb read_cb)
int wc_LmsKey_SetReadCb(LmsKey * key, wc_lms_read_private_key_cb read_cb)
{
if (key == NULL || read_cb == NULL) {
return BAD_FUNC_ARG;
Expand Down
4 changes: 2 additions & 2 deletions wolfcrypt/src/ext_xmss.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ void wc_XmssKey_Free(XmssKey* key)
* returns BAD_FUNC_ARG when a parameter is NULL.
* returns -1 on failure.
* */
int wc_XmssKey_SetWriteCb(XmssKey * key, write_private_key_cb write_cb)
int wc_XmssKey_SetWriteCb(XmssKey * key, wc_xmss_write_private_key_cb write_cb)
{
if (key == NULL || write_cb == NULL) {
return BAD_FUNC_ARG;
Expand Down Expand Up @@ -336,7 +336,7 @@ int wc_XmssKey_SetWriteCb(XmssKey * key, write_private_key_cb write_cb)
* returns BAD_FUNC_ARG when a parameter is NULL.
* returns -1 on failure.
* */
int wc_XmssKey_SetReadCb(XmssKey * key, read_private_key_cb read_cb)
int wc_XmssKey_SetReadCb(XmssKey * key, wc_xmss_read_private_key_cb read_cb)
{
if (key == NULL || read_cb == NULL) {
return BAD_FUNC_ARG;
Expand Down
4 changes: 2 additions & 2 deletions wolfssl/wolfcrypt/ext_lms.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ struct LmsKey {
unsigned char pub[HSS_MAX_PUBLIC_KEY_LEN];
#ifndef WOLFSSL_LMS_VERIFY_ONLY
hss_working_key * working_key;
write_private_key_cb write_private_key; /* Callback to write/update key. */
read_private_key_cb read_private_key; /* Callback to read key. */
wc_lms_write_private_key_cb write_private_key; /* Callback to write/update key. */
wc_lms_read_private_key_cb read_private_key; /* Callback to read key. */
void * context; /* Context arg passed to callbacks. */
hss_extra_info info;
#endif /* ifndef WOLFSSL_LMS_VERIFY_ONLY */
Expand Down
4 changes: 2 additions & 2 deletions wolfssl/wolfcrypt/ext_xmss.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ struct XmssKey {
/* The secret key length is a function of xmss_params. */
unsigned char * sk;
word32 sk_len;
write_private_key_cb write_private_key; /* Callback to write/update key. */
read_private_key_cb read_private_key; /* Callback to read key. */
wc_xmss_write_private_key_cb write_private_key; /* Callback to write/update key. */
wc_xmss_read_private_key_cb read_private_key; /* Callback to read key. */
void * context; /* Context arg passed to callbacks. */
#endif /* ifndef WOLFSSL_XMSS_VERIFY_ONLY */
enum wc_XmssState state;
Expand Down
8 changes: 4 additions & 4 deletions wolfssl/wolfcrypt/lms.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
typedef struct LmsKey LmsKey;

/* Private key write and read callbacks. */
typedef int (*write_private_key_cb)(const byte * priv, word32 privSz, void *context);
typedef int (*read_private_key_cb)(byte * priv, word32 privSz, void *context);
typedef int (*wc_lms_write_private_key_cb)(const byte * priv, word32 privSz, void *context);
typedef int (*wc_lms_read_private_key_cb)(byte * priv, word32 privSz, void *context);

/* Return codes returned by private key callbacks. */
enum wc_LmsRc {
Expand Down Expand Up @@ -138,9 +138,9 @@ WOLFSSL_API int wc_LmsKey_GetParameters(const LmsKey * key, int * levels,
int * height, int * winternitz);
#ifndef WOLFSSL_LMS_VERIFY_ONLY
WOLFSSL_API int wc_LmsKey_SetWriteCb(LmsKey * key,
write_private_key_cb write_cb);
wc_lms_write_private_key_cb write_cb);
WOLFSSL_API int wc_LmsKey_SetReadCb(LmsKey * key,
read_private_key_cb read_cb);
wc_lms_read_private_key_cb read_cb);
WOLFSSL_API int wc_LmsKey_SetContext(LmsKey * key, void * context);
WOLFSSL_API int wc_LmsKey_MakeKey(LmsKey * key, WC_RNG * rng);
WOLFSSL_API int wc_LmsKey_Reload(LmsKey * key);
Expand Down
8 changes: 4 additions & 4 deletions wolfssl/wolfcrypt/xmss.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ enum wc_XmssState {
};

/* Private key write and read callbacks. */
typedef enum wc_XmssRc (*write_private_key_cb)(const byte* priv, word32 privSz,
typedef enum wc_XmssRc (*wc_xmss_write_private_key_cb)(const byte* priv, word32 privSz,
void* context);
typedef enum wc_XmssRc (*read_private_key_cb)(byte* priv, word32 privSz,
typedef enum wc_XmssRc (*wc_xmss_read_private_key_cb)(byte* priv, word32 privSz,
void* context);

#ifdef __cplusplus
Expand All @@ -173,9 +173,9 @@ WOLFSSL_API int wc_XmssKey_Init(XmssKey* key, void* heap, int devId);
WOLFSSL_API int wc_XmssKey_SetParamStr(XmssKey* key, const char* str);
#ifndef WOLFSSL_XMSS_VERIFY_ONLY
WOLFSSL_API int wc_XmssKey_SetWriteCb(XmssKey* key,
write_private_key_cb write_cb);
wc_xmss_write_private_key_cb write_cb);
WOLFSSL_API int wc_XmssKey_SetReadCb(XmssKey* key,
read_private_key_cb read_cb);
wc_xmss_read_private_key_cb read_cb);
WOLFSSL_API int wc_XmssKey_SetContext(XmssKey* key, void* context);
WOLFSSL_API int wc_XmssKey_MakeKey(XmssKey* key, WC_RNG* rng);
WOLFSSL_API int wc_XmssKey_Reload(XmssKey* key);
Expand Down

0 comments on commit b61a6ba

Please sign in to comment.