Index: crypto/ec_signature_creator_nss.cc |
diff --git a/crypto/ec_signature_creator_nss.cc b/crypto/ec_signature_creator_nss.cc |
index a85b1e94fecf20299494fcffdc95c7894fb375da..9cf4fa2f808758e8b0e06ed9c431e612e6727297 100644 |
--- a/crypto/ec_signature_creator_nss.cc |
+++ b/crypto/ec_signature_creator_nss.cc |
@@ -42,15 +42,11 @@ SECStatus SignData(SECItem* result, |
// Compute signature of hash. |
int signature_len = PK11_SignatureLen(key); |
- std::vector<uint8> signature_data(signature_len); |
- SECItem sig = {siBuffer, &signature_data[0], |
- static_cast<unsigned int>(signature_len)}; |
- rv = PK11_Sign(key, &sig, &hash); |
+ result = SECITEM_AllocItem(NULL, result, signature_len); |
+ return PK11_Sign(key, result, &hash); |
Ryan Sleevi
2012/09/12 17:55:22
BUG: You return here, but then have code that runs
agl
2012/09/12 18:51:48
Thanks, I screwed up changing this code. Fixed.
|
if (rv != SECSuccess) |
- return rv; |
- |
- // DER encode the signature. |
- return DSAU_EncodeDerSigWithLen(result, &sig, sig.len); |
+ SECITEM_FreeItem(result, false /* don't free *result itself */); |
+ return rv; |
} |
} // namespace |
@@ -79,7 +75,7 @@ bool ECSignatureCreatorImpl::Sign(const uint8* data, |
// Sign the secret data and save it to |result|. |
SECStatus rv = |
- SignData(&result, &secret, key_->key(), HASH_AlgSHA1); |
+ SignData(&result, &secret, key_->key(), HASH_AlgSHA256); |
if (rv != SECSuccess) { |
DLOG(ERROR) << "DerSignData: " << PORT_GetError(); |
return false; |