OLD | NEW |
---|---|
1 /* | 1 /* |
2 * crypto.h - public data structures and prototypes for the crypto library | 2 * crypto.h - public data structures and prototypes for the crypto library |
3 * | 3 * |
4 * This Source Code Form is subject to the terms of the Mozilla Public | 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 | 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/. */ | 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
7 /* $Id: blapi.h,v 1.48 2012/06/28 17:55:05 rrelyea%redhat.com Exp $ */ | 7 /* $Id: blapi.h,v 1.48 2012/06/28 17:55:05 rrelyea%redhat.com Exp $ */ |
8 | 8 |
9 #ifndef _BLAPI_H_ | 9 #ifndef _BLAPI_H_ |
10 #define _BLAPI_H_ | 10 #define _BLAPI_H_ |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1222 PRNGTEST_Reseed(const PRUint8 *entropy, unsigned int entropy_len, | 1222 PRNGTEST_Reseed(const PRUint8 *entropy, unsigned int entropy_len, |
1223 const PRUint8 *additional, unsigned int additional_len); | 1223 const PRUint8 *additional, unsigned int additional_len); |
1224 | 1224 |
1225 extern SECStatus | 1225 extern SECStatus |
1226 PRNGTEST_Generate(PRUint8 *bytes, unsigned int bytes_len, | 1226 PRNGTEST_Generate(PRUint8 *bytes, unsigned int bytes_len, |
1227 const PRUint8 *additional, unsigned int additional_len); | 1227 const PRUint8 *additional, unsigned int additional_len); |
1228 | 1228 |
1229 extern SECStatus | 1229 extern SECStatus |
1230 PRNGTEST_Uninstantiate(void); | 1230 PRNGTEST_Uninstantiate(void); |
1231 | 1231 |
1232 extern SECStatus | |
1233 PRNGTEST_RunHealthTests(void); | |
1234 | |
1232 /* Generate PQGParams and PQGVerify structs. | 1235 /* Generate PQGParams and PQGVerify structs. |
1233 * Length of seed and length of h both equal length of P. | 1236 * Length of seed and length of h both equal length of P. |
1234 * All lengths are specified by "j", according to the table above. | 1237 * All lengths are specified by "j", according to the table above. |
1238 * | |
1239 * The verify parameters will conform to FIPS186-1. | |
1235 */ | 1240 */ |
1236 extern SECStatus | 1241 extern SECStatus |
1237 PQG_ParamGen(unsigned int j, /* input : determines length of P. */ | 1242 PQG_ParamGen(unsigned int j, /* input : determines length of P. */ |
1238 PQGParams **pParams, /* output: P Q and G returned here */ | 1243 PQGParams **pParams, /* output: P Q and G returned here */ |
1239 PQGVerify **pVfy); /* output: counter and seed. */ | 1244 PQGVerify **pVfy); /* output: counter and seed. */ |
1240 | 1245 |
1241 /* Generate PQGParams and PQGVerify structs. | 1246 /* Generate PQGParams and PQGVerify structs. |
1242 * Length of P specified by j. Length of h will match length of P. | 1247 * Length of P specified by j. Length of h will match length of P. |
1243 * Length of SEED in bytes specified in seedBytes. | 1248 * Length of SEED in bytes specified in seedBytes. |
1244 * seedBbytes must be in the range [20..255] or an error will result. | 1249 * seedBbytes must be in the range [20..255] or an error will result. |
1250 * | |
1251 * The verify parameters will conform to FIPS186-1. | |
1245 */ | 1252 */ |
1246 extern SECStatus | 1253 extern SECStatus |
1247 PQG_ParamGenSeedLen( | 1254 PQG_ParamGenSeedLen( |
1248 unsigned int j, /* input : determines length of P. */ | 1255 unsigned int j, /* input : determines length of P. */ |
1249 unsigned int seedBytes, /* input : length of seed in bytes.*/ | 1256 unsigned int seedBytes, /* input : length of seed in bytes.*/ |
1250 PQGParams **pParams, /* output: P Q and G returned here */ | 1257 PQGParams **pParams, /* output: P Q and G returned here */ |
1251 PQGVerify **pVfy); /* output: counter and seed. */ | 1258 PQGVerify **pVfy); /* output: counter and seed. */ |
1252 | 1259 |
1260 /* Generate PQGParams and PQGVerify structs. | |
1261 * Length of P specified by L in bits. | |
1262 * Length of Q specified by N in bits. | |
1263 * Length of SEED in bytes specified in seedBytes. | |
1264 * seedBbytes must be in the range [N..L*2] or an error will result. | |
Ryan Sleevi
2012/09/25 21:56:55
typo: seedBbytes -> seedBytes
| |
1265 * | |
1266 * Not that J uses the above table, L is the length exact. L and N must | |
1267 * match the table below or an error will result: | |
1268 * | |
1269 * L N | |
1270 * 1024 160 | |
1271 * 2048 224 | |
1272 * 2048 256 | |
1273 * 3072 256 | |
1274 * | |
1275 * The verify parameters will conform to FIPS186-3 using the smallest | |
1276 * permissible hash for the key strength. | |
1277 */ | |
1278 extern SECStatus | |
1279 PQG_ParamGenV2( | |
1280 unsigned int L, /* input : determines length of P. */ | |
1281 unsigned int N, /* input : determines length of Q. */ | |
1282 unsigned int seedBytes, /* input : length of seed in bytes.*/ | |
1283 PQGParams **pParams, /* output: P Q and G returned here */ | |
1284 PQGVerify **pVfy); /* output: counter and seed. */ | |
1285 | |
1253 | 1286 |
1254 /* Test PQGParams for validity as DSS PQG values. | 1287 /* Test PQGParams for validity as DSS PQG values. |
1255 * If vfy is non-NULL, test PQGParams to make sure they were generated | 1288 * If vfy is non-NULL, test PQGParams to make sure they were generated |
1256 * using the specified seed, counter, and h values. | 1289 * using the specified seed, counter, and h values. |
1257 * | 1290 * |
1258 * Return value indicates whether Verification operation ran successfully | 1291 * Return value indicates whether Verification operation ran successfully |
1259 * to completion, but does not indicate if PQGParams are valid or not. | 1292 * to completion, but does not indicate if PQGParams are valid or not. |
1260 * If return value is SECSuccess, then *pResult has these meanings: | 1293 * If return value is SECSuccess, then *pResult has these meanings: |
1261 * SECSuccess: PQGParams are valid. | 1294 * SECSuccess: PQGParams are valid. |
1262 * SECFailure: PQGParams are invalid. | 1295 * SECFailure: PQGParams are invalid. |
1263 * | 1296 * |
1264 * Verify the following 12 facts about PQG counter SEED g and h | 1297 * Verify the PQG againts the counter, SEED and h. |
1265 * 1. Q is 160 bits long. | 1298 * These tests are specified in FIPS 186-3 Appendix A.1.1.1, A.1.1.3, and A.2.2 |
1266 * 2. P is one of the 9 valid lengths. | 1299 * PQG_VerifyParams will automatically choose the appropriate test. |
1267 * 3. G < P | |
1268 * 4. P % Q == 1 | |
1269 * 5. Q is prime | |
1270 * 6. P is prime | |
1271 * Steps 7-12 are done only if the optional PQGVerify is supplied. | |
1272 * 7. counter < 4096 | |
1273 * 8. g >= 160 and g < 2048 (g is length of seed in bits) | |
1274 * 9. Q generated from SEED matches Q in PQGParams. | |
1275 * 10. P generated from (L, counter, g, SEED, Q) matches P in PQGParams. | |
1276 * 11. 1 < h < P-1 | |
1277 * 12. G generated from h matches G in PQGParams. | |
1278 */ | 1300 */ |
1279 | 1301 |
1280 extern SECStatus PQG_VerifyParams(const PQGParams *params, | 1302 extern SECStatus PQG_VerifyParams(const PQGParams *params, |
1281 const PQGVerify *vfy, SECStatus *result); | 1303 const PQGVerify *vfy, SECStatus *result); |
1282 | 1304 |
1283 extern void PQG_DestroyParams(PQGParams *params); | 1305 extern void PQG_DestroyParams(PQGParams *params); |
1284 | 1306 |
1285 extern void PQG_DestroyVerify(PQGVerify *vfy); | 1307 extern void PQG_DestroyVerify(PQGVerify *vfy); |
1286 | 1308 |
1287 | 1309 |
(...skipping 23 matching lines...) Expand all Loading... | |
1311 PRBool BLAPI_VerifySelf(const char *name); | 1333 PRBool BLAPI_VerifySelf(const char *name); |
1312 | 1334 |
1313 /*********************************************************************/ | 1335 /*********************************************************************/ |
1314 extern const SECHashObject * HASH_GetRawHashObject(HASH_HashType hashType); | 1336 extern const SECHashObject * HASH_GetRawHashObject(HASH_HashType hashType); |
1315 | 1337 |
1316 extern void BL_SetForkState(PRBool forked); | 1338 extern void BL_SetForkState(PRBool forked); |
1317 | 1339 |
1318 SEC_END_PROTOS | 1340 SEC_END_PROTOS |
1319 | 1341 |
1320 #endif /* _BLAPI_H_ */ | 1342 #endif /* _BLAPI_H_ */ |
OLD | NEW |