OLD | NEW |
1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | 4 |
5 /* | 5 /* |
6 * RSA key generation, public key op, private key op. | 6 * RSA key generation, public key op, private key op. |
7 */ | 7 */ |
8 #ifdef FREEBL_NO_DEPEND | 8 #ifdef FREEBL_NO_DEPEND |
9 #include "stubs.h" | 9 #include "stubs.h" |
10 #endif | 10 #endif |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 unsigned int primeLen; | 241 unsigned int primeLen; |
242 mp_int p, q, e, d; | 242 mp_int p, q, e, d; |
243 int kiter; | 243 int kiter; |
244 mp_err err = MP_OKAY; | 244 mp_err err = MP_OKAY; |
245 SECStatus rv = SECSuccess; | 245 SECStatus rv = SECSuccess; |
246 int prerr = 0; | 246 int prerr = 0; |
247 RSAPrivateKey *key = NULL; | 247 RSAPrivateKey *key = NULL; |
248 PLArenaPool *arena = NULL; | 248 PLArenaPool *arena = NULL; |
249 /* Require key size to be a multiple of 16 bits. */ | 249 /* Require key size to be a multiple of 16 bits. */ |
250 if (!publicExponent || keySizeInBits % 16 != 0 || | 250 if (!publicExponent || keySizeInBits % 16 != 0 || |
251 » BAD_RSA_KEY_SIZE(keySizeInBits/8, publicExponent->len)) { | 251 » BAD_RSA_KEY_SIZE((unsigned int)keySizeInBits/8, publicExponent->len)
) { |
252 PORT_SetError(SEC_ERROR_INVALID_ARGS); | 252 PORT_SetError(SEC_ERROR_INVALID_ARGS); |
253 return NULL; | 253 return NULL; |
254 } | 254 } |
255 /* 1. Allocate arena & key */ | 255 /* 1. Allocate arena & key */ |
256 arena = PORT_NewArena(NSS_FREEBL_DEFAULT_CHUNKSIZE); | 256 arena = PORT_NewArena(NSS_FREEBL_DEFAULT_CHUNKSIZE); |
257 if (!arena) { | 257 if (!arena) { |
258 PORT_SetError(SEC_ERROR_NO_MEMORY); | 258 PORT_SetError(SEC_ERROR_NO_MEMORY); |
259 return NULL; | 259 return NULL; |
260 } | 260 } |
261 key = PORT_ArenaZNew(arena, RSAPrivateKey); | 261 key = PORT_ArenaZNew(arena, RSAPrivateKey); |
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 PRBool bl_parentForkedAfterC_Initialize; | 1545 PRBool bl_parentForkedAfterC_Initialize; |
1546 | 1546 |
1547 /* | 1547 /* |
1548 * Set fork flag so it can be tested in SKIP_AFTER_FORK on relevant platforms. | 1548 * Set fork flag so it can be tested in SKIP_AFTER_FORK on relevant platforms. |
1549 */ | 1549 */ |
1550 void BL_SetForkState(PRBool forked) | 1550 void BL_SetForkState(PRBool forked) |
1551 { | 1551 { |
1552 bl_parentForkedAfterC_Initialize = forked; | 1552 bl_parentForkedAfterC_Initialize = forked; |
1553 } | 1553 } |
1554 | 1554 |
OLD | NEW |