From 5905f9289dcb8c08f0b3f5b77f7f3ce3aaf8b4ca Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Wed, 1 May 2024 13:58:57 -0500 Subject: [PATCH] fix namespace collision: rename types read_private_key_cb and write_private_key_cb to wc_{lms,xmss}_read_private_key_cb and wc_{lms,xmss}_write_private_key_cb. --- wolfcrypt/src/ext_lms.c | 4 ++-- wolfcrypt/src/ext_xmss.c | 4 ++-- wolfssl/wolfcrypt/ext_lms.h | 4 ++-- wolfssl/wolfcrypt/ext_xmss.h | 4 ++-- wolfssl/wolfcrypt/lms.h | 8 ++++---- wolfssl/wolfcrypt/xmss.h | 8 ++++---- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/wolfcrypt/src/ext_lms.c b/wolfcrypt/src/ext_lms.c index 9c64d3544a..7a59576672 100644 --- a/wolfcrypt/src/ext_lms.c +++ b/wolfcrypt/src/ext_lms.c @@ -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; @@ -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; diff --git a/wolfcrypt/src/ext_xmss.c b/wolfcrypt/src/ext_xmss.c index 84498d9a37..9ce012e255 100644 --- a/wolfcrypt/src/ext_xmss.c +++ b/wolfcrypt/src/ext_xmss.c @@ -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; @@ -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; diff --git a/wolfssl/wolfcrypt/ext_lms.h b/wolfssl/wolfcrypt/ext_lms.h index ccdfdcb30e..fae812fd1a 100644 --- a/wolfssl/wolfcrypt/ext_lms.h +++ b/wolfssl/wolfcrypt/ext_lms.h @@ -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 */ diff --git a/wolfssl/wolfcrypt/ext_xmss.h b/wolfssl/wolfcrypt/ext_xmss.h index 9abf15835e..5f51bf54dd 100644 --- a/wolfssl/wolfcrypt/ext_xmss.h +++ b/wolfssl/wolfcrypt/ext_xmss.h @@ -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; diff --git a/wolfssl/wolfcrypt/lms.h b/wolfssl/wolfcrypt/lms.h index b4e7e0a468..fe87388f26 100644 --- a/wolfssl/wolfcrypt/lms.h +++ b/wolfssl/wolfcrypt/lms.h @@ -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 { @@ -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); diff --git a/wolfssl/wolfcrypt/xmss.h b/wolfssl/wolfcrypt/xmss.h index 7f19aee2bf..37aab34d00 100644 --- a/wolfssl/wolfcrypt/xmss.h +++ b/wolfssl/wolfcrypt/xmss.h @@ -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 @@ -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);