Chromium Code Reviews| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 367 if (jwk_crv != params->namedCurve()) | 367 if (jwk_crv != params->namedCurve()) |
| 368 return Status::ErrorJwkIncorrectCrv(); | 368 return Status::ErrorJwkIncorrectCrv(); |
| 369 | 369 |
| 370 // Only private keys have a "d" parameter. The key may still be invalid, but | 370 // Only private keys have a "d" parameter. The key may still be invalid, but |
| 371 // tentatively decide if it is a public or private key. | 371 // tentatively decide if it is a public or private key. |
| 372 bool is_private_key = jwk.HasMember("d"); | 372 bool is_private_key = jwk.HasMember("d"); |
| 373 | 373 |
| 374 // Now that the key type is known, verify the usages. | 374 // Now that the key type is known, verify the usages. |
| 375 status = CheckKeyCreationUsages( | 375 status = CheckKeyCreationUsages( |
| 376 is_private_key ? all_private_key_usages_ : all_public_key_usages_, | 376 is_private_key ? all_private_key_usages_ : all_public_key_usages_, |
| 377 usages); | 377 usages, true); |
|
eroman
2014/12/17 01:23:51
I don't believe this is correct. Shouldn't it be !
Habib Virji
2014/12/17 15:41:53
Sorry I missed this file to update.
You were rig
| |
| 378 if (status.IsError()) | 378 if (status.IsError()) |
| 379 return status; | 379 return status; |
| 380 | 380 |
| 381 // Create an EC_KEY. | 381 // Create an EC_KEY. |
| 382 crypto::ScopedEC_KEY ec; | 382 crypto::ScopedEC_KEY ec; |
| 383 status = CreateEC_KEY(params->namedCurve(), &ec); | 383 status = CreateEC_KEY(params->namedCurve(), &ec); |
| 384 if (status.IsError()) | 384 if (status.IsError()) |
| 385 return status; | 385 return status; |
| 386 | 386 |
| 387 // JWK requires the length of x, y, d to match the group degree. | 387 // JWK requires the length of x, y, d to match the group degree. |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 551 key->algorithm().ecParams()->namedCurve()) { | 551 key->algorithm().ecParams()->namedCurve()) { |
| 552 return Status::ErrorUnexpected(); | 552 return Status::ErrorUnexpected(); |
| 553 } | 553 } |
| 554 | 554 |
| 555 return Status::Success(); | 555 return Status::Success(); |
| 556 } | 556 } |
| 557 | 557 |
| 558 } // namespace webcrypto | 558 } // namespace webcrypto |
| 559 | 559 |
| 560 } // namespace content | 560 } // namespace content |
| OLD | NEW |