OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/numerics/safe_math.h" | 5 #include "base/numerics/safe_math.h" |
6 #include "base/stl_util.h" | 6 #include "base/stl_util.h" |
7 #include "content/child/webcrypto/crypto_data.h" | 7 #include "components/webcrypto/crypto_data.h" |
8 #include "content/child/webcrypto/openssl/key_openssl.h" | 8 #include "components/webcrypto/openssl/key_openssl.h" |
9 #include "content/child/webcrypto/openssl/rsa_sign_openssl.h" | 9 #include "components/webcrypto/openssl/rsa_sign_openssl.h" |
10 #include "content/child/webcrypto/openssl/util_openssl.h" | 10 #include "components/webcrypto/openssl/util_openssl.h" |
11 #include "content/child/webcrypto/status.h" | 11 #include "components/webcrypto/status.h" |
12 #include "crypto/openssl_util.h" | 12 #include "crypto/openssl_util.h" |
13 #include "crypto/scoped_openssl_types.h" | 13 #include "crypto/scoped_openssl_types.h" |
14 #include "third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h" | 14 #include "third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h" |
15 | 15 |
16 namespace content { | 16 namespace components { |
17 | 17 |
18 namespace webcrypto { | 18 namespace webcrypto { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // Extracts the OpenSSL key and digest from a WebCrypto key. The returned | 22 // Extracts the OpenSSL key and digest from a WebCrypto key. The returned |
23 // pointers will remain valid as long as |key| is alive. | 23 // pointers will remain valid as long as |key| is alive. |
24 Status GetPKeyAndDigest(const blink::WebCryptoKey& key, | 24 Status GetPKeyAndDigest(const blink::WebCryptoKey& key, |
25 EVP_PKEY** pkey, | 25 EVP_PKEY** pkey, |
26 const EVP_MD** digest) { | 26 const EVP_MD** digest) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 if (!EVP_DigestVerifyUpdate(ctx.get(), data.bytes(), data.byte_length())) | 140 if (!EVP_DigestVerifyUpdate(ctx.get(), data.bytes(), data.byte_length())) |
141 return Status::OperationError(); | 141 return Status::OperationError(); |
142 | 142 |
143 *signature_match = 1 == EVP_DigestVerifyFinal(ctx.get(), signature.bytes(), | 143 *signature_match = 1 == EVP_DigestVerifyFinal(ctx.get(), signature.bytes(), |
144 signature.byte_length()); | 144 signature.byte_length()); |
145 return Status::Success(); | 145 return Status::Success(); |
146 } | 146 } |
147 | 147 |
148 } // namespace webcrypto | 148 } // namespace webcrypto |
149 | 149 |
150 } // namespace content | 150 } // namespace components |
OLD | NEW |