+/* Generates DSA key pair. Complies with FIPS186-2. Uses 160 bit q. */
+
+SILC_PKCS_ALG_GENERATE_KEY(silc_dsa_fips186_2_generate_key)
+{
+ return silc_dsa_generate_key_int(pkcs, 160, "sha1", keylen, rng,
+ ret_public_key, ret_private_key);
+}
+
+/* Generates DSA key pair. Complies with FIPS186-3. Same as the FIPS186-2
+ but determines the length of q automatically. */
+
+SILC_PKCS_ALG_GENERATE_KEY(silc_dsa_generate_key)
+{
+ SilcUInt32 q_len;
+ const char *hash;
+
+ if (keylen <= 1024) {
+ q_len = 160;
+ hash = "sha1";
+ } else if (keylen <= 2048) {
+ q_len = 224;
+ hash = "sha224";
+ } else {
+ q_len = 256;
+ hash = "sha256";
+ }
+
+ return silc_dsa_generate_key_int(pkcs, q_len, hash, keylen, rng,
+ ret_public_key, ret_private_key);
+}
+