Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: crypto/ec_signature_creator_openssl.cc

Issue 618123007: Fix crypto_unittests on Windows BoringSSL port. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rsleevi comment Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | crypto/hmac_openssl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "crypto/ec_signature_creator_impl.h" 5 #include "crypto/ec_signature_creator_impl.h"
6 6
7 #include <openssl/bn.h> 7 #include <openssl/bn.h>
8 #include <openssl/ec.h> 8 #include <openssl/ec.h>
9 #include <openssl/ecdsa.h> 9 #include <openssl/ecdsa.h>
10 #include <openssl/evp.h> 10 #include <openssl/evp.h>
11 #include <openssl/sha.h> 11 #include <openssl/sha.h>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "crypto/ec_private_key.h" 14 #include "crypto/ec_private_key.h"
15 #include "crypto/openssl_util.h" 15 #include "crypto/openssl_util.h"
16 #include "crypto/scoped_openssl_types.h" 16 #include "crypto/scoped_openssl_types.h"
17 17
18 namespace crypto { 18 namespace crypto {
19 19
20 namespace {
21
22 typedef ScopedOpenSSL<ECDSA_SIG, ECDSA_SIG_free>::Type ScopedECDSA_SIG;
23
24 } // namespace
25
26 ECSignatureCreatorImpl::ECSignatureCreatorImpl(ECPrivateKey* key) 20 ECSignatureCreatorImpl::ECSignatureCreatorImpl(ECPrivateKey* key)
27 : key_(key), signature_len_(0) { 21 : key_(key), signature_len_(0) {
28 EnsureOpenSSLInit(); 22 EnsureOpenSSLInit();
29 } 23 }
30 24
31 ECSignatureCreatorImpl::~ECSignatureCreatorImpl() {} 25 ECSignatureCreatorImpl::~ECSignatureCreatorImpl() {}
32 26
33 bool ECSignatureCreatorImpl::Sign(const uint8* data, 27 bool ECSignatureCreatorImpl::Sign(const uint8* data,
34 int data_len, 28 int data_len,
35 std::vector<uint8>* signature) { 29 std::vector<uint8>* signature) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 << ")"; 76 << ")";
83 return false; 77 return false;
84 } 78 }
85 BN_bn2bin(ecdsa_sig.get()->r, &result[kMaxBytesPerBN - r_bytes]); 79 BN_bn2bin(ecdsa_sig.get()->r, &result[kMaxBytesPerBN - r_bytes]);
86 BN_bn2bin(ecdsa_sig.get()->s, &result[2 * kMaxBytesPerBN - s_bytes]); 80 BN_bn2bin(ecdsa_sig.get()->s, &result[2 * kMaxBytesPerBN - s_bytes]);
87 out_raw_sig->swap(result); 81 out_raw_sig->swap(result);
88 return true; 82 return true;
89 } 83 }
90 84
91 } // namespace crypto 85 } // namespace crypto
OLDNEW
« no previous file with comments | « no previous file | crypto/hmac_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698