| OLD | NEW |
| 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/signature_creator.h" | 5 #include "crypto/signature_creator.h" |
| 6 | 6 |
| 7 #include <openssl/evp.h> | |
| 8 #include <openssl/rsa.h> | |
| 9 | |
| 10 #include "base/logging.h" | 7 #include "base/logging.h" |
| 11 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 13 #include "crypto/openssl_util.h" | 10 #include "crypto/openssl_util.h" |
| 14 #include "crypto/rsa_private_key.h" | 11 #include "crypto/rsa_private_key.h" |
| 15 #include "crypto/scoped_openssl_types.h" | 12 #include "crypto/scoped_openssl_types.h" |
| 13 #include "third_party/boringssl/src/include/openssl/digest.h" |
| 14 #include "third_party/boringssl/src/include/openssl/evp.h" |
| 15 #include "third_party/boringssl/src/include/openssl/obj.h" |
| 16 #include "third_party/boringssl/src/include/openssl/rsa.h" |
| 16 | 17 |
| 17 namespace crypto { | 18 namespace crypto { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 const EVP_MD* ToOpenSSLDigest(SignatureCreator::HashAlgorithm hash_alg) { | 22 const EVP_MD* ToOpenSSLDigest(SignatureCreator::HashAlgorithm hash_alg) { |
| 22 switch (hash_alg) { | 23 switch (hash_alg) { |
| 23 case SignatureCreator::SHA1: | 24 case SignatureCreator::SHA1: |
| 24 return EVP_sha1(); | 25 return EVP_sha1(); |
| 25 case SignatureCreator::SHA256: | 26 case SignatureCreator::SHA256: |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // Sign it. | 106 // Sign it. |
| 106 if (!EVP_DigestSignFinal(sign_context_, vector_as_array(signature), &len)) { | 107 if (!EVP_DigestSignFinal(sign_context_, vector_as_array(signature), &len)) { |
| 107 signature->clear(); | 108 signature->clear(); |
| 108 return false; | 109 return false; |
| 109 } | 110 } |
| 110 signature->resize(len); | 111 signature->resize(len); |
| 111 return true; | 112 return true; |
| 112 } | 113 } |
| 113 | 114 |
| 114 } // namespace crypto | 115 } // namespace crypto |
| OLD | NEW |