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 * PQG parameter generation/verification. Based on FIPS 186-3. | 6 * PQG parameter generation/verification. Based on FIPS 186-3. |
7 * | 7 * |
8 * $Id: pqg.c,v 1.25 2012/10/11 00:18:23 rrelyea%redhat.com Exp $ | 8 * $Id: pqg.c,v 1.26 2012/12/13 22:47:15 wtc%google.com Exp $ |
9 */ | 9 */ |
10 #ifdef FREEBL_NO_DEPEND | 10 #ifdef FREEBL_NO_DEPEND |
11 #include "stubs.h" | 11 #include "stubs.h" |
12 #endif | 12 #endif |
13 | 13 |
14 #include "prerr.h" | 14 #include "prerr.h" |
15 #include "secerr.h" | 15 #include "secerr.h" |
16 | 16 |
17 #include "prtypes.h" | 17 #include "prtypes.h" |
18 #include "blapi.h" | 18 #include "blapi.h" |
(...skipping 234 matching lines...) Loading... |
253 return rv; | 253 return rv; |
254 } | 254 } |
255 | 255 |
256 HASH_HashType | 256 HASH_HashType |
257 PQG_GetHashType(const PQGParams *params) | 257 PQG_GetHashType(const PQGParams *params) |
258 { | 258 { |
259 unsigned int L,N; | 259 unsigned int L,N; |
260 | 260 |
261 if (params == NULL) { | 261 if (params == NULL) { |
262 PORT_SetError(SEC_ERROR_INVALID_ARGS); | 262 PORT_SetError(SEC_ERROR_INVALID_ARGS); |
263 » return SECFailure; | 263 » return HASH_AlgNULL; |
264 } | 264 } |
265 | 265 |
266 L = PQG_GetLength(¶ms->prime)*BITS_PER_BYTE; | 266 L = PQG_GetLength(¶ms->prime)*BITS_PER_BYTE; |
267 N = PQG_GetLength(¶ms->subPrime)*BITS_PER_BYTE; | 267 N = PQG_GetLength(¶ms->subPrime)*BITS_PER_BYTE; |
268 return getFirstHash(L, N); | 268 return getFirstHash(L, N); |
269 } | 269 } |
270 | 270 |
271 /* Get a seed for generating P and Q. If in testing mode, copy in the | 271 /* Get a seed for generating P and Q. If in testing mode, copy in the |
272 ** seed from FIPS 186-1 appendix 5. Otherwise, obtain bytes from the | 272 ** seed from FIPS 186-1 appendix 5. Otherwise, obtain bytes from the |
273 ** global random number generator. | 273 ** global random number generator. |
(...skipping 1566 matching lines...) Loading... |
1840 if (vfy == NULL) | 1840 if (vfy == NULL) |
1841 return; | 1841 return; |
1842 if (vfy->arena != NULL) { | 1842 if (vfy->arena != NULL) { |
1843 PORT_FreeArena(vfy->arena, PR_FALSE); /* don't zero it */ | 1843 PORT_FreeArena(vfy->arena, PR_FALSE); /* don't zero it */ |
1844 } else { | 1844 } else { |
1845 SECITEM_FreeItem(&vfy->seed, PR_FALSE); /* don't free seed */ | 1845 SECITEM_FreeItem(&vfy->seed, PR_FALSE); /* don't free seed */ |
1846 SECITEM_FreeItem(&vfy->h, PR_FALSE); /* don't free h */ | 1846 SECITEM_FreeItem(&vfy->h, PR_FALSE); /* don't free h */ |
1847 PORT_Free(vfy); | 1847 PORT_Free(vfy); |
1848 } | 1848 } |
1849 } | 1849 } |
OLD | NEW |