| 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 "content/child/webcrypto/openssl/ec_key_openssl.h" | 5 #include "content/child/webcrypto/openssl/ec_key_openssl.h" |
| 6 | 6 |
| 7 #include <openssl/ec.h> | 7 #include <openssl/ec.h> |
| 8 #include <openssl/ec_key.h> | 8 #include <openssl/ec_key.h> |
| 9 #include <openssl/evp.h> | 9 #include <openssl/evp.h> |
| 10 #include <openssl/pkcs12.h> | 10 #include <openssl/pkcs12.h> |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 Status status = CheckKeyCreationUsages( | 211 Status status = CheckKeyCreationUsages( |
| 212 all_public_key_usages_ | all_private_key_usages_, combined_usages); | 212 all_public_key_usages_ | all_private_key_usages_, combined_usages); |
| 213 if (status.IsError()) | 213 if (status.IsError()) |
| 214 return status; | 214 return status; |
| 215 | 215 |
| 216 const blink::WebCryptoKeyUsageMask public_usages = | 216 const blink::WebCryptoKeyUsageMask public_usages = |
| 217 combined_usages & all_public_key_usages_; | 217 combined_usages & all_public_key_usages_; |
| 218 const blink::WebCryptoKeyUsageMask private_usages = | 218 const blink::WebCryptoKeyUsageMask private_usages = |
| 219 combined_usages & all_private_key_usages_; | 219 combined_usages & all_private_key_usages_; |
| 220 | 220 |
| 221 if (private_usages == 0) |
| 222 return Status::ErrorCreateKeyEmptyUsages(); |
| 223 |
| 221 const blink::WebCryptoEcKeyGenParams* params = algorithm.ecKeyGenParams(); | 224 const blink::WebCryptoEcKeyGenParams* params = algorithm.ecKeyGenParams(); |
| 222 | 225 |
| 223 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); | 226 crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); |
| 224 | 227 |
| 225 // Generate an EC key pair. | 228 // Generate an EC key pair. |
| 226 crypto::ScopedEC_KEY ec_private_key; | 229 crypto::ScopedEC_KEY ec_private_key; |
| 227 status = CreateEC_KEY(params->namedCurve(), &ec_private_key); | 230 status = CreateEC_KEY(params->namedCurve(), &ec_private_key); |
| 228 if (status.IsError()) | 231 if (status.IsError()) |
| 229 return status; | 232 return status; |
| 230 | 233 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 key->algorithm().ecParams()->namedCurve()) { | 571 key->algorithm().ecParams()->namedCurve()) { |
| 569 return Status::ErrorUnexpected(); | 572 return Status::ErrorUnexpected(); |
| 570 } | 573 } |
| 571 | 574 |
| 572 return Status::Success(); | 575 return Status::Success(); |
| 573 } | 576 } |
| 574 | 577 |
| 575 } // namespace webcrypto | 578 } // namespace webcrypto |
| 576 | 579 |
| 577 } // namespace content | 580 } // namespace content |
| OLD | NEW |