/* For FIPS compliance testing. Seed must be exactly the size of subPrime */ SECStatus DSA_NewKeyFromSeed(const PQGParams *params, const unsigned char *seed, DSAPrivateKey **privKey) { SECItem seedItem; seedItem.data = (unsigned char*) seed; seedItem.len = PQG_GetLength(¶ms->subPrime); return dsa_NewKeyExtended(params, &seedItem, privKey); }
/* For FIPS compliance testing. Seed must be exactly 20 bytes long */ SECStatus DSA_NewKeyFromSeed(const PQGParams *params, const unsigned char *seed, DSAPrivateKey **privKey) { /* TODO: check Q size */ SECItem seedItem; seedItem.data = (unsigned char*) seed; seedItem.len = DSA_SUBPRIME_LEN; return dsa_NewKeyExtended(params, &seedItem, privKey); }
/* ** Generate and return a new DSA public and private key pair, ** both of which are encoded into a single DSAPrivateKey struct. ** "params" is a pointer to the PQG parameters for the domain ** Uses a random seed. */ SECStatus DSA_NewKey(const PQGParams *params, DSAPrivateKey **privKey) { SECItem seed; SECStatus rv; seed.data = NULL; rv = DSA_NewRandom(NULL, ¶ms->subPrime, &seed); if (rv == SECSuccess) { if (seed.len != DSA_SUBPRIME_LEN) { PORT_SetError(SEC_ERROR_INVALID_ARGS); rv = SECFailure; } else { rv = dsa_NewKeyExtended(params, &seed, privKey); } } SECITEM_FreeItem(&seed, PR_FALSE); return rv; }