| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/webcrypto/algorithms/secret_key_util.h" | 5 #include "components/webcrypto/algorithms/secret_key_util.h" |
| 6 | 6 |
| 7 #include <openssl/rand.h> | |
| 8 | |
| 9 #include "components/webcrypto/algorithms/util.h" | 7 #include "components/webcrypto/algorithms/util.h" |
| 10 #include "components/webcrypto/blink_key_handle.h" | 8 #include "components/webcrypto/blink_key_handle.h" |
| 11 #include "components/webcrypto/crypto_data.h" | 9 #include "components/webcrypto/crypto_data.h" |
| 12 #include "components/webcrypto/generate_key_result.h" | 10 #include "components/webcrypto/generate_key_result.h" |
| 13 #include "components/webcrypto/jwk.h" | 11 #include "components/webcrypto/jwk.h" |
| 14 #include "components/webcrypto/status.h" | 12 #include "components/webcrypto/status.h" |
| 15 #include "crypto/openssl_util.h" | 13 #include "crypto/openssl_util.h" |
| 14 #include "third_party/boringssl/src/include/openssl/rand.h" |
| 16 | 15 |
| 17 namespace webcrypto { | 16 namespace webcrypto { |
| 18 | 17 |
| 19 Status GenerateWebCryptoSecretKey(const blink::WebCryptoKeyAlgorithm& algorithm, | 18 Status GenerateWebCryptoSecretKey(const blink::WebCryptoKeyAlgorithm& algorithm, |
| 20 bool extractable, | 19 bool extractable, |
| 21 blink::WebCryptoKeyUsageMask usages, | 20 blink::WebCryptoKeyUsageMask usages, |
| 22 unsigned int keylen_bits, | 21 unsigned int keylen_bits, |
| 23 GenerateKeyResult* result) { | 22 GenerateKeyResult* result) { |
| 24 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); | 23 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); |
| 25 | 24 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 std::string jwk_k_value; | 73 std::string jwk_k_value; |
| 75 status = jwk->GetBytes("k", &jwk_k_value); | 74 status = jwk->GetBytes("k", &jwk_k_value); |
| 76 if (status.IsError()) | 75 if (status.IsError()) |
| 77 return status; | 76 return status; |
| 78 raw_key_data->assign(jwk_k_value.begin(), jwk_k_value.end()); | 77 raw_key_data->assign(jwk_k_value.begin(), jwk_k_value.end()); |
| 79 | 78 |
| 80 return Status::Success(); | 79 return Status::Success(); |
| 81 } | 80 } |
| 82 | 81 |
| 83 } // namespace webcrypto | 82 } // namespace webcrypto |
| OLD | NEW |