Added new ABI reference hooks. This is round two, more to come.

pull/5420/head
Uriah Pollock 2022-07-28 09:59:41 -05:00
parent 46f423b8b9
commit b200d65a6a
8 changed files with 30 additions and 15 deletions

View File

@ -20790,6 +20790,7 @@ static int wc_EncryptedInfoAppend(char* dest, int destSz, char* cipherInfo)
#ifdef WOLFSSL_DER_TO_PEM
/* Used for compatibility API */
WOLFSSL_ABI
int wc_DerToPem(const byte* der, word32 derSz,
byte* output, word32 outSz, int type)
{
@ -22590,6 +22591,7 @@ static int SetEccPublicKey(byte* output, ecc_key* key, int outLen,
* @return BAD_FUNC_ARG when key or key's parameters is NULL.
* @return MEMORY_E when dynamic memory allocation failed.
*/
WOLFSSL_ABI
int wc_EccPublicKeyToDer(ecc_key* key, byte* output, word32 inLen,
int with_AlgCurve)
{
@ -29043,6 +29045,7 @@ enum {
#define eccKeyASN_Length (sizeof(eccKeyASN) / sizeof(ASNItem))
#endif
WOLFSSL_ABI
int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key,
word32 inSz)
{
@ -29319,6 +29322,7 @@ static int EccKeyParamCopy(char** dst, char* src)
#endif /* !WOLFSSL_ASN_TEMPLATE */
#endif /* WOLFSSL_CUSTOM_CURVES */
WOLFSSL_ABI
int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
ecc_key* key, word32 inSz)
{
@ -29932,6 +29936,7 @@ static int wc_BuildEccKeyDer(ecc_key* key, byte* output, word32 *inLen,
/* Write a Private ecc key, including public to DER format,
* length on success else < 0 */
WOLFSSL_ABI
int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen)
{
return wc_BuildEccKeyDer(key, output, &inLen, 1, 1);

View File

@ -47,6 +47,7 @@ or Authenticated Encryption with Additional Data (AEAD) algorithm.
#endif
#define CHACHA20_POLY1305_AEAD_INITIAL_COUNTER 0
WOLFSSL_ABI
int wc_ChaCha20Poly1305_Encrypt(
const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE],
const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE],
@ -79,6 +80,7 @@ int wc_ChaCha20Poly1305_Encrypt(
return ret;
}
WOLFSSL_ABI
int wc_ChaCha20Poly1305_Decrypt(
const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE],
const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE],

View File

@ -7446,6 +7446,7 @@ int ecc_mul2add(ecc_point* A, mp_int* kA,
key The corresponding public ECC key
return MP_OKAY if successful (even if the signature is not valid)
*/
WOLFSSL_ABI
int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash,
word32 hashlen, int* res, ecc_key* key)
{
@ -8591,6 +8592,7 @@ done:
#endif /* HAVE_COMP_KEY */
/* export public ECC key in ANSI X9.63 format */
WOLFSSL_ABI
int wc_ecc_export_x963(ecc_key* key, byte* out, word32* outLen)
{
int ret = MP_OKAY;
@ -8688,6 +8690,7 @@ done:
/* export public ECC key in ANSI X9.63 format, extended with
* compression option */
WOLFSSL_ABI
int wc_ecc_export_x963_ex(ecc_key* key, byte* out, word32* outLen,
int compressed)
{
@ -9762,6 +9765,7 @@ int wc_ecc_export_ex(ecc_key* key, byte* qx, word32* qxLen,
/* export ecc private key only raw, outLen is in/out size as unsigned bin
return MP_OKAY on success */
WOLFSSL_ABI
int wc_ecc_export_private_only(ecc_key* key, byte* out, word32* outLen)
{
if (out == NULL || outLen == NULL) {
@ -9961,6 +9965,7 @@ int wc_ecc_import_private_key_ex(const byte* priv, word32 privSz,
}
/* ecc private key import, public key in ANSI X9.63 format, private raw */
WOLFSSL_ABI
int wc_ecc_import_private_key(const byte* priv, word32 privSz, const byte* pub,
word32 pubSz, ecc_key* key)
{
@ -9978,6 +9983,7 @@ int wc_ecc_import_private_key(const byte* priv, word32 privSz, const byte* pub,
outlen [in/out] output buffer size, output signature size
return MP_OKAY on success
*/
WOLFSSL_ABI
int wc_ecc_rs_to_sig(const char* r, const char* s, byte* out, word32* outlen)
{
int err;
@ -10353,6 +10359,7 @@ int wc_ecc_import_unsigned(ecc_key* key, const byte* qx, const byte* qy,
curveName ECC curve name, from ecc_sets[]
return MP_OKAY on success
*/
WOLFSSL_ABI
int wc_ecc_import_raw(ecc_key* key, const char* qx, const char* qy,
const char* d, const char* curveName)
{

View File

@ -34,6 +34,7 @@
#endif
#ifndef NO_ERROR_STRINGS
WOLFSSL_ABI
const char* wc_GetErrorString(int error)
{
switch (error) {

View File

@ -613,7 +613,7 @@ WOLFSSL_API void wc_FreeDer(DerBuffer** pDer);
#endif /* WOLFSSL_CERT_GEN */
#ifdef WOLFSSL_DER_TO_PEM
WOLFSSL_API int wc_DerToPem(const byte* der, word32 derSz, byte* output,
WOLFSSL_ABI WOLFSSL_API int wc_DerToPem(const byte* der, word32 derSz, byte* output,
word32 outputSz, int type);
WOLFSSL_API int wc_DerToPemEx(const byte* der, word32 derSz, byte* output,
word32 outputSz, byte *cipherIno, int type);
@ -658,9 +658,9 @@ WOLFSSL_API int wc_DhPrivKeyToDer(DhKey* key, byte* out, word32* outSz);
#ifdef HAVE_ECC
/* private key helpers */
WOLFSSL_API int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx,
WOLFSSL_ABI WOLFSSL_API int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx,
ecc_key* key, word32 inSz);
WOLFSSL_API int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen);
WOLFSSL_ABI WOLFSSL_API int wc_EccKeyToDer(ecc_key* key, byte* output, word32 inLen);
WOLFSSL_API int wc_EccPrivateKeyToDer(ecc_key* key, byte* output,
word32 inLen);
WOLFSSL_API int wc_EccKeyDerSize(ecc_key* key, int pub);
@ -670,9 +670,9 @@ WOLFSSL_API int wc_DhPrivKeyToDer(DhKey* key, byte* out, word32* outSz);
word32* outLen);
/* public key helper */
WOLFSSL_API int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
WOLFSSL_ABI WOLFSSL_API int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
ecc_key* key, word32 inSz);
WOLFSSL_API int wc_EccPublicKeyToDer(ecc_key* key, byte* output,
WOLFSSL_ABI WOLFSSL_API int wc_EccPublicKeyToDer(ecc_key* key, byte* output,
word32 inLen, int with_AlgCurve);
WOLFSSL_API int wc_EccPublicKeyToDer_ex(ecc_key* key, byte* output,
word32 inLen, int with_AlgCurve,

View File

@ -86,7 +86,7 @@ typedef struct ChaChaPoly_Aead {
* concatenating a constant value.
*/
WOLFSSL_API
WOLFSSL_ABI WOLFSSL_API
int wc_ChaCha20Poly1305_Encrypt(
const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE],
const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE],
@ -95,7 +95,7 @@ int wc_ChaCha20Poly1305_Encrypt(
byte* outCiphertext,
byte outAuthTag[CHACHA20_POLY1305_AEAD_AUTHTAG_SIZE]);
WOLFSSL_API
WOLFSSL_ABI WOLFSSL_API
int wc_ChaCha20Poly1305_Decrypt(
const byte inKey[CHACHA20_POLY1305_AEAD_KEYSIZE],
const byte inIV[CHACHA20_POLY1305_AEAD_IV_SIZE],

View File

@ -619,7 +619,7 @@ int wc_ecc_sign_set_k(const byte* k, word32 klen, ecc_key* key);
#endif /* HAVE_ECC_SIGN */
#ifdef HAVE_ECC_VERIFY
WOLFSSL_API
WOLFSSL_ABI WOLFSSL_API
int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash,
word32 hashlen, int* res, ecc_key* key);
WOLFSSL_API
@ -722,9 +722,9 @@ int wc_ecc_mulmod_ex2(const mp_int* k, ecc_point *G, ecc_point *R, mp_int* a,
#ifdef HAVE_ECC_KEY_EXPORT
/* ASN key helpers */
WOLFSSL_API
WOLFSSL_ABI WOLFSSL_API
int wc_ecc_export_x963(ecc_key* key, byte* out, word32* outLen);
WOLFSSL_API
WOLFSSL_ABI WOLFSSL_API
int wc_ecc_export_x963_ex(ecc_key* key, byte* out, word32* outLen,
int compressed);
/* extended functionality with compressed option */
@ -736,13 +736,13 @@ int wc_ecc_import_x963(const byte* in, word32 inLen, ecc_key* key);
WOLFSSL_API
int wc_ecc_import_x963_ex(const byte* in, word32 inLen, ecc_key* key,
int curve_id);
WOLFSSL_API
WOLFSSL_ABI WOLFSSL_API
int wc_ecc_import_private_key(const byte* priv, word32 privSz, const byte* pub,
word32 pubSz, ecc_key* key);
WOLFSSL_API
int wc_ecc_import_private_key_ex(const byte* priv, word32 privSz,
const byte* pub, word32 pubSz, ecc_key* key, int curve_id);
WOLFSSL_API
WOLFSSL_ABI WOLFSSL_API
int wc_ecc_rs_to_sig(const char* r, const char* s, byte* out, word32* outlen);
WOLFSSL_API
int wc_ecc_rs_raw_to_sig(const byte* r, word32 rSz, const byte* s, word32 sSz,
@ -750,7 +750,7 @@ int wc_ecc_rs_raw_to_sig(const byte* r, word32 rSz, const byte* s, word32 sSz,
WOLFSSL_API
int wc_ecc_sig_to_rs(const byte* sig, word32 sigLen, byte* r, word32* rLen,
byte* s, word32* sLen);
WOLFSSL_API
WOLFSSL_ABI WOLFSSL_API
int wc_ecc_import_raw(ecc_key* key, const char* qx, const char* qy,
const char* d, const char* curveName);
WOLFSSL_API
@ -766,7 +766,7 @@ WOLFSSL_API
int wc_ecc_export_ex(ecc_key* key, byte* qx, word32* qxLen,
byte* qy, word32* qyLen, byte* d, word32* dLen,
int encType);
WOLFSSL_API
WOLFSSL_ABI WOLFSSL_API
int wc_ecc_export_private_only(ecc_key* key, byte* out, word32* outLen);
WOLFSSL_API
int wc_ecc_export_public_raw(ecc_key* key, byte* qx, word32* qxLen,

View File

@ -269,7 +269,7 @@ enum {
#else
WOLFSSL_API void wc_ErrorString(int err, char* buff);
WOLFSSL_API const char* wc_GetErrorString(int error);
WOLFSSL_ABI WOLFSSL_API const char* wc_GetErrorString(int error);
#endif
#ifdef __cplusplus