Misc fixes for no-dsa.
Reviewed-by: Richard Levitte <levitte@openssl.org>
BIO *in = NULL, *out = NULL;
DH *dh = NULL;
char *infile = NULL, *outfile = NULL, *prog, *inrand = NULL;
- int dsaparam = 0, i, text = 0, C = 0, ret = 1, num = 0, g = 0;
+#ifndef OPENSSL_NO_DSA
+ int dsaparam = 0;
+#endif
+ int i, text = 0, C = 0, ret = 1, num = 0, g = 0;
int informat = FORMAT_PEM, outformat = FORMAT_PEM, check = 0, noout = 0;
OPTION_CHOICE o;
text = 1;
break;
case OPT_DSAPARAM:
+#ifndef OPENSSL_NO_DSA
dsaparam = 1;
+#endif
break;
case OPT_C:
C = 1;
char *passin = NULL, *passout = NULL, *passinarg = NULL, *passoutarg = NULL;
int i, private = 0;
int informat = FORMAT_PEM, outformat = FORMAT_PEM, text = 0, check = 0;
- int noout = 0, modulus = 0, pubin = 0, pubout = 0, pvk_encr = 2, ret = 1;
+ int noout = 0, modulus = 0, pubin = 0, pubout = 0, ret = 1;
+# if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4)
+ int pvk_encr = 2;
+#endif
OPTION_CHOICE o;
prog = opt_init(argc, argv, rsa_options);
case OPT_RSAPUBKEY_OUT:
pubout = 2;
break;
-#ifndef OPENSSL_NO_RC4
+# if !defined(OPENSSL_NO_DSA) && !defined(OPENSSL_NO_RC4)
case OPT_PVK_STRONG:
pvk_encr = 2;
break;
{NULL}
};
-#define R_DSA_512 0
-#define R_DSA_1024 1
-#define R_DSA_2048 2
+#ifndef OPENSSL_NO_DSA
+# define R_DSA_512 0
+# define R_DSA_1024 1
+# define R_DSA_2048 2
static OPT_PAIR dsa_choices[] = {
{"dsa512", R_DSA_512},
{"dsa1024", R_DSA_1024},
{"dsa2048", R_DSA_2048},
{NULL},
};
+#endif
#define R_RSA_512 0
#define R_RSA_1024 1
double d = 0.0;
OPTION_CHOICE o;
int multiblock = 0, doit[ALGOR_NUM], pr_header = 0;
- int dsa_doit[DSA_NUM], rsa_doit[RSA_NUM];
+#ifndef OPENSSL_NO_DSA
+ int dsa_doit[DSA_NUM];
+#endif
+ int rsa_doit[RSA_NUM];
int ret = 1, i, k, misalign = 0;
long c[ALGOR_NUM][SIZE_NUM], count = 0, save_count = 0;
#ifndef NO_FORK
doit[i] = 0;
for (i = 0; i < RSA_NUM; i++)
rsa_doit[i] = 0;
+#ifndef OPENSSL_NO_DSA
for (i = 0; i < DSA_NUM; i++)
dsa_doit[i] = 0;
+#endif
#ifndef OPENSSL_NO_EC
for (i = 0; i < EC_NUM; i++)
ecdsa_doit[i] = 0;
doit[i] = 1;
for (i = 0; i < RSA_NUM; i++)
rsa_doit[i] = 1;
+#ifndef OPENSSL_NO_DSA
for (i = 0; i < DSA_NUM; i++)
dsa_doit[i] = 1;
+#endif
#ifndef OPENSSL_NO_EC
for (i = 0; i < EC_NUM; i++)
ecdsa_doit[i] = 1;
BN_CTX *ctx);
static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
BN_CTX *ctx);
+#ifndef OPENSSL_NO_DSA
static int cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a,
const BIGNUM *p, const BIGNUM *m,
BN_CTX *ctx, BN_MONT_CTX *m_ctx);
DSA *dsa);
static int cryptodev_dsa_verify(const unsigned char *dgst, int dgst_len,
DSA_SIG *sig, DSA *dsa);
+#endif
#ifndef OPENSSL_NO_DH
static int cryptodev_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,
const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
NULL /* rsa_verify */
};
+#ifndef OPENSSL_NO_DSA
static int
cryptodev_dsa_bn_mod_exp(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)
0, /* flags */
NULL /* app_data */
};
+#endif
#ifndef OPENSSL_NO_DH
static int
}
}
+#ifndef OPENSSL_NO_DSA
if (ENGINE_set_DSA(engine, &cryptodev_dsa)) {
const DSA_METHOD *meth = DSA_OpenSSL();
if (cryptodev_asymfeat & CRF_DSA_VERIFY)
cryptodev_dsa.dsa_do_verify = cryptodev_dsa_verify;
}
+#endif
#ifndef OPENSSL_NO_DH
if (ENGINE_set_DH(engine, &cryptodev_dh)) {
my $smdir = srctop_dir("test", "smime-certs");
my $smcont = srctop_file("test", "smcont.txt");
-my ($no_des, $no_dh, $no_ec, $no_ec2m, $no_rc2, $no_zlib)
- = disabled qw/des dh ec ec2m rc2 zlib/;
+my ($no_des, $no_dh, $no_dsa, $no_ec, $no_ec2m, $no_rc2, $no_zlib)
+ = disabled qw/des dh dsa ec ec2m rc2 zlib/;
plan tests => 4;
"-content", $smcont ]
],
- [ "signed detached content DER format, add RSA signer",
+ [ "signed detached content DER format, add RSA signer (with DSA existing)",
[ "-resign", "-inform", "DER", "-in", "test.cms", "-outform", "DER",
"-signer", catfile($smdir, "smrsa1.pem"), "-out", "test2.cms" ],
[ "-verify", "-in", "test2.cms", "-inform", "DER",
if ($no_rc2 && $tnam =~ /RC2/);
return "$tnam: skipped, DES disabled\n"
if ($no_des && $tnam =~ /DES/);
+ return "$tnam: skipped, DSA disabled\n"
+ if ($no_dsa && $tnam =~ / DSA/);
return "";
}