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

Unified Diff: nss/lib/nss/nssoptions.c

Issue 1504923011: Update NSS to 3.21 RTM and NSPR to 4.11 RTM (Closed) Base URL: http://src.chromium.org/svn/trunk/deps/third_party/nss
Patch Set: Created 5 years 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
Index: nss/lib/nss/nssoptions.c
diff --git a/nss/lib/nss/nssoptions.c b/nss/lib/nss/nssoptions.c
new file mode 100644
index 0000000000000000000000000000000000000000..10b0138df589813d752e911814f3c230ffd0789a
--- /dev/null
+++ b/nss/lib/nss/nssoptions.c
@@ -0,0 +1,73 @@
+/*
+ * NSS utility functions
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include <ctype.h>
+#include <string.h>
+#include <assert.h>
+
+#include "seccomon.h"
+#include "secoidt.h"
+#include "secoid.h"
+#include "nss.h"
+#include "nssoptions.h"
+
+struct nssOps {
+ PRInt32 rsaMinKeySize;
+ PRInt32 dhMinKeySize;
+ PRInt32 dsaMinKeySize;
+};
+
+static struct nssOps nss_ops = {
+ SSL_RSA_MIN_MODULUS_BITS,
+ SSL_DH_MIN_P_BITS,
+ SSL_DSA_MIN_P_BITS
+};
+
+SECStatus
+NSS_OptionSet(PRInt32 which, PRInt32 value)
+{
+SECStatus rv = SECSuccess;
+
+ switch (which) {
+ case NSS_RSA_MIN_KEY_SIZE:
+ nss_ops.rsaMinKeySize = value;
+ break;
+ case NSS_DH_MIN_KEY_SIZE:
+ nss_ops.dhMinKeySize = value;
+ break;
+ case NSS_DSA_MIN_KEY_SIZE:
+ nss_ops.dsaMinKeySize = value;
+ break;
+ default:
+ rv = SECFailure;
+ }
+
+ return rv;
+}
+
+SECStatus
+NSS_OptionGet(PRInt32 which, PRInt32 *value)
+{
+SECStatus rv = SECSuccess;
+
+ switch (which) {
+ case NSS_RSA_MIN_KEY_SIZE:
+ *value = nss_ops.rsaMinKeySize;
+ break;
+ case NSS_DH_MIN_KEY_SIZE:
+ *value = nss_ops.dhMinKeySize;
+ break;
+ case NSS_DSA_MIN_KEY_SIZE:
+ *value = nss_ops.dsaMinKeySize;
+ break;
+ default:
+ rv = SECFailure;
+ }
+
+ return rv;
+}
+

Powered by Google App Engine
This is Rietveld 408576698