Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(825)

Side by Side Diff: crypto/ec_private_key_nss.cc

Issue 659943004: Type conversion fixes, crypto/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | crypto/nss_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ec_private_key.h" 5 #include "crypto/ec_private_key.h"
6 6
7 extern "C" { 7 extern "C" {
8 // Work around NSS missing SEC_BEGIN_PROTOS in secmodt.h. This must come before 8 // Work around NSS missing SEC_BEGIN_PROTOS in secmodt.h. This must come before
9 // other NSS headers. 9 // other NSS headers.
10 #include <secmodt.h> 10 #include <secmodt.h>
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // In addition to the oid data, the encoding requires one byte for the ASN.1 333 // In addition to the oid data, the encoding requires one byte for the ASN.1
334 // tag and one byte for the length (assuming the length is <= 127). 334 // tag and one byte for the length (assuming the length is <= 127).
335 DCHECK_LE(oid_data->oid.len, 127U); 335 DCHECK_LE(oid_data->oid.len, 127U);
336 std::vector<unsigned char> parameters_buf(2 + oid_data->oid.len); 336 std::vector<unsigned char> parameters_buf(2 + oid_data->oid.len);
337 SECKEYECParams ec_parameters = { 337 SECKEYECParams ec_parameters = {
338 siDEROID, &parameters_buf[0], 338 siDEROID, &parameters_buf[0],
339 static_cast<unsigned>(parameters_buf.size()) 339 static_cast<unsigned>(parameters_buf.size())
340 }; 340 };
341 341
342 ec_parameters.data[0] = SEC_ASN1_OBJECT_ID; 342 ec_parameters.data[0] = SEC_ASN1_OBJECT_ID;
343 ec_parameters.data[1] = oid_data->oid.len; 343 ec_parameters.data[1] = static_cast<unsigned char>(oid_data->oid.len);
344 memcpy(ec_parameters.data + 2, oid_data->oid.data, oid_data->oid.len); 344 memcpy(ec_parameters.data + 2, oid_data->oid.data, oid_data->oid.len);
345 345
346 result->key_ = PK11_GenerateKeyPair(slot, 346 result->key_ = PK11_GenerateKeyPair(slot,
347 CKM_EC_KEY_PAIR_GEN, 347 CKM_EC_KEY_PAIR_GEN,
348 &ec_parameters, 348 &ec_parameters,
349 &result->public_key_, 349 &result->public_key_,
350 permanent, 350 permanent,
351 sensitive, 351 sensitive,
352 NULL); 352 NULL);
353 if (!result->key_) { 353 if (!result->key_) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 396
397 if (success) { 397 if (success) {
398 CHECK_EQ(ecKey, SECKEY_GetPublicKeyType(result->public_key_)); 398 CHECK_EQ(ecKey, SECKEY_GetPublicKeyType(result->public_key_));
399 return result.release(); 399 return result.release();
400 } 400 }
401 401
402 return NULL; 402 return NULL;
403 } 403 }
404 404
405 } // namespace crypto 405 } // namespace crypto
OLDNEW
« no previous file with comments | « no previous file | crypto/nss_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698