Test invalid inputs for AES_unwrap_key.

There's an authenticator, so test that AES_unwrap_key notices invalid
inputs.

Change-Id: Icbb941f91ffd9c91118f956fd74058d241f91ecb
Reviewed-on: https://boringssl-review.googlesource.com/13047
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
David Benjamin 2016-12-22 22:46:51 -05:00 committed by CQ bot account: commit-bot@chromium.org
parent a1eaba1dc6
commit 3fa1e21be4

View File

@ -156,6 +156,13 @@ static bool TestKeyWrap(FileTest *t) {
return false; return false;
} }
ciphertext[0] ^= 1;
if (AES_unwrap_key(&aes_key, nullptr /* iv */, buf.get(), ciphertext.data(),
ciphertext.size()) != -1) {
t->PrintLine("AES_unwrap_key with bad input unexpectedly succeeded.");
return false;
}
return true; return true;
} }