refactor rawLen to avoid unused warning

This commit is contained in:
John Bland
2024-03-30 02:12:32 -04:00
parent 7c0423eb65
commit d8e9e90f9d

View File

@@ -25938,13 +25938,13 @@ int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen)
#ifndef WOLFSSL_ASN_TEMPLATE #ifndef WOLFSSL_ASN_TEMPLATE
int ret = 0, i; int ret = 0, i;
int mpSz; int mpSz;
word32 rawLen;
word32 seqSz = 0, verSz = 0, intTotalLen = 0, outLen = 0; word32 seqSz = 0, verSz = 0, intTotalLen = 0, outLen = 0;
word32 sizes[RSA_INTS]; word32 sizes[RSA_INTS];
byte seq[MAX_SEQ_SZ]; byte seq[MAX_SEQ_SZ];
byte ver[MAX_VERSION_SZ]; byte ver[MAX_VERSION_SZ];
mp_int* keyInt; mp_int* keyInt;
#ifndef WOLFSSL_NO_MALLOC #ifndef WOLFSSL_NO_MALLOC
word32 rawLen;
byte* tmps[RSA_INTS]; byte* tmps[RSA_INTS];
#endif #endif
@@ -25965,9 +25965,9 @@ int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen)
ret = mp_unsigned_bin_size(keyInt); ret = mp_unsigned_bin_size(keyInt);
if (ret < 0) if (ret < 0)
break; break;
#ifndef WOLFSSL_NO_MALLOC
rawLen = (word32)ret + 1; rawLen = (word32)ret + 1;
ret = 0; ret = 0;
#ifndef WOLFSSL_NO_MALLOC
if (output != NULL) { if (output != NULL) {
tmps[i] = (byte*)XMALLOC(rawLen + MAX_SEQ_SZ, key->heap, tmps[i] = (byte*)XMALLOC(rawLen + MAX_SEQ_SZ, key->heap,
DYNAMIC_TYPE_RSA); DYNAMIC_TYPE_RSA);
@@ -25978,6 +25978,7 @@ int wc_RsaKeyToDer(RsaKey* key, byte* output, word32 inLen)
} }
mpSz = SetASNIntMP(keyInt, MAX_RSA_INT_SZ, tmps[i]); mpSz = SetASNIntMP(keyInt, MAX_RSA_INT_SZ, tmps[i]);
#else #else
ret = 0;
mpSz = SetASNIntMP(keyInt, MAX_RSA_INT_SZ, NULL); mpSz = SetASNIntMP(keyInt, MAX_RSA_INT_SZ, NULL);
#endif #endif
if (mpSz < 0) { if (mpSz < 0) {