Skip to content

Commit c29b939

Browse files
committed
Fix RSA encrypt/decrypt buffer size check logic.
1 parent 368b6b9 commit c29b939

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/tpm2_wrap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4364,7 +4364,7 @@ int wolfTPM2_RsaEncrypt(WOLFTPM2_DEV* dev, WOLFTPM2_KEY* key,
43644364
return rc;
43654365
}
43664366

4367-
if (*outSz > rsaEncOut.outData.size) {
4367+
if (*outSz < rsaEncOut.outData.size) {
43684368
return BUFFER_E;
43694369
}
43704370
*outSz = rsaEncOut.outData.size;
@@ -4419,7 +4419,7 @@ int wolfTPM2_RsaDecrypt(WOLFTPM2_DEV* dev, WOLFTPM2_KEY* key,
44194419
return rc;
44204420
}
44214421

4422-
if (*msgSz > rsaDecOut.message.size) {
4422+
if (*msgSz < rsaDecOut.message.size) {
44234423
return BUFFER_E;
44244424
}
44254425
*msgSz = rsaDecOut.message.size;

0 commit comments

Comments
 (0)