From 3179a2ff003e1225747573144e2b3be39e45295c Mon Sep 17 00:00:00 2001 From: David Garske Date: Tue, 5 Nov 2024 14:14:25 -0800 Subject: [PATCH] Cleanup the import function declarations. --- wolfcrypt/src/port/Renesas/renesas_tsip_rsa.c | 4 +-- .../src/port/Renesas/renesas_tsip_util.c | 26 +++++++++---------- .../port/Renesas/renesas-tsip-crypt.h | 4 +++ 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/wolfcrypt/src/port/Renesas/renesas_tsip_rsa.c b/wolfcrypt/src/port/Renesas/renesas_tsip_rsa.c index 49fd08d6b..ae1f3aa78 100644 --- a/wolfcrypt/src/port/Renesas/renesas_tsip_rsa.c +++ b/wolfcrypt/src/port/Renesas/renesas_tsip_rsa.c @@ -180,7 +180,7 @@ static int tsip_RsakeyImport(TsipUserCtx* tuc) switch (tuc->wrappedKeyType) { case TSIP_KEY_TYPE_RSA1024: if (tuc->keyflgs_crypt.bits.rsapub1024_key_set != 1) { - ret = tsipImportPublicKey(tuc, tuc->wrappedKeyType); + ret = tsip_ImportPublicKey(tuc, tuc->wrappedKeyType); WOLFSSL_MSG("tsip rsa private key 1024 not set"); if (ret != 0) @@ -190,7 +190,7 @@ static int tsip_RsakeyImport(TsipUserCtx* tuc) break; case TSIP_KEY_TYPE_RSA2048: if (tuc->keyflgs_crypt.bits.rsapub2048_key_set != 1) { - ret = tsipImportPublicKey(tuc, tuc->wrappedKeyType); + ret = tsip_ImportPublicKey(tuc, tuc->wrappedKeyType); WOLFSSL_MSG("tsip rsa private key 2048 not set"); if (ret != 0) diff --git a/wolfcrypt/src/port/Renesas/renesas_tsip_util.c b/wolfcrypt/src/port/Renesas/renesas_tsip_util.c index 2746ed8d5..102418f99 100644 --- a/wolfcrypt/src/port/Renesas/renesas_tsip_util.c +++ b/wolfcrypt/src/port/Renesas/renesas_tsip_util.c @@ -1679,7 +1679,7 @@ WOLFSSL_LOCAL int tsip_Tls13SendCertVerify(WOLFSSL* ssl) } if (ret == 0) { - ret = tsipImportPrivateKey(tuc, tuc->wrappedKeyType); + ret = tsip_ImportPrivateKey(tuc, tuc->wrappedKeyType); } if (ret == 0) { @@ -1749,11 +1749,11 @@ WOLFSSL_LOCAL int tsip_Tls13SendCertVerify(WOLFSSL* ssl) if (ret == 0) { if (isRsa) { - ret = tsipImportPublicKey(tuc, tuc->wrappedKeyType); + ret = tsip_ImportPublicKey(tuc, tuc->wrappedKeyType); } else { #if defined(WOLFSSL_CHECK_SIG_FAULTS) - ret = tsipImportPublicKey(tuc, tuc->wrappedKeyType); + ret = tsip_ImportPublicKey(tuc, tuc->wrappedKeyType); #endif } } @@ -2301,7 +2301,7 @@ static byte _tls2tsipdef(byte cipher) * TSIP_KEY_TYPE_ECDSAP256 ecdsa p256r1 key * TSIP_KEY_TYPE_ECDSAP384 ecdsa p384r1 key */ -static int tsipImportPrivateKey(TsipUserCtx* tuc, int keyType) +int tsip_ImportPrivateKey(TsipUserCtx* tuc, int keyType) { int ret = 0; e_tsip_err_t err = TSIP_SUCCESS; @@ -2309,7 +2309,7 @@ static int tsipImportPrivateKey(TsipUserCtx* tuc, int keyType) uint8_t* iv = g_user_key_info.iv; uint8_t* encPrivKey; - WOLFSSL_ENTER("tsipImportPrivateKey"); + WOLFSSL_ENTER("tsip_ImportPrivateKey"); if (tuc == NULL) return BAD_FUNC_ARG; @@ -2377,7 +2377,7 @@ static int tsipImportPrivateKey(TsipUserCtx* tuc, int keyType) else { WOLFSSL_MSG("mutex locking error"); } - WOLFSSL_LEAVE("tsipImportPrivateKey", ret); + WOLFSSL_LEAVE("tsip_ImportPrivateKey", ret); return ret; } @@ -2393,7 +2393,7 @@ static int tsipImportPrivateKey(TsipUserCtx* tuc, int keyType) * TSIP_KEY_TYPE_ECDSAP256 ecdsa p256r1 key * TSIP_KEY_TYPE_ECDSAP384 ecdsa p384r1 key */ -WOLFSSL_LOCAL int tsipImportPublicKey(TsipUserCtx* tuc, int keyType) +WOLFSSL_LOCAL int tsip_ImportPublicKey(TsipUserCtx* tuc, int keyType) { int ret = 0; e_tsip_err_t err = TSIP_SUCCESS; @@ -2401,7 +2401,7 @@ WOLFSSL_LOCAL int tsipImportPublicKey(TsipUserCtx* tuc, int keyType) uint8_t* iv = g_user_key_info.iv; uint8_t* encPubKey; - WOLFSSL_ENTER("tsipImportPublicKey"); + WOLFSSL_ENTER("tsip_ImportPublicKey"); if (tuc == NULL ) { return BAD_FUNC_ARG; @@ -2515,7 +2515,7 @@ WOLFSSL_LOCAL int tsipImportPublicKey(TsipUserCtx* tuc, int keyType) else { WOLFSSL_MSG("mutex locking error"); } - WOLFSSL_LEAVE("tsipImportPublicKey", ret); + WOLFSSL_LEAVE("tsip_ImportPublicKey", ret); return ret; } @@ -3676,7 +3676,7 @@ WOLFSSL_LOCAL int tsip_SignRsaPkcs(wc_CryptoInfo* info, TsipUserCtx* tuc) if (ret == 0) { /* import private key_index from wrapped key */ - ret = tsipImportPrivateKey(tuc, tuc->wrappedKeyType); + ret = tsip_ImportPrivateKey(tuc, tuc->wrappedKeyType); } if (ret == 0) { @@ -3825,7 +3825,7 @@ WOLFSSL_LOCAL int tsip_VerifyRsaPkcsCb( if (ret == 0) { /* import public key_index from wrapped key */ - ret = tsipImportPublicKey(tuc, tuc->wrappedKeyType); + ret = tsip_ImportPublicKey(tuc, tuc->wrappedKeyType); } if (ret == 0) { @@ -3935,7 +3935,7 @@ WOLFSSL_LOCAL int tsip_SignEcdsa(wc_CryptoInfo* info, TsipUserCtx* tuc) if (ret == 0) { /* import private key_index from wrapped key */ - ret = tsipImportPrivateKey(tuc, tuc->wrappedKeyType); + ret = tsip_ImportPrivateKey(tuc, tuc->wrappedKeyType); } if (ret == 0) { @@ -4061,7 +4061,7 @@ WOLFSSL_LOCAL int tsip_VerifyEcdsa(wc_CryptoInfo* info, TsipUserCtx* tuc) if (ret == 0) { /* import public key_index from wrapped key */ - ret = tsipImportPublicKey(tuc, tuc->wrappedKeyType); + ret = tsip_ImportPublicKey(tuc, tuc->wrappedKeyType); } if (ret == 0) { diff --git a/wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h b/wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h index e21a4467b..05132dc9e 100644 --- a/wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h +++ b/wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h @@ -379,6 +379,10 @@ WOLFSSL_API int tsip_set_callback_ctx(struct WOLFSSL* ssl, void* user_ctx); WOLFSSL_API int tsip_set_clientPrivateKeyEnc(const byte* key, int keyType); + +WOLFSSL_LOCAL int tsip_ImportPublicKey(TsipUserCtx* tuc, int keyType); +WOLFSSL_LOCAL int tsip_ImportPrivateKey(TsipUserCtx* tuc, int keyType); + #if defined(WOLF_PRIVATE_KEY_ID) #if defined(WOLFSSL_RENESAS_TSIP_TLS)