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

Unified Diff: crypto/aes_128_gcm_helpers_nss.h

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 9 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 | « crypto/aead_openssl_unittest.cc ('k') | crypto/aes_128_gcm_helpers_nss.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/aes_128_gcm_helpers_nss.h
diff --git a/crypto/aes_128_gcm_helpers_nss.h b/crypto/aes_128_gcm_helpers_nss.h
new file mode 100644
index 0000000000000000000000000000000000000000..dadc56e0f0d202c01d7b3c21d2d8b0d5fd51dd54
--- /dev/null
+++ b/crypto/aes_128_gcm_helpers_nss.h
@@ -0,0 +1,48 @@
+// Copyright 2015 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.
+
+#ifndef CRYPTO_AES_128_GCM_HELPERS_NSS_H_
+#define CRYPTO_AES_128_GCM_HELPERS_NSS_H_
+
+#include <pk11pub.h>
+#include <secerr.h>
+
+#include "crypto/crypto_export.h"
+
+namespace crypto {
+
+// When using the CKM_AES_GCM mechanism, one must consider that the mechanism
+// had a bug in NSS 3.14.x (https://bugzilla.mozilla.org/show_bug.cgi?id=853285)
+// which also lacks the PK11_Decrypt and PK11_Encrypt functions.
+// (https://bugzilla.mozilla.org/show_bug.cgi?id=854063)
+//
+// While both these bugs were resolved in NSS 3.15, certain builds of Chromium
+// may still be loading older versions of NSS as the system libraries. These
+// helper methods emulate support by using CKM_AES_CTR and the GaloisHash.
+
+// Helper function for using PK11_Decrypt. |mechanism| must be set to
+// CKM_AES_GCM for this method.
+CRYPTO_EXPORT SECStatus PK11DecryptHelper(PK11SymKey* key,
+ CK_MECHANISM_TYPE mechanism,
+ SECItem* param,
+ unsigned char* out,
+ unsigned int* out_len,
+ unsigned int max_len,
+ const unsigned char* data,
+ unsigned int data_len);
+
+// Helper function for using PK11_Encrypt. |mechanism| must be set to
+// CKM_AES_GCM for this method.
+CRYPTO_EXPORT SECStatus PK11EncryptHelper(PK11SymKey* key,
+ CK_MECHANISM_TYPE mechanism,
+ SECItem* param,
+ unsigned char* out,
+ unsigned int* out_len,
+ unsigned int max_len,
+ const unsigned char* data,
+ unsigned int data_len);
+
+} // namespace crypto
+
+#endif // CRYPTO_AES_128_GCM_HELPERS_NSS_H_
« no previous file with comments | « crypto/aead_openssl_unittest.cc ('k') | crypto/aes_128_gcm_helpers_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698