| 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.47 2012/06/12 16:39:00 rrelyea%redhat.com Exp $ */ |
| 8 | 8 |
| 9 #ifndef _BLAPI_H_ | 9 #ifndef _BLAPI_H_ |
| 10 #define _BLAPI_H_ | 10 #define _BLAPI_H_ |
| 11 | 11 |
| 12 #include "blapit.h" | 12 #include "blapit.h" |
| 13 #include "hasht.h" | 13 #include "hasht.h" |
| 14 #include "alghmac.h" | 14 #include "alghmac.h" |
| 15 | 15 |
| 16 SEC_BEGIN_PROTOS | 16 SEC_BEGIN_PROTOS |
| 17 | 17 |
| (...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 /* Generate PQGParams and PQGVerify structs. | 1232 /* Generate PQGParams and PQGVerify structs. |
| 1233 * Length of seed and length of h both equal length of P. | 1233 * Length of seed and length of h both equal length of P. |
| 1234 * All lengths are specified by "j", according to the table above. | 1234 * All lengths are specified by "j", according to the table above. |
| 1235 * |
| 1236 * The verify parameters will conform to FIPS186-1. |
| 1235 */ | 1237 */ |
| 1236 extern SECStatus | 1238 extern SECStatus |
| 1237 PQG_ParamGen(unsigned int j, /* input : determines length of P. */ | 1239 PQG_ParamGen(unsigned int j, /* input : determines length of P. */ |
| 1238 PQGParams **pParams, /* output: P Q and G returned here */ | 1240 PQGParams **pParams, /* output: P Q and G returned here */ |
| 1239 PQGVerify **pVfy); /* output: counter and seed. */ | 1241 PQGVerify **pVfy); /* output: counter and seed. */ |
| 1240 | 1242 |
| 1241 /* Generate PQGParams and PQGVerify structs. | 1243 /* Generate PQGParams and PQGVerify structs. |
| 1242 * Length of P specified by j. Length of h will match length of P. | 1244 * Length of P specified by j. Length of h will match length of P. |
| 1243 * Length of SEED in bytes specified in seedBytes. | 1245 * Length of SEED in bytes specified in seedBytes. |
| 1244 * seedBbytes must be in the range [20..255] or an error will result. | 1246 * seedBbytes must be in the range [20..255] or an error will result. |
| 1247 * |
| 1248 * The verify parameters will conform to FIPS186-1. |
| 1245 */ | 1249 */ |
| 1246 extern SECStatus | 1250 extern SECStatus |
| 1247 PQG_ParamGenSeedLen( | 1251 PQG_ParamGenSeedLen( |
| 1248 unsigned int j, /* input : determines length of P. */ | 1252 unsigned int j, /* input : determines length of P. */ |
| 1249 unsigned int seedBytes, /* input : length of seed in bytes.*/ | 1253 unsigned int seedBytes, /* input : length of seed in bytes.*/ |
| 1250 PQGParams **pParams, /* output: P Q and G returned here */ | 1254 PQGParams **pParams, /* output: P Q and G returned here */ |
| 1251 PQGVerify **pVfy); /* output: counter and seed. */ | 1255 PQGVerify **pVfy); /* output: counter and seed. */ |
| 1252 | 1256 |
| 1257 /* Generate PQGParams and PQGVerify structs. |
| 1258 * Length of P specified by L in bits. |
| 1259 * Length of Q specified by N in bits. |
| 1260 * Length of SEED in bytes specified in seedBytes. |
| 1261 * seedBbytes must be in the range [N..L*2] or an error will result. |
| 1262 * |
| 1263 * Not that J uses the above table, L is the length exact. L and N must |
| 1264 * match the table below or an error will result: |
| 1265 * |
| 1266 * L N |
| 1267 * 1024 160 |
| 1268 * 2048 224 |
| 1269 * 2048 256 |
| 1270 * 3072 256 |
| 1271 * |
| 1272 * The verify parameters will conform to FIPS186-3 using the smallest |
| 1273 * permissible hash for the key strength. |
| 1274 */ |
| 1275 extern SECStatus |
| 1276 PQG_ParamGenV2( |
| 1277 unsigned int L, /* input : determines length of P. */ |
| 1278 unsigned int N, /* input : determines length of Q. */ |
| 1279 unsigned int seedBytes, /* input : length of seed in bytes.*/ |
| 1280 PQGParams **pParams, /* output: P Q and G returned here */ |
| 1281 PQGVerify **pVfy); /* output: counter and seed. */ |
| 1282 |
| 1253 | 1283 |
| 1254 /* Test PQGParams for validity as DSS PQG values. | 1284 /* Test PQGParams for validity as DSS PQG values. |
| 1255 * If vfy is non-NULL, test PQGParams to make sure they were generated | 1285 * If vfy is non-NULL, test PQGParams to make sure they were generated |
| 1256 * using the specified seed, counter, and h values. | 1286 * using the specified seed, counter, and h values. |
| 1257 * | 1287 * |
| 1258 * Return value indicates whether Verification operation ran successfully | 1288 * Return value indicates whether Verification operation ran successfully |
| 1259 * to completion, but does not indicate if PQGParams are valid or not. | 1289 * to completion, but does not indicate if PQGParams are valid or not. |
| 1260 * If return value is SECSuccess, then *pResult has these meanings: | 1290 * If return value is SECSuccess, then *pResult has these meanings: |
| 1261 * SECSuccess: PQGParams are valid. | 1291 * SECSuccess: PQGParams are valid. |
| 1262 * SECFailure: PQGParams are invalid. | 1292 * SECFailure: PQGParams are invalid. |
| 1263 * | 1293 * |
| 1264 * Verify the following 12 facts about PQG counter SEED g and h | 1294 * Verify the PQG againts the counter, SEED and h. |
| 1265 * 1. Q is 160 bits long. | 1295 * 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. | 1296 * 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 */ | 1297 */ |
| 1279 | 1298 |
| 1280 extern SECStatus PQG_VerifyParams(const PQGParams *params, | 1299 extern SECStatus PQG_VerifyParams(const PQGParams *params, |
| 1281 const PQGVerify *vfy, SECStatus *result); | 1300 const PQGVerify *vfy, SECStatus *result); |
| 1282 | 1301 |
| 1283 extern void PQG_DestroyParams(PQGParams *params); | 1302 extern void PQG_DestroyParams(PQGParams *params); |
| 1284 | 1303 |
| 1285 extern void PQG_DestroyVerify(PQGVerify *vfy); | 1304 extern void PQG_DestroyVerify(PQGVerify *vfy); |
| 1286 | 1305 |
| 1287 | 1306 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1311 PRBool BLAPI_VerifySelf(const char *name); | 1330 PRBool BLAPI_VerifySelf(const char *name); |
| 1312 | 1331 |
| 1313 /*********************************************************************/ | 1332 /*********************************************************************/ |
| 1314 extern const SECHashObject * HASH_GetRawHashObject(HASH_HashType hashType); | 1333 extern const SECHashObject * HASH_GetRawHashObject(HASH_HashType hashType); |
| 1315 | 1334 |
| 1316 extern void BL_SetForkState(PRBool forked); | 1335 extern void BL_SetForkState(PRBool forked); |
| 1317 | 1336 |
| 1318 SEC_END_PROTOS | 1337 SEC_END_PROTOS |
| 1319 | 1338 |
| 1320 #endif /* _BLAPI_H_ */ | 1339 #endif /* _BLAPI_H_ */ |
| OLD | NEW |