Merge pull request #51 from JacobBarthelmeh/testing

Adds extra checks for AES buffer size and update verify mac return error
pull/53/head
John Safranek 2018-04-05 15:14:13 -07:00 committed by GitHub
commit 5e15ae7061
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -4038,7 +4038,7 @@ static INLINE int Encrypt(WOLFSSH* ssh, byte* cipher, const byte* input,
break;
case ID_AES128_CBC:
if (wc_AesCbcEncrypt(&ssh->encryptCipher.aes,
if (sz % AES_BLOCK_SIZE || wc_AesCbcEncrypt(&ssh->encryptCipher.aes,
cipher, input, sz) < 0) {
ret = WS_ENCRYPT_E;
@ -4070,7 +4070,7 @@ static INLINE int Decrypt(WOLFSSH* ssh, byte* plain, const byte* input,
break;
case ID_AES128_CBC:
if (wc_AesCbcDecrypt(&ssh->decryptCipher.aes,
if (sz % AES_BLOCK_SIZE || wc_AesCbcDecrypt(&ssh->decryptCipher.aes,
plain, input, sz) < 0) {
ret = WS_DECRYPT_E;
@ -4367,7 +4367,7 @@ int DoReceive(WOLFSSH* ssh)
}
if (verifyResult != WS_SUCCESS) {
WLOG(WS_LOG_DEBUG, "PR: VerifyMac fail");
return ret;
return verifyResult;
}
}
else {