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

Unified Diff: components/webcrypto/algorithms/util_openssl.cc

Issue 1355873002: [refactor] More post-NSS WebCrypto cleanups (utility functions). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address David's comments Created 5 years, 3 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 | « components/webcrypto/algorithms/util_openssl.h ('k') | components/webcrypto/jwk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webcrypto/algorithms/util_openssl.cc
diff --git a/components/webcrypto/algorithms/util_openssl.cc b/components/webcrypto/algorithms/util_openssl.cc
index 7aa96bfedaf8355fd9085e2771d23fef4bb3bda8..34b26a491979ee7c258bf5e16c34ddf3c2014aa7 100644
--- a/components/webcrypto/algorithms/util_openssl.cc
+++ b/components/webcrypto/algorithms/util_openssl.cc
@@ -127,40 +127,6 @@ Status AeadEncryptDecrypt(EncryptOrDecrypt mode,
return Status::Success();
}
-Status GenerateWebCryptoSecretKey(const blink::WebCryptoKeyAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask usages,
- unsigned int keylen_bits,
- GenerateKeyResult* result) {
- crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
-
- unsigned int keylen_bytes = NumBitsToBytes(keylen_bits);
- std::vector<unsigned char> random_bytes(keylen_bytes, 0);
-
- if (keylen_bytes > 0) {
- if (!(RAND_bytes(&random_bytes[0], keylen_bytes)))
- return Status::OperationError();
- TruncateToBitLength(keylen_bits, &random_bytes);
- }
-
- result->AssignSecretKey(blink::WebCryptoKey::create(
- CreateSymmetricKeyHandle(CryptoData(random_bytes)),
- blink::WebCryptoKeyTypeSecret, extractable, algorithm, usages));
-
- return Status::Success();
-}
-
-Status CreateWebCryptoSecretKey(const CryptoData& key_data,
- const blink::WebCryptoKeyAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask usages,
- blink::WebCryptoKey* key) {
- *key = blink::WebCryptoKey::create(CreateSymmetricKeyHandle(key_data),
- blink::WebCryptoKeyTypeSecret, extractable,
- algorithm, usages);
- return Status::Success();
-}
-
Status CreateWebCryptoPublicKey(crypto::ScopedEVP_PKEY public_key,
const blink::WebCryptoKeyAlgorithm& algorithm,
bool extractable,
« no previous file with comments | « components/webcrypto/algorithms/util_openssl.h ('k') | components/webcrypto/jwk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698