Skip to content

Commit 96396c1

Browse files
Fix f_871
1 parent de530fe commit 96396c1

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/internal.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4880,16 +4880,14 @@ static int ParseRSAPubKey(WOLFSSH *ssh,
48804880
byte* n;
48814881
word32 nSz;
48824882
word32 pubKeyIdx = 0;
4883-
word32 scratch;
48844883

48854884
ret = wc_InitRsaKey(&sigKeyBlock_ptr->sk.rsa.key, ssh->ctx->heap);
48864885
if (ret != 0)
48874886
ret = WS_RSA_E;
4888-
if (ret == 0)
4889-
ret = GetUint32(&scratch, pubKey, pubKeySz, &pubKeyIdx);
4890-
/* This is the algo name. */
4887+
/* Skip the algo name. */
4888+
if (ret == WS_SUCCESS)
4889+
ret = GetSkip(pubKey, pubKeySz, &pubKeyIdx);
48914890
if (ret == WS_SUCCESS) {
4892-
pubKeyIdx += scratch;
48934891
ret = GetUint32(&eSz, pubKey, pubKeySz, &pubKeyIdx);
48944892
if (ret == WS_SUCCESS && eSz > pubKeySz - pubKeyIdx)
48954893
ret = WS_BUFFER_E;
@@ -4932,7 +4930,6 @@ static int ParseECCPubKey(WOLFSSH *ssh,
49324930
const byte* q;
49334931
word32 qSz, pubKeyIdx = 0;
49344932
int primeId = 0;
4935-
word32 scratch;
49364933

49374934
ret = wc_ecc_init_ex(&sigKeyBlock_ptr->sk.ecc.key, ssh->ctx->heap,
49384935
INVALID_DEVID);
@@ -4958,12 +4955,10 @@ static int ParseECCPubKey(WOLFSSH *ssh,
49584955

49594956
/* Skip the curve name since we're getting it from the algo. */
49604957
if (ret == WS_SUCCESS)
4961-
ret = GetUint32(&scratch, pubKey, pubKeySz, &pubKeyIdx);
4958+
ret = GetSkip(pubKey, pubKeySz, &pubKeyIdx);
49624959

4963-
if (ret == WS_SUCCESS) {
4964-
pubKeyIdx += scratch;
4960+
if (ret == WS_SUCCESS)
49654961
ret = GetStringRef(&qSz, &q, pubKey, pubKeySz, &pubKeyIdx);
4966-
}
49674962

49684963
if (ret == WS_SUCCESS) {
49694964
ret = wc_ecc_import_x963_ex(q, qSz,

0 commit comments

Comments
 (0)