Commit 83ae8124 authored by Matt Caswell's avatar Matt Caswell
Browse files

Fix no-dsa



Misc fixes for no-dsa.

Reviewed-by: default avatarRichard Levitte <levitte@openssl.org>
parent b75ac3c2
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -171,7 +171,10 @@ int dhparam_main(int argc, char **argv)
    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;

@@ -211,7 +214,9 @@ int dhparam_main(int argc, char **argv)
            text = 1;
            break;
        case OPT_DSAPARAM:
#ifndef OPENSSL_NO_DSA
            dsaparam = 1;
#endif
            break;
        case OPT_C:
            C = 1;
+5 −2
Original line number Diff line number Diff line
@@ -167,7 +167,10 @@ int rsa_main(int argc, char **argv)
    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);
@@ -217,7 +220,7 @@ int rsa_main(int argc, char **argv)
        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;
+13 −4
Original line number Diff line number Diff line
@@ -547,6 +547,7 @@ static OPT_PAIR doit_choices[] = {
    {NULL}
};

#ifndef OPENSSL_NO_DSA
# define R_DSA_512       0
# define R_DSA_1024      1
# define R_DSA_2048      2
@@ -556,6 +557,7 @@ static OPT_PAIR dsa_choices[] = {
    {"dsa2048", R_DSA_2048},
    {NULL},
};
#endif

#define R_RSA_512       0
#define R_RSA_1024      1
@@ -1247,7 +1249,10 @@ int speed_main(int argc, char **argv)
    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
@@ -1395,8 +1400,10 @@ int speed_main(int argc, char **argv)
        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;
@@ -1612,8 +1619,10 @@ int speed_main(int argc, char **argv)
                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;
+6 −0
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
                                       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);
@@ -126,6 +127,7 @@ static DSA_SIG *cryptodev_dsa_do_sign(const unsigned char *dgst, int dlen,
                                      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,
@@ -1384,6 +1386,7 @@ static RSA_METHOD cryptodev_rsa = {
    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)
@@ -1526,6 +1529,7 @@ static DSA_METHOD cryptodev_dsa = {
    0,                          /* flags */
    NULL                        /* app_data */
};
#endif

#ifndef OPENSSL_NO_DH
static int
@@ -1665,6 +1669,7 @@ void engine_load_cryptodev_internal(void)
        }
    }

#ifndef OPENSSL_NO_DSA
    if (ENGINE_set_DSA(engine, &cryptodev_dsa)) {
        const DSA_METHOD *meth = DSA_OpenSSL();

@@ -1678,6 +1683,7 @@ void engine_load_cryptodev_internal(void)
        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)) {
+5 −3
Original line number Diff line number Diff line
@@ -13,8 +13,8 @@ setup("test_cms");

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;

@@ -59,7 +59,7 @@ my @smime_pkcs7_tests = (
	"-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",
@@ -477,6 +477,8 @@ sub check_availability {
        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 "";
}