OLD | NEW |
(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 }; |
| 23 |
| 24 static struct nssOps nss_ops = { |
| 25 SSL_RSA_MIN_MODULUS_BITS, |
| 26 SSL_DH_MIN_P_BITS, |
| 27 SSL_DSA_MIN_P_BITS |
| 28 }; |
| 29 |
| 30 SECStatus |
| 31 NSS_OptionSet(PRInt32 which, PRInt32 value) |
| 32 { |
| 33 SECStatus rv = SECSuccess; |
| 34 |
| 35 switch (which) { |
| 36 case NSS_RSA_MIN_KEY_SIZE: |
| 37 nss_ops.rsaMinKeySize = value; |
| 38 break; |
| 39 case NSS_DH_MIN_KEY_SIZE: |
| 40 nss_ops.dhMinKeySize = value; |
| 41 break; |
| 42 case NSS_DSA_MIN_KEY_SIZE: |
| 43 nss_ops.dsaMinKeySize = value; |
| 44 break; |
| 45 default: |
| 46 rv = SECFailure; |
| 47 } |
| 48 |
| 49 return rv; |
| 50 } |
| 51 |
| 52 SECStatus |
| 53 NSS_OptionGet(PRInt32 which, PRInt32 *value) |
| 54 { |
| 55 SECStatus rv = SECSuccess; |
| 56 |
| 57 switch (which) { |
| 58 case NSS_RSA_MIN_KEY_SIZE: |
| 59 *value = nss_ops.rsaMinKeySize; |
| 60 break; |
| 61 case NSS_DH_MIN_KEY_SIZE: |
| 62 *value = nss_ops.dhMinKeySize; |
| 63 break; |
| 64 case NSS_DSA_MIN_KEY_SIZE: |
| 65 *value = nss_ops.dsaMinKeySize; |
| 66 break; |
| 67 default: |
| 68 rv = SECFailure; |
| 69 } |
| 70 |
| 71 return rv; |
| 72 } |
| 73 |
OLD | NEW |