Added ABI macros for managing interface changes

This commit is contained in:
Uriah Pollock
2022-07-27 11:08:32 -05:00
parent 7004157869
commit 46f423b8b9
6 changed files with 24 additions and 10 deletions

View File

@@ -1244,6 +1244,7 @@ int wolfSSL_OCSP_request_add1_nonce(OcspRequest* req, unsigned char* val,
#ifndef HAVE_FIPS #ifndef HAVE_FIPS
wc_InitRng_ex(&rng, req->heap, INVALID_DEVID) wc_InitRng_ex(&rng, req->heap, INVALID_DEVID)
#else #else
WOLFSSL_ABI
wc_InitRng(&rng) wc_InitRng(&rng)
#endif #endif
!= 0) { != 0) {

View File

@@ -4219,6 +4219,7 @@ static void wc_ecc_free_async(ecc_key* key)
outlen [in/out] The max size and resulting size of the shared secret outlen [in/out] The max size and resulting size of the shared secret
return MP_OKAY if successful return MP_OKAY if successful
*/ */
WOLFSSL_ABI
int wc_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, byte* out, int wc_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, byte* out,
word32* outlen) word32* outlen)
{ {
@@ -5438,6 +5439,7 @@ void wc_ecc_key_free(ecc_key* key)
return MP_OKAY if successful, return MP_OKAY if successful,
upon error all allocated memory will be freed upon error all allocated memory will be freed
*/ */
WOLFSSL_ABI
int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key) int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key)
{ {
return wc_ecc_make_key_ex(rng, keysize, key, ECC_CURVE_DEF); return wc_ecc_make_key_ex(rng, keysize, key, ECC_CURVE_DEF);
@@ -5518,6 +5520,7 @@ int wc_ecc_init_ex(ecc_key* key, void* heap, int devId)
return ret; return ret;
} }
WOLFSSL_ABI
int wc_ecc_init(ecc_key* key) int wc_ecc_init(ecc_key* key)
{ {
#ifdef WOLFSSL_QNX_CAAM #ifdef WOLFSSL_QNX_CAAM
@@ -9376,6 +9379,7 @@ static int _ecc_validate_public_key(ecc_key* key, int partial, int priv)
/* perform sanity checks on ecc key validity, 0 on success */ /* perform sanity checks on ecc key validity, 0 on success */
WOLFSSL_ABI
int wc_ecc_check_key(ecc_key* key) int wc_ecc_check_key(ecc_key* key)
{ {
int ret; int ret;
@@ -10394,6 +10398,7 @@ static int ecc_public_key_size(ecc_key* key, word32* sz)
#endif #endif
/* key size in octets */ /* key size in octets */
WOLFSSL_ABI
int wc_ecc_size(ecc_key* key) int wc_ecc_size(ecc_key* key)
{ {
if (key == NULL || key->dp == NULL) if (key == NULL || key->dp == NULL)
@@ -10403,6 +10408,7 @@ int wc_ecc_size(ecc_key* key)
} }
/* maximum signature size based on key size */ /* maximum signature size based on key size */
WOLFSSL_ABI
int wc_ecc_sig_size_calc(int sz) int wc_ecc_sig_size_calc(int sz)
{ {
int maxSigSz = 0; int maxSigSz = 0;
@@ -10420,6 +10426,7 @@ int wc_ecc_sig_size_calc(int sz)
} }
/* maximum signature size based on actual key curve */ /* maximum signature size based on actual key curve */
WOLFSSL_ABI
int wc_ecc_sig_size(const ecc_key* key) int wc_ecc_sig_size(const ecc_key* key)
{ {
int maxSigSz; int maxSigSz;
@@ -12262,6 +12269,7 @@ void wc_ecc_fp_init(void)
/** Free the Fixed Point cache */ /** Free the Fixed Point cache */
WOLFSSL_ABI
void wc_ecc_fp_free(void) void wc_ecc_fp_free(void)
{ {
#if !defined(WOLFSSL_SP_MATH) #if !defined(WOLFSSL_SP_MATH)

View File

@@ -126,6 +126,7 @@ static volatile int initRefCount = 0;
/* Used to initialize state for wolfcrypt /* Used to initialize state for wolfcrypt
return 0 on success return 0 on success
*/ */
WOLFSSL_ABI
int wolfCrypt_Init(void) int wolfCrypt_Init(void)
{ {
int ret = 0; int ret = 0;
@@ -361,6 +362,7 @@ long wolfCrypt_heap_peakBytes_checkpoint(void) {
#endif #endif
/* return success value is the same as wolfCrypt_Init */ /* return success value is the same as wolfCrypt_Init */
WOLFSSL_ABI
int wolfCrypt_Cleanup(void) int wolfCrypt_Cleanup(void)
{ {
int ret = 0; int ret = 0;

View File

@@ -558,7 +558,7 @@ WOLFSSL_LOCAL
int ecc_projective_dbl_point_safe(ecc_point* P, ecc_point* R, mp_int* a, int ecc_projective_dbl_point_safe(ecc_point* P, ecc_point* R, mp_int* a,
mp_int* modulus, mp_digit mp); mp_int* modulus, mp_digit mp);
WOLFSSL_API WOLFSSL_ABI WOLFSSL_API
int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key); int wc_ecc_make_key(WC_RNG* rng, int keysize, ecc_key* key);
WOLFSSL_ABI WOLFSSL_API WOLFSSL_ABI WOLFSSL_API
int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id); int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id);
@@ -569,7 +569,7 @@ WOLFSSL_API
int wc_ecc_make_pub(ecc_key* key, ecc_point* pubOut); int wc_ecc_make_pub(ecc_key* key, ecc_point* pubOut);
WOLFSSL_API WOLFSSL_API
int wc_ecc_make_pub_ex(ecc_key* key, ecc_point* pubOut, WC_RNG* rng); int wc_ecc_make_pub_ex(ecc_key* key, ecc_point* pubOut, WC_RNG* rng);
WOLFSSL_API WOLFSSL_ABI WOLFSSL_API
int wc_ecc_check_key(ecc_key* key); int wc_ecc_check_key(ecc_key* key);
WOLFSSL_API WOLFSSL_API
int wc_ecc_is_point(ecc_point* ecp, mp_int* a, mp_int* b, mp_int* prime); int wc_ecc_is_point(ecc_point* ecp, mp_int* a, mp_int* b, mp_int* prime);
@@ -577,7 +577,7 @@ WOLFSSL_API
int wc_ecc_get_generator(ecc_point* ecp, int curve_idx); int wc_ecc_get_generator(ecc_point* ecp, int curve_idx);
#ifdef HAVE_ECC_DHE #ifdef HAVE_ECC_DHE
WOLFSSL_API WOLFSSL_ABI WOLFSSL_API
int wc_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, byte* out, int wc_ecc_shared_secret(ecc_key* private_key, ecc_key* public_key, byte* out,
word32* outlen); word32* outlen);
WOLFSSL_LOCAL WOLFSSL_LOCAL
@@ -646,7 +646,7 @@ WOLFSSL_ABI WOLFSSL_API
int wc_ecc_free(ecc_key* key); int wc_ecc_free(ecc_key* key);
WOLFSSL_API WOLFSSL_API
int wc_ecc_set_flags(ecc_key* key, word32 flags); int wc_ecc_set_flags(ecc_key* key, word32 flags);
WOLFSSL_API WOLFSSL_ABI WOLFSSL_API
void wc_ecc_fp_free(void); void wc_ecc_fp_free(void);
WOLFSSL_LOCAL WOLFSSL_LOCAL
void wc_ecc_fp_init(void); void wc_ecc_fp_init(void);
@@ -800,11 +800,11 @@ int wc_ecc_import_point_der(const byte* in, word32 inLen, const int curve_idx,
#endif /* HAVE_ECC_KEY_IMPORT */ #endif /* HAVE_ECC_KEY_IMPORT */
/* size helper */ /* size helper */
WOLFSSL_API WOLFSSL_ABI WOLFSSL_API
int wc_ecc_size(ecc_key* key); int wc_ecc_size(ecc_key* key);
WOLFSSL_API WOLFSSL_ABI WOLFSSL_API
int wc_ecc_sig_size_calc(int sz); int wc_ecc_sig_size_calc(int sz);
WOLFSSL_API WOLFSSL_ABI WOLFSSL_API
int wc_ecc_sig_size(const ecc_key* key); int wc_ecc_sig_size(const ecc_key* key);
WOLFSSL_API WOLFSSL_API

View File

@@ -216,7 +216,7 @@ WOLFSSL_ABI WOLFSSL_API void wc_rng_free(WC_RNG* rng);
#ifndef WC_NO_RNG #ifndef WC_NO_RNG
WOLFSSL_API int wc_InitRng(WC_RNG* rng); WOLFSSL_ABI WOLFSSL_API int wc_InitRng(WC_RNG* rng);
WOLFSSL_API int wc_InitRng_ex(WC_RNG* rng, void* heap, int devId); WOLFSSL_API int wc_InitRng_ex(WC_RNG* rng, void* heap, int devId);
WOLFSSL_API int wc_InitRngNonce(WC_RNG* rng, byte* nonce, word32 nonceSz); WOLFSSL_API int wc_InitRngNonce(WC_RNG* rng, byte* nonce, word32 nonceSz);
WOLFSSL_API int wc_InitRngNonce_ex(WC_RNG* rng, byte* nonce, word32 nonceSz, WOLFSSL_API int wc_InitRngNonce_ex(WC_RNG* rng, byte* nonce, word32 nonceSz,

View File

@@ -358,9 +358,12 @@ WOLFSSL_API int wc_LockMutex_ex(int flag, int type, const char* file, int line);
WOLFSSL_API int wc_SetMutexCb(mutex_cb* cb); WOLFSSL_API int wc_SetMutexCb(mutex_cb* cb);
#endif #endif
#define WOLFSSL_ABI
/* TODO: Fix this. The above is a hack for now - UP */
/* main crypto initialization function */ /* main crypto initialization function */
WOLFSSL_API int wolfCrypt_Init(void); WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Init(void);
WOLFSSL_API int wolfCrypt_Cleanup(void); WOLFSSL_ABI WOLFSSL_API int wolfCrypt_Cleanup(void);
#ifdef WOLFSSL_TRACK_MEMORY_VERBOSE #ifdef WOLFSSL_TRACK_MEMORY_VERBOSE
WOLFSSL_API long wolfCrypt_heap_peakAllocs_checkpoint(void); WOLFSSL_API long wolfCrypt_heap_peakAllocs_checkpoint(void);