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

Unified Diff: content/child/webcrypto/nss/sym_key_nss.cc

Issue 401983002: Revert 284192 due to a failing test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/webcrypto/nss/sym_key_nss.h ('k') | content/child/webcrypto/nss/util_nss.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/nss/sym_key_nss.cc
diff --git a/content/child/webcrypto/nss/sym_key_nss.cc b/content/child/webcrypto/nss/sym_key_nss.cc
deleted file mode 100644
index 08eef2836cfbfb5194f74e42c7a2b18a190df5d2..0000000000000000000000000000000000000000
--- a/content/child/webcrypto/nss/sym_key_nss.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/child/webcrypto/nss/sym_key_nss.h"
-
-#include "base/logging.h"
-#include "content/child/webcrypto/crypto_data.h"
-#include "content/child/webcrypto/nss/key_nss.h"
-#include "content/child/webcrypto/nss/util_nss.h"
-#include "content/child/webcrypto/status.h"
-#include "content/child/webcrypto/webcrypto_util.h"
-#include "crypto/scoped_nss_types.h"
-#include "third_party/WebKit/public/platform/WebCryptoKeyAlgorithm.h"
-
-namespace content {
-
-namespace webcrypto {
-
-Status GenerateSecretKeyNss(const blink::WebCryptoKeyAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask usage_mask,
- unsigned keylen_bytes,
- CK_MECHANISM_TYPE mechanism,
- blink::WebCryptoKey* key) {
- DCHECK_NE(CKM_INVALID_MECHANISM, mechanism);
-
- crypto::ScopedPK11Slot slot(PK11_GetInternalKeySlot());
- if (!slot)
- return Status::OperationError();
-
- crypto::ScopedPK11SymKey pk11_key(
- PK11_KeyGen(slot.get(), mechanism, NULL, keylen_bytes, NULL));
-
- if (!pk11_key)
- return Status::OperationError();
-
- if (PK11_ExtractKeyValue(pk11_key.get()) != SECSuccess)
- return Status::OperationError();
-
- const SECItem* key_data = PK11_GetKeyData(pk11_key.get());
- if (!key_data)
- return Status::OperationError();
-
- scoped_ptr<SymKeyNss> handle(new SymKeyNss(
- pk11_key.Pass(), CryptoData(key_data->data, key_data->len)));
-
- *key = blink::WebCryptoKey::create(handle.release(),
- blink::WebCryptoKeyTypeSecret,
- extractable,
- algorithm,
- usage_mask);
- return Status::Success();
-}
-
-Status ImportKeyRawNss(const CryptoData& key_data,
- const blink::WebCryptoKeyAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask usage_mask,
- CK_MECHANISM_TYPE mechanism,
- CK_FLAGS flags,
- blink::WebCryptoKey* key) {
- DCHECK(!algorithm.isNull());
- SECItem key_item = MakeSECItemForBuffer(key_data);
-
- crypto::ScopedPK11Slot slot(PK11_GetInternalSlot());
- crypto::ScopedPK11SymKey pk11_sym_key(
- PK11_ImportSymKeyWithFlags(slot.get(),
- mechanism,
- PK11_OriginUnwrap,
- CKA_FLAGS_ONLY,
- &key_item,
- flags,
- false,
- NULL));
- if (!pk11_sym_key.get())
- return Status::OperationError();
-
- scoped_ptr<SymKeyNss> handle(new SymKeyNss(pk11_sym_key.Pass(), key_data));
-
- *key = blink::WebCryptoKey::create(handle.release(),
- blink::WebCryptoKeyTypeSecret,
- extractable,
- algorithm,
- usage_mask);
- return Status::Success();
-}
-
-} // namespace webcrypto
-
-} // namespace content
« no previous file with comments | « content/child/webcrypto/nss/sym_key_nss.h ('k') | content/child/webcrypto/nss/util_nss.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698