Cleanup the import function declarations.

This commit is contained in:
David Garske
2024-11-05 14:14:25 -08:00
parent 02c2f445d9
commit 3179a2ff00
3 changed files with 19 additions and 15 deletions

View File

@@ -180,7 +180,7 @@ static int tsip_RsakeyImport(TsipUserCtx* tuc)
switch (tuc->wrappedKeyType) { switch (tuc->wrappedKeyType) {
case TSIP_KEY_TYPE_RSA1024: case TSIP_KEY_TYPE_RSA1024:
if (tuc->keyflgs_crypt.bits.rsapub1024_key_set != 1) { 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"); WOLFSSL_MSG("tsip rsa private key 1024 not set");
if (ret != 0) if (ret != 0)
@@ -190,7 +190,7 @@ static int tsip_RsakeyImport(TsipUserCtx* tuc)
break; break;
case TSIP_KEY_TYPE_RSA2048: case TSIP_KEY_TYPE_RSA2048:
if (tuc->keyflgs_crypt.bits.rsapub2048_key_set != 1) { 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"); WOLFSSL_MSG("tsip rsa private key 2048 not set");
if (ret != 0) if (ret != 0)

View File

@@ -1679,7 +1679,7 @@ WOLFSSL_LOCAL int tsip_Tls13SendCertVerify(WOLFSSL* ssl)
} }
if (ret == 0) { if (ret == 0) {
ret = tsipImportPrivateKey(tuc, tuc->wrappedKeyType); ret = tsip_ImportPrivateKey(tuc, tuc->wrappedKeyType);
} }
if (ret == 0) { if (ret == 0) {
@@ -1749,11 +1749,11 @@ WOLFSSL_LOCAL int tsip_Tls13SendCertVerify(WOLFSSL* ssl)
if (ret == 0) { if (ret == 0) {
if (isRsa) { if (isRsa) {
ret = tsipImportPublicKey(tuc, tuc->wrappedKeyType); ret = tsip_ImportPublicKey(tuc, tuc->wrappedKeyType);
} }
else { else {
#if defined(WOLFSSL_CHECK_SIG_FAULTS) #if defined(WOLFSSL_CHECK_SIG_FAULTS)
ret = tsipImportPublicKey(tuc, tuc->wrappedKeyType); ret = tsip_ImportPublicKey(tuc, tuc->wrappedKeyType);
#endif #endif
} }
} }
@@ -2301,7 +2301,7 @@ static byte _tls2tsipdef(byte cipher)
* TSIP_KEY_TYPE_ECDSAP256 ecdsa p256r1 key * TSIP_KEY_TYPE_ECDSAP256 ecdsa p256r1 key
* TSIP_KEY_TYPE_ECDSAP384 ecdsa p384r1 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; int ret = 0;
e_tsip_err_t err = TSIP_SUCCESS; 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* iv = g_user_key_info.iv;
uint8_t* encPrivKey; uint8_t* encPrivKey;
WOLFSSL_ENTER("tsipImportPrivateKey"); WOLFSSL_ENTER("tsip_ImportPrivateKey");
if (tuc == NULL) if (tuc == NULL)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
@@ -2377,7 +2377,7 @@ static int tsipImportPrivateKey(TsipUserCtx* tuc, int keyType)
else { else {
WOLFSSL_MSG("mutex locking error"); WOLFSSL_MSG("mutex locking error");
} }
WOLFSSL_LEAVE("tsipImportPrivateKey", ret); WOLFSSL_LEAVE("tsip_ImportPrivateKey", ret);
return ret; return ret;
} }
@@ -2393,7 +2393,7 @@ static int tsipImportPrivateKey(TsipUserCtx* tuc, int keyType)
* TSIP_KEY_TYPE_ECDSAP256 ecdsa p256r1 key * TSIP_KEY_TYPE_ECDSAP256 ecdsa p256r1 key
* TSIP_KEY_TYPE_ECDSAP384 ecdsa p384r1 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; int ret = 0;
e_tsip_err_t err = TSIP_SUCCESS; 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* iv = g_user_key_info.iv;
uint8_t* encPubKey; uint8_t* encPubKey;
WOLFSSL_ENTER("tsipImportPublicKey"); WOLFSSL_ENTER("tsip_ImportPublicKey");
if (tuc == NULL ) { if (tuc == NULL ) {
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
@@ -2515,7 +2515,7 @@ WOLFSSL_LOCAL int tsipImportPublicKey(TsipUserCtx* tuc, int keyType)
else { else {
WOLFSSL_MSG("mutex locking error"); WOLFSSL_MSG("mutex locking error");
} }
WOLFSSL_LEAVE("tsipImportPublicKey", ret); WOLFSSL_LEAVE("tsip_ImportPublicKey", ret);
return ret; return ret;
} }
@@ -3676,7 +3676,7 @@ WOLFSSL_LOCAL int tsip_SignRsaPkcs(wc_CryptoInfo* info, TsipUserCtx* tuc)
if (ret == 0) { if (ret == 0) {
/* import private key_index from wrapped key */ /* import private key_index from wrapped key */
ret = tsipImportPrivateKey(tuc, tuc->wrappedKeyType); ret = tsip_ImportPrivateKey(tuc, tuc->wrappedKeyType);
} }
if (ret == 0) { if (ret == 0) {
@@ -3825,7 +3825,7 @@ WOLFSSL_LOCAL int tsip_VerifyRsaPkcsCb(
if (ret == 0) { if (ret == 0) {
/* import public key_index from wrapped key */ /* import public key_index from wrapped key */
ret = tsipImportPublicKey(tuc, tuc->wrappedKeyType); ret = tsip_ImportPublicKey(tuc, tuc->wrappedKeyType);
} }
if (ret == 0) { if (ret == 0) {
@@ -3935,7 +3935,7 @@ WOLFSSL_LOCAL int tsip_SignEcdsa(wc_CryptoInfo* info, TsipUserCtx* tuc)
if (ret == 0) { if (ret == 0) {
/* import private key_index from wrapped key */ /* import private key_index from wrapped key */
ret = tsipImportPrivateKey(tuc, tuc->wrappedKeyType); ret = tsip_ImportPrivateKey(tuc, tuc->wrappedKeyType);
} }
if (ret == 0) { if (ret == 0) {
@@ -4061,7 +4061,7 @@ WOLFSSL_LOCAL int tsip_VerifyEcdsa(wc_CryptoInfo* info, TsipUserCtx* tuc)
if (ret == 0) { if (ret == 0) {
/* import public key_index from wrapped key */ /* import public key_index from wrapped key */
ret = tsipImportPublicKey(tuc, tuc->wrappedKeyType); ret = tsip_ImportPublicKey(tuc, tuc->wrappedKeyType);
} }
if (ret == 0) { if (ret == 0) {

View File

@@ -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_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(WOLF_PRIVATE_KEY_ID)
#if defined(WOLFSSL_RENESAS_TSIP_TLS) #if defined(WOLFSSL_RENESAS_TSIP_TLS)