diff options
author | mlamouri <mlamouri@chromium.org> | 2015-10-20 18:23:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-21 01:24:06 +0000 |
commit | ef55346ab6d1d5b2ceb0a3287e896a58b5388422 (patch) | |
tree | 6314943d089563950eec202a45d2afa87a218531 /crypto | |
parent | 70b79cd641e3792f7edfb9d723b7b3c5f7c903b9 (diff) | |
download | chromium_src-ef55346ab6d1d5b2ceb0a3287e896a58b5388422.zip chromium_src-ef55346ab6d1d5b2ceb0a3287e896a58b5388422.tar.gz chromium_src-ef55346ab6d1d5b2ceb0a3287e896a58b5388422.tar.bz2 |
Remove unused private fields in crypto/.
This needed in order to use "= delete" for DISALLOW_COPY_AND_ASSIGN.
BUG=447445
Review URL: https://codereview.chromium.org/1242593003
Cr-Commit-Position: refs/heads/master@{#355210}
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/ec_signature_creator_impl.h | 1 | ||||
-rw-r--r-- | crypto/ec_signature_creator_nss.cc | 16 | ||||
-rw-r--r-- | crypto/ec_signature_creator_openssl.cc | 2 |
3 files changed, 9 insertions, 10 deletions
diff --git a/crypto/ec_signature_creator_impl.h b/crypto/ec_signature_creator_impl.h index 91a60a8..95e22e8 100644 --- a/crypto/ec_signature_creator_impl.h +++ b/crypto/ec_signature_creator_impl.h @@ -24,7 +24,6 @@ class ECSignatureCreatorImpl : public ECSignatureCreator { private: ECPrivateKey* key_; - size_t signature_len_; DISALLOW_COPY_AND_ASSIGN(ECSignatureCreatorImpl); }; diff --git a/crypto/ec_signature_creator_nss.cc b/crypto/ec_signature_creator_nss.cc index 3e3626f..06a0ad5 100644 --- a/crypto/ec_signature_creator_nss.cc +++ b/crypto/ec_signature_creator_nss.cc @@ -24,8 +24,7 @@ namespace { SECStatus SignData(SECItem* result, SECItem* input, SECKEYPrivateKey* key, - HASH_HashType hash_type, - size_t* out_signature_len) { + HASH_HashType hash_type) { if (key->keyType != ecKey) { DLOG(FATAL) << "Should be using an EC key."; PORT_SetError(SEC_ERROR_INVALID_ARGS); @@ -50,8 +49,6 @@ SECStatus SignData(SECItem* result, if (rv != SECSuccess) return rv; - *out_signature_len = sig.len; - // DER encode the signature. return DSAU_EncodeDerSigWithLen(result, &sig, sig.len); } @@ -59,8 +56,7 @@ SECStatus SignData(SECItem* result, } // namespace ECSignatureCreatorImpl::ECSignatureCreatorImpl(ECPrivateKey* key) - : key_(key), - signature_len_(0) { + : key_(key) { EnsureNSSInit(); } @@ -83,7 +79,7 @@ bool ECSignatureCreatorImpl::Sign(const uint8* data, // Sign the secret data and save it to |result|. SECStatus rv = - SignData(&result, &secret, key_->key(), HASH_AlgSHA256, &signature_len_); + SignData(&result, &secret, key_->key(), HASH_AlgSHA256); if (rv != SECSuccess) { DLOG(ERROR) << "DerSignData: " << PORT_GetError(); return false; @@ -103,7 +99,11 @@ bool ECSignatureCreatorImpl::DecodeSignature( der_sig_item.len = der_sig.size(); der_sig_item.data = const_cast<uint8*>(&der_sig[0]); - SECItem* raw_sig = DSAU_DecodeDerSigToLen(&der_sig_item, signature_len_); + size_t signature_len = SECKEY_SignatureLen(key_->public_key()); + if (signature_len == 0) + return false; + + SECItem* raw_sig = DSAU_DecodeDerSigToLen(&der_sig_item, signature_len); if (!raw_sig) return false; out_raw_sig->assign(raw_sig->data, raw_sig->data + raw_sig->len); diff --git a/crypto/ec_signature_creator_openssl.cc b/crypto/ec_signature_creator_openssl.cc index c422cef..30343a7 100644 --- a/crypto/ec_signature_creator_openssl.cc +++ b/crypto/ec_signature_creator_openssl.cc @@ -18,7 +18,7 @@ namespace crypto { ECSignatureCreatorImpl::ECSignatureCreatorImpl(ECPrivateKey* key) - : key_(key), signature_len_(0) { + : key_(key) { EnsureOpenSSLInit(); } |