Skip to content

Commit

Permalink
Cleanup the import function declarations.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgarske committed Nov 5, 2024
1 parent 02c2f44 commit 3179a2f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions wolfcrypt/src/port/Renesas/renesas_tsip_rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
26 changes: 13 additions & 13 deletions wolfcrypt/src/port/Renesas/renesas_tsip_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -2301,15 +2301,15 @@ 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;
uint8_t* provisioning_key = g_user_key_info.encrypted_provisioning_key;
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;
Expand Down Expand Up @@ -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;
}

Expand All @@ -2393,15 +2393,15 @@ 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;
uint8_t* provisioning_key = g_user_key_info.encrypted_provisioning_key;
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;
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3179a2f

Please sign in to comment.