diff options
author | davidben <davidben@chromium.org> | 2014-10-01 19:20:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-02 02:21:01 +0000 |
commit | 50a133b51fa9c6a3dc2b82ce9fedcf074859cd13 (patch) | |
tree | daf57dbe2170a368999ef1839e63c64801d75e5c | |
parent | 0d2885645b7f42e37e1aa09fa6a0794718e3df84 (diff) | |
download | chromium_src-50a133b51fa9c6a3dc2b82ce9fedcf074859cd13.zip chromium_src-50a133b51fa9c6a3dc2b82ce9fedcf074859cd13.tar.gz chromium_src-50a133b51fa9c6a3dc2b82ce9fedcf074859cd13.tar.bz2 |
Fix crypto_unittests on Windows BoringSSL port.
MSVC is somewhat pickier about casting things to bool.
BUG=338884
Review URL: https://codereview.chromium.org/618123007
Cr-Commit-Position: refs/heads/master@{#297770}
-rw-r--r-- | crypto/ec_signature_creator_openssl.cc | 6 | ||||
-rw-r--r-- | crypto/hmac_openssl.cc | 2 | ||||
-rw-r--r-- | crypto/signature_creator_openssl.cc | 5 |
3 files changed, 3 insertions, 10 deletions
diff --git a/crypto/ec_signature_creator_openssl.cc b/crypto/ec_signature_creator_openssl.cc index adff2c9..91e8a6a8 100644 --- a/crypto/ec_signature_creator_openssl.cc +++ b/crypto/ec_signature_creator_openssl.cc @@ -17,12 +17,6 @@ namespace crypto { -namespace { - -typedef ScopedOpenSSL<ECDSA_SIG, ECDSA_SIG_free>::Type ScopedECDSA_SIG; - -} // namespace - ECSignatureCreatorImpl::ECSignatureCreatorImpl(ECPrivateKey* key) : key_(key), signature_len_(0) { EnsureOpenSSLInit(); diff --git a/crypto/hmac_openssl.cc b/crypto/hmac_openssl.cc index 46bfbae..92eea19 100644 --- a/crypto/hmac_openssl.cc +++ b/crypto/hmac_openssl.cc @@ -54,7 +54,7 @@ bool HMAC::Sign(const base::StringPiece& data, DCHECK(!plat_->key.empty()); // Init must be called before Sign. ScopedOpenSSLSafeSizeBuffer<EVP_MAX_MD_SIZE> result(digest, digest_length); - return ::HMAC(hash_alg_ == SHA1 ? EVP_sha1() : EVP_sha256(), + return !!::HMAC(hash_alg_ == SHA1 ? EVP_sha1() : EVP_sha256(), &plat_->key[0], plat_->key.size(), reinterpret_cast<const unsigned char*>(data.data()), data.size(), diff --git a/crypto/signature_creator_openssl.cc b/crypto/signature_creator_openssl.cc index 51cb3c3e..7a1349b 100644 --- a/crypto/signature_creator_openssl.cc +++ b/crypto/signature_creator_openssl.cc @@ -68,9 +68,8 @@ bool SignatureCreator::Sign(RSAPrivateKey* key, signature->resize(RSA_size(rsa_key.get())); unsigned int len = 0; - bool success = RSA_sign(ToOpenSSLDigestType(hash_alg), data, data_len, - vector_as_array(signature), &len, rsa_key.get()); - if (!success) { + if (!RSA_sign(ToOpenSSLDigestType(hash_alg), data, data_len, + vector_as_array(signature), &len, rsa_key.get())) { signature->clear(); return false; } |