From b87d27a23bc31c7206e2d33044288dc84562a2cb Mon Sep 17 00:00:00 2001 From: Kongqun Yang Date: Tue, 9 Jun 2015 18:34:32 -0700 Subject: [PATCH] Use variants of the PKCS#1 PSS functions that specify the MGF1 hash BoringSSL removes the variants that had been used, in which the hash is given a default value. This change makes the code more compatible with BoringSSL. Change-Id: I665084c2e71593db1afd6baf182224fe0d23c944 --- packager/media/base/rsa_key.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packager/media/base/rsa_key.cc b/packager/media/base/rsa_key.cc index ae7cb00b00..fca52795d3 100644 --- a/packager/media/base/rsa_key.cc +++ b/packager/media/base/rsa_key.cc @@ -140,11 +140,12 @@ bool RsaPrivateKey::GenerateSignature(const std::string& message, // Add PSS padding. size_t rsa_size = RSA_size(rsa_key_); std::vector padded_digest(rsa_size); - if (!RSA_padding_add_PKCS1_PSS( + if (!RSA_padding_add_PKCS1_PSS_mgf1( rsa_key_, &padded_digest[0], reinterpret_cast(string_as_array(&message_digest)), EVP_sha1(), + EVP_sha1(), kPssSaltLength)) { LOG(ERROR) << "RSA padding failure: " << ERR_error_string(ERR_get_error(), NULL); @@ -238,10 +239,11 @@ bool RsaPublicKey::VerifySignature(const std::string& message, std::string message_digest = base::SHA1HashString(message); // Verify PSS padding. - return RSA_verify_PKCS1_PSS( + return RSA_verify_PKCS1_PSS_mgf1( rsa_key_, reinterpret_cast(message_digest.data()), EVP_sha1(), + EVP_sha1(), &padded_digest[0], kPssSaltLength) != 0; }