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

Side by Side Diff: nss/lib/nss/nssoptions.c

Issue 2078763002: Delete bundled copy of NSS and replace with README. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss@master
Patch Set: Delete bundled copy of NSS and replace with README. Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « nss/lib/nss/nssoptions.h ('k') | nss/lib/nss/nssrenam.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * NSS utility functions
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8 #include <ctype.h>
9 #include <string.h>
10 #include <assert.h>
11
12 #include "seccomon.h"
13 #include "secoidt.h"
14 #include "secoid.h"
15 #include "nss.h"
16 #include "nssoptions.h"
17
18 struct nssOps {
19 PRInt32 rsaMinKeySize;
20 PRInt32 dhMinKeySize;
21 PRInt32 dsaMinKeySize;
22 PRInt32 tlsVersionMinPolicy;
23 PRInt32 tlsVersionMaxPolicy;
24 PRInt32 dtlsVersionMinPolicy;
25 PRInt32 dtlsVersionMaxPolicy;
26 };
27
28 static struct nssOps nss_ops = {
29 SSL_RSA_MIN_MODULUS_BITS,
30 SSL_DH_MIN_P_BITS,
31 SSL_DSA_MIN_P_BITS,
32 1, /* Set TLS min to less the the smallest legal SSL value */
33 0xffff, /* set TLS max to more than the largest legal SSL value */
34 1,
35 0xffff,
36 };
37
38 SECStatus
39 NSS_OptionSet(PRInt32 which, PRInt32 value)
40 {
41 SECStatus rv = SECSuccess;
42
43 switch (which) {
44 case NSS_RSA_MIN_KEY_SIZE:
45 nss_ops.rsaMinKeySize = value;
46 break;
47 case NSS_DH_MIN_KEY_SIZE:
48 nss_ops.dhMinKeySize = value;
49 break;
50 case NSS_DSA_MIN_KEY_SIZE:
51 nss_ops.dsaMinKeySize = value;
52 break;
53 case NSS_TLS_VERSION_MIN_POLICY:
54 nss_ops.tlsVersionMinPolicy = value;
55 break;
56 case NSS_TLS_VERSION_MAX_POLICY:
57 nss_ops.tlsVersionMaxPolicy = value;
58 break;
59 case NSS_DTLS_VERSION_MIN_POLICY:
60 nss_ops.dtlsVersionMinPolicy = value;
61 break;
62 case NSS_DTLS_VERSION_MAX_POLICY:
63 nss_ops.dtlsVersionMaxPolicy = value;
64 break;
65 default:
66 rv = SECFailure;
67 }
68
69 return rv;
70 }
71
72 SECStatus
73 NSS_OptionGet(PRInt32 which, PRInt32 *value)
74 {
75 SECStatus rv = SECSuccess;
76
77 switch (which) {
78 case NSS_RSA_MIN_KEY_SIZE:
79 *value = nss_ops.rsaMinKeySize;
80 break;
81 case NSS_DH_MIN_KEY_SIZE:
82 *value = nss_ops.dhMinKeySize;
83 break;
84 case NSS_DSA_MIN_KEY_SIZE:
85 *value = nss_ops.dsaMinKeySize;
86 break;
87 case NSS_TLS_VERSION_MIN_POLICY:
88 *value = nss_ops.tlsVersionMinPolicy;
89 break;
90 case NSS_TLS_VERSION_MAX_POLICY:
91 *value = nss_ops.tlsVersionMaxPolicy;
92 break;
93 case NSS_DTLS_VERSION_MIN_POLICY:
94 *value = nss_ops.dtlsVersionMinPolicy;
95 break;
96 case NSS_DTLS_VERSION_MAX_POLICY:
97 *value = nss_ops.dtlsVersionMaxPolicy;
98 break;
99 default:
100 rv = SECFailure;
101 }
102
103 return rv;
104 }
105
OLDNEW
« no previous file with comments | « nss/lib/nss/nssoptions.h ('k') | nss/lib/nss/nssrenam.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698