Merge pull request #10842 from miyazakh/f6162_tsiphash

[Renesas RX72N] RX72N TSIP fixes and command-line build/flash/UART tooling
This commit is contained in:
David Garske
2026-07-07 16:17:30 -07:00
committed by GitHub
13 changed files with 762 additions and 253 deletions
@@ -171,7 +171,7 @@ WOLFSSL_LOCAL int tsip_Tls13AesEncrypt(
sz);
if (err != TSIP_SUCCESS) {
WOLFSSL_MSG("R_TSIP_Tls13DecryptUpdate error");
WOLFSSL_MSG("R_TSIP_Tls13EncryptInit error");
ret = WC_HW_E;
}
@@ -201,7 +201,7 @@ WOLFSSL_LOCAL int tsip_Tls13AesEncrypt(
remain -= dataSz;
}
else {
WOLFSSL_MSG("R_TSIP_Tls13DecryptUpdate error");
WOLFSSL_MSG("R_TSIP_Tls13EncryptUpdate error");
ret = WC_HW_E;
}
}
@@ -1123,7 +1123,7 @@ int wc_tsip_AesGcmDecrypt(
if (err == TSIP_SUCCESS) {
/* pass only AAD and it's size before passing cipher text */
err = updateFn(&hdl, NULL, NULL, 0UL, (uint8_t*)authIn,
err = updateFn(&hdl, NULL, NULL, 0UL, (uint8_t*)aadBuf,
authInSz);
}
if (err == TSIP_SUCCESS) {
+22 -8
View File
@@ -364,7 +364,7 @@ static int TSIPHashUpdate(wolfssl_TSIP_Hash* hash, const byte* data, word32 sz)
static int TSIPHashFinal(wolfssl_TSIP_Hash* hash, byte* out, word32 outSz)
{
int ret;
int ret = WC_HW_E;
void* heap;
tsip_sha_md5_handle_t handle;
uint32_t sz;
@@ -398,21 +398,32 @@ static int TSIPHashFinal(wolfssl_TSIP_Hash* hash, byte* out, word32 outSz)
ret = Update(&handle, (uint8_t*)hash->msg, hash->used);
if (ret == TSIP_SUCCESS) {
ret = Final(&handle, out, (uint32_t*)&sz);
if (ret != TSIP_SUCCESS || sz != outSz) {
tsip_hw_unlock();
return ret;
if (ret == TSIP_SUCCESS && sz != outSz) {
ret = WC_HW_E;
}
}
else {
ret = WC_HW_E;
}
}
tsip_hw_unlock();
/* Always reset hash state, even on failure, mirroring other wc_*Final()
* implementations (e.g. the STM32 wc_ShaFinal()/wc_Sha256Final()) so
* callers can safely reuse the object and the accumulated message
* buffer isn't left allocated. */
TSIPHashFree(hash);
return TSIPHashInit(hash, heap, 0, hash->sha_type);
if (TSIPHashInit(hash, heap, 0, hash->sha_type) != 0 &&
ret == TSIP_SUCCESS) {
ret = WC_HW_E;
}
return ret;
}
static int TSIPHashGet(wolfssl_TSIP_Hash* hash, byte* out, word32 outSz)
{
int ret;
int ret = WC_HW_E;
tsip_sha_md5_handle_t handle;
uint32_t sz;
@@ -445,14 +456,17 @@ static int TSIPHashGet(wolfssl_TSIP_Hash* hash, byte* out, word32 outSz)
ret = Final(&handle, out, &sz);
if (ret != TSIP_SUCCESS || sz != outSz) {
tsip_hw_unlock();
return ret;
return (ret == TSIP_SUCCESS) ? WC_HW_E : ret;
}
}
else {
ret = WC_HW_E;
}
}
tsip_hw_unlock();
return 0;
return ret;
}
static int TSIPHashCopy(wolfssl_TSIP_Hash* src, wolfssl_TSIP_Hash* dst)
@@ -2459,7 +2459,8 @@ int tsip_ImportPublicKey(TsipUserCtx* tuc, int keyType)
sizeof(tsip_rsa2048_public_key_index_t), NULL,
DYNAMIC_TYPE_RSA_BUFFER);
if (tuc->rsa2048pub_keyIdx == NULL) {
return MEMORY_E;
ret = MEMORY_E;
break;
}
#endif
err = R_TSIP_GenerateRsa2048PublicKeyIndex(
@@ -3220,8 +3221,10 @@ int wc_tsip_generateSessionKey(
if (enc->aes == NULL) {
enc->aes = (Aes*)XMALLOC(sizeof(Aes), ssl->heap,
DYNAMIC_TYPE_CIPHER);
if (enc->aes == NULL)
if (enc->aes == NULL) {
tsip_hw_unlock();
return MEMORY_E;
}
}
ForceZero(enc->aes, sizeof(Aes));
@@ -3234,6 +3237,7 @@ int wc_tsip_generateSessionKey(
if (enc) {
XFREE(enc->aes, NULL, DYNAMIC_TYPE_CIPHER);
}
tsip_hw_unlock();
return MEMORY_E;
}
}