| Index: net/quic/crypto/p256_key_exchange_nss.cc
|
| diff --git a/net/quic/crypto/p256_key_exchange_nss.cc b/net/quic/crypto/p256_key_exchange_nss.cc
|
| index 6e60f5df8e68416c4934bf5d88eb955da9ed8cb7..b325136812ae698ffefd723ee0365402d192886d 100644
|
| --- a/net/quic/crypto/p256_key_exchange_nss.cc
|
| +++ b/net/quic/crypto/p256_key_exchange_nss.cc
|
| @@ -45,8 +45,8 @@ P256KeyExchange* P256KeyExchange::New(StringPiece key) {
|
| }
|
|
|
| const uint8* data = reinterpret_cast<const uint8*>(key.data());
|
| - size_t size = static_cast<size_t>(data[0]) |
|
| - (static_cast<size_t>(data[1]) << 8);
|
| + size_t size =
|
| + static_cast<size_t>(data[0]) | (static_cast<size_t>(data[1]) << 8);
|
| key.remove_prefix(2);
|
| if (key.size() < size) {
|
| DVLOG(1) << "Key pair does not contain key material.";
|
| @@ -96,7 +96,8 @@ P256KeyExchange* P256KeyExchange::New(StringPiece key) {
|
| public_key->u.ec.DEREncodedParams.data[0] != SEC_ASN1_OBJECT_ID ||
|
| public_key->u.ec.DEREncodedParams.data[1] != oid_data->oid.len ||
|
| memcmp(public_key->u.ec.DEREncodedParams.data + 2,
|
| - oid_data->oid.data, oid_data->oid.len) != 0) {
|
| + oid_data->oid.data,
|
| + oid_data->oid.len) != 0) {
|
| DVLOG(1) << "Key is invalid.";
|
| }
|
|
|
| @@ -114,9 +115,8 @@ string P256KeyExchange::NewPrivateKey() {
|
| }
|
|
|
| vector<uint8> private_key;
|
| - if (!key_pair->ExportEncryptedPrivateKey(kExportPassword,
|
| - 1 /* iteration */,
|
| - &private_key)) {
|
| + if (!key_pair->ExportEncryptedPrivateKey(
|
| + kExportPassword, 1 /* iteration */, &private_key)) {
|
| DVLOG(1) << "Can't export private key.";
|
| return string();
|
| }
|
| @@ -132,9 +132,8 @@ string P256KeyExchange::NewPrivateKey() {
|
|
|
| // TODO(thaidn): determine how large encrypted private key can be
|
| uint16 private_key_size = private_key.size();
|
| - const size_t result_size = sizeof(private_key_size) +
|
| - private_key_size +
|
| - public_key.size();
|
| + const size_t result_size =
|
| + sizeof(private_key_size) + private_key_size + public_key.size();
|
| vector<char> result(result_size);
|
| char* resultp = &result[0];
|
| // Export the key string.
|
| @@ -188,19 +187,18 @@ bool P256KeyExchange::CalculateSharedKey(const StringPiece& peer_public_value,
|
| // |CalculateSharedKey| is the actual ECDH shared key, not any derived keys
|
| // from it.
|
| crypto::ScopedPK11SymKey premaster_secret(
|
| - PK11_PubDeriveWithKDF(
|
| - key_pair_->key(),
|
| - &peer_public_key,
|
| - PR_FALSE,
|
| - NULL,
|
| - NULL,
|
| - CKM_ECDH1_DERIVE, /* mechanism */
|
| - CKM_GENERIC_SECRET_KEY_GEN, /* target */
|
| - CKA_DERIVE,
|
| - 0,
|
| - CKD_NULL, /* kdf */
|
| - NULL,
|
| - NULL));
|
| + PK11_PubDeriveWithKDF(key_pair_->key(),
|
| + &peer_public_key,
|
| + PR_FALSE,
|
| + NULL,
|
| + NULL,
|
| + CKM_ECDH1_DERIVE, /* mechanism */
|
| + CKM_GENERIC_SECRET_KEY_GEN, /* target */
|
| + CKA_DERIVE,
|
| + 0,
|
| + CKD_NULL, /* kdf */
|
| + NULL,
|
| + NULL));
|
|
|
| if (!premaster_secret.get()) {
|
| DVLOG(1) << "Can't derive ECDH shared key.";
|
| @@ -227,7 +225,8 @@ StringPiece P256KeyExchange::public_value() const {
|
| sizeof(public_key_));
|
| }
|
|
|
| -QuicTag P256KeyExchange::tag() const { return kP256; }
|
| +QuicTag P256KeyExchange::tag() const {
|
| + return kP256;
|
| +}
|
|
|
| } // namespace net
|
| -
|
|
|