diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-10-03 19:53:38 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-03 19:53:38 +0000 |
commit | bd8855b27b43de3587b2040fee64236bf53a4238 (patch) | |
tree | 7fbb689bf5cfe7374dfd7b2c3ce60a4e33c35f5c /core/fpdfapi/parser/cpdf_security_handler.cpp | |
parent | 2ff6cd661c0203dcdcc09135bce8bba141037574 (diff) | |
download | pdfium-bd8855b27b43de3587b2040fee64236bf53a4238.tar.xz |
Remove blocklen argument from CRYPT_AESSetKey()
We always pass it as 16. In turn, remove some unused code
to handle the non-16 cases.
Noticed while looking at coverage report.
Change-Id: I93f5f0342537284ce6a2b36a8b477425da3cc872
Reviewed-on: https://pdfium-review.googlesource.com/c/43450
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_security_handler.cpp')
-rw-r--r-- | core/fpdfapi/parser/cpdf_security_handler.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/fpdfapi/parser/cpdf_security_handler.cpp b/core/fpdfapi/parser/cpdf_security_handler.cpp index f3d9201cbf..bb2296666a 100644 --- a/core/fpdfapi/parser/cpdf_security_handler.cpp +++ b/core/fpdfapi/parser/cpdf_security_handler.cpp @@ -278,7 +278,7 @@ void Revision6_Hash(const ByteString& password, content.insert(std::end(content), vector, vector + 48); } } - CRYPT_AESSetKey(&aes, 16, key, 16, true); + CRYPT_AESSetKey(&aes, key, 16, true); CRYPT_AESSetIV(&aes, iv); CRYPT_AESEncrypt(&aes, E, content.data(), iBufLen); int iHash = 0; @@ -365,12 +365,12 @@ bool CPDF_SecurityHandler::AES256_CheckPassword(const ByteString& password, CRYPT_aes_context aes; memset(&aes, 0, sizeof(aes)); - CRYPT_AESSetKey(&aes, 16, digest, 32, false); + CRYPT_AESSetKey(&aes, digest, 32, false); uint8_t iv[16]; memset(iv, 0, 16); CRYPT_AESSetIV(&aes, iv); CRYPT_AESDecrypt(&aes, key, ekey.raw_str(), 32); - CRYPT_AESSetKey(&aes, 16, key, 32, false); + CRYPT_AESSetKey(&aes, key, 32, false); CRYPT_AESSetIV(&aes, iv); ByteString perms = m_pEncryptDict->GetStringFor("Perms"); if (perms.IsEmpty()) @@ -676,7 +676,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, } CRYPT_aes_context aes; memset(&aes, 0, sizeof(aes)); - CRYPT_AESSetKey(&aes, 16, digest1, 32, true); + CRYPT_AESSetKey(&aes, digest1, 32, true); uint8_t iv[16]; memset(iv, 0, 16); CRYPT_AESSetIV(&aes, iv); @@ -705,7 +705,7 @@ void CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict, CRYPT_aes_context aes; memset(&aes, 0, sizeof(aes)); - CRYPT_AESSetKey(&aes, 16, key, 32, true); + CRYPT_AESSetKey(&aes, key, 32, true); uint8_t iv[16]; memset(iv, 0, 16); |