summaryrefslogtreecommitdiff
path: root/deps/openssl/openssl/crypto/dsa
diff options
context:
space:
mode:
Diffstat (limited to 'deps/openssl/openssl/crypto/dsa')
-rw-r--r--deps/openssl/openssl/crypto/dsa/dsa_ameth.c4
-rw-r--r--deps/openssl/openssl/crypto/dsa/dsa_asn1.c12
-rw-r--r--deps/openssl/openssl/crypto/dsa/dsa_err.c93
-rw-r--r--deps/openssl/openssl/crypto/dsa/dsa_gen.c6
-rw-r--r--deps/openssl/openssl/crypto/dsa/dsa_key.c4
-rw-r--r--deps/openssl/openssl/crypto/dsa/dsa_lib.c38
-rw-r--r--deps/openssl/openssl/crypto/dsa/dsa_locl.h5
-rw-r--r--deps/openssl/openssl/crypto/dsa/dsa_meth.c2
-rw-r--r--deps/openssl/openssl/crypto/dsa/dsa_ossl.c14
-rw-r--r--deps/openssl/openssl/crypto/dsa/dsa_pmeth.c8
-rw-r--r--deps/openssl/openssl/crypto/dsa/dsa_prn.c8
-rw-r--r--deps/openssl/openssl/crypto/dsa/dsa_sign.c6
-rw-r--r--deps/openssl/openssl/crypto/dsa/dsa_vrf.c2
13 files changed, 116 insertions, 86 deletions
diff --git a/deps/openssl/openssl/crypto/dsa/dsa_ameth.c b/deps/openssl/openssl/crypto/dsa/dsa_ameth.c
index d4e4066c49..9c5b8aa02e 100644
--- a/deps/openssl/openssl/crypto/dsa/dsa_ameth.c
+++ b/deps/openssl/openssl/crypto/dsa/dsa_ameth.c
@@ -254,7 +254,7 @@ static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
static int int_dsa_size(const EVP_PKEY *pkey)
{
- return (DSA_size(pkey->pkey.dsa));
+ return DSA_size(pkey->pkey.dsa);
}
static int dsa_bits(const EVP_PKEY *pkey)
@@ -369,7 +369,7 @@ static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype)
goto err;
ret = 1;
err:
- return (ret);
+ return ret;
}
static int dsa_param_decode(EVP_PKEY *pkey,
diff --git a/deps/openssl/openssl/crypto/dsa/dsa_asn1.c b/deps/openssl/openssl/crypto/dsa/dsa_asn1.c
index 551c107506..6499e87ef3 100644
--- a/deps/openssl/openssl/crypto/dsa/dsa_asn1.c
+++ b/deps/openssl/openssl/crypto/dsa/dsa_asn1.c
@@ -75,7 +75,7 @@ static int dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
}
ASN1_SEQUENCE_cb(DSAPrivateKey, dsa_cb) = {
- ASN1_SIMPLE(DSA, version, LONG),
+ ASN1_EMBED(DSA, version, INT32),
ASN1_SIMPLE(DSA, p, BIGNUM),
ASN1_SIMPLE(DSA, q, BIGNUM),
ASN1_SIMPLE(DSA, g, BIGNUM),
@@ -111,15 +111,15 @@ int DSA_sign(int type, const unsigned char *dgst, int dlen,
unsigned char *sig, unsigned int *siglen, DSA *dsa)
{
DSA_SIG *s;
- RAND_seed(dgst, dlen);
+
s = DSA_do_sign(dgst, dlen, dsa);
if (s == NULL) {
*siglen = 0;
- return (0);
+ return 0;
}
*siglen = i2d_DSA_SIG(s, &sig);
DSA_SIG_free(s);
- return (1);
+ return 1;
}
/* data has already been hashed (probably with SHA or SHA-1). */
@@ -140,7 +140,7 @@ int DSA_verify(int type, const unsigned char *dgst, int dgst_len,
s = DSA_SIG_new();
if (s == NULL)
- return (ret);
+ return ret;
if (d2i_DSA_SIG(&s, &p, siglen) == NULL)
goto err;
/* Ensure signature uses DER and doesn't have trailing garbage */
@@ -151,5 +151,5 @@ int DSA_verify(int type, const unsigned char *dgst, int dgst_len,
err:
OPENSSL_clear_free(der, derlen);
DSA_SIG_free(s);
- return (ret);
+ return ret;
}
diff --git a/deps/openssl/openssl/crypto/dsa/dsa_err.c b/deps/openssl/openssl/crypto/dsa/dsa_err.c
index 132008803e..8f97f6f3f9 100644
--- a/deps/openssl/openssl/crypto/dsa/dsa_err.c
+++ b/deps/openssl/openssl/crypto/dsa/dsa_err.c
@@ -8,57 +8,57 @@
* https://www.openssl.org/source/license.html
*/
-#include <stdio.h>
#include <openssl/err.h>
-#include <openssl/dsa.h>
+#include <openssl/dsaerr.h>
-/* BEGIN ERROR CODES */
#ifndef OPENSSL_NO_ERR
-# define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSA,func,0)
-# define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSA,0,reason)
-
-static ERR_STRING_DATA DSA_str_functs[] = {
- {ERR_FUNC(DSA_F_DSAPARAMS_PRINT), "DSAparams_print"},
- {ERR_FUNC(DSA_F_DSAPARAMS_PRINT_FP), "DSAparams_print_fp"},
- {ERR_FUNC(DSA_F_DSA_BUILTIN_PARAMGEN), "dsa_builtin_paramgen"},
- {ERR_FUNC(DSA_F_DSA_BUILTIN_PARAMGEN2), "dsa_builtin_paramgen2"},
- {ERR_FUNC(DSA_F_DSA_DO_SIGN), "DSA_do_sign"},
- {ERR_FUNC(DSA_F_DSA_DO_VERIFY), "DSA_do_verify"},
- {ERR_FUNC(DSA_F_DSA_METH_DUP), "DSA_meth_dup"},
- {ERR_FUNC(DSA_F_DSA_METH_NEW), "DSA_meth_new"},
- {ERR_FUNC(DSA_F_DSA_METH_SET1_NAME), "DSA_meth_set1_name"},
- {ERR_FUNC(DSA_F_DSA_NEW_METHOD), "DSA_new_method"},
- {ERR_FUNC(DSA_F_DSA_PARAM_DECODE), "dsa_param_decode"},
- {ERR_FUNC(DSA_F_DSA_PRINT_FP), "DSA_print_fp"},
- {ERR_FUNC(DSA_F_DSA_PRIV_DECODE), "dsa_priv_decode"},
- {ERR_FUNC(DSA_F_DSA_PRIV_ENCODE), "dsa_priv_encode"},
- {ERR_FUNC(DSA_F_DSA_PUB_DECODE), "dsa_pub_decode"},
- {ERR_FUNC(DSA_F_DSA_PUB_ENCODE), "dsa_pub_encode"},
- {ERR_FUNC(DSA_F_DSA_SIGN), "DSA_sign"},
- {ERR_FUNC(DSA_F_DSA_SIGN_SETUP), "DSA_sign_setup"},
- {ERR_FUNC(DSA_F_DSA_SIG_NEW), "DSA_SIG_new"},
- {ERR_FUNC(DSA_F_OLD_DSA_PRIV_DECODE), "old_dsa_priv_decode"},
- {ERR_FUNC(DSA_F_PKEY_DSA_CTRL), "pkey_dsa_ctrl"},
- {ERR_FUNC(DSA_F_PKEY_DSA_CTRL_STR), "pkey_dsa_ctrl_str"},
- {ERR_FUNC(DSA_F_PKEY_DSA_KEYGEN), "pkey_dsa_keygen"},
+static const ERR_STRING_DATA DSA_str_functs[] = {
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSAPARAMS_PRINT, 0), "DSAparams_print"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSAPARAMS_PRINT_FP, 0), "DSAparams_print_fp"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_BUILTIN_PARAMGEN, 0),
+ "dsa_builtin_paramgen"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_BUILTIN_PARAMGEN2, 0),
+ "dsa_builtin_paramgen2"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_DO_SIGN, 0), "DSA_do_sign"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_DO_VERIFY, 0), "DSA_do_verify"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_METH_DUP, 0), "DSA_meth_dup"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_METH_NEW, 0), "DSA_meth_new"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_METH_SET1_NAME, 0), "DSA_meth_set1_name"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_NEW_METHOD, 0), "DSA_new_method"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_PARAM_DECODE, 0), "dsa_param_decode"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_PRINT_FP, 0), "DSA_print_fp"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_PRIV_DECODE, 0), "dsa_priv_decode"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_PRIV_ENCODE, 0), "dsa_priv_encode"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_PUB_DECODE, 0), "dsa_pub_decode"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_PUB_ENCODE, 0), "dsa_pub_encode"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_SIGN, 0), "DSA_sign"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_SIGN_SETUP, 0), "DSA_sign_setup"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_DSA_SIG_NEW, 0), "DSA_SIG_new"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_OLD_DSA_PRIV_DECODE, 0),
+ "old_dsa_priv_decode"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_PKEY_DSA_CTRL, 0), "pkey_dsa_ctrl"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_PKEY_DSA_CTRL_STR, 0), "pkey_dsa_ctrl_str"},
+ {ERR_PACK(ERR_LIB_DSA, DSA_F_PKEY_DSA_KEYGEN, 0), "pkey_dsa_keygen"},
{0, NULL}
};
-static ERR_STRING_DATA DSA_str_reasons[] = {
- {ERR_REASON(DSA_R_BAD_Q_VALUE), "bad q value"},
- {ERR_REASON(DSA_R_BN_DECODE_ERROR), "bn decode error"},
- {ERR_REASON(DSA_R_BN_ERROR), "bn error"},
- {ERR_REASON(DSA_R_DECODE_ERROR), "decode error"},
- {ERR_REASON(DSA_R_INVALID_DIGEST_TYPE), "invalid digest type"},
- {ERR_REASON(DSA_R_INVALID_PARAMETERS), "invalid parameters"},
- {ERR_REASON(DSA_R_MISSING_PARAMETERS), "missing parameters"},
- {ERR_REASON(DSA_R_MODULUS_TOO_LARGE), "modulus too large"},
- {ERR_REASON(DSA_R_NO_PARAMETERS_SET), "no parameters set"},
- {ERR_REASON(DSA_R_PARAMETER_ENCODING_ERROR), "parameter encoding error"},
- {ERR_REASON(DSA_R_Q_NOT_PRIME), "q not prime"},
- {ERR_REASON(DSA_R_SEED_LEN_SMALL),
- "seed_len is less than the length of q"},
+static const ERR_STRING_DATA DSA_str_reasons[] = {
+ {ERR_PACK(ERR_LIB_DSA, 0, DSA_R_BAD_Q_VALUE), "bad q value"},
+ {ERR_PACK(ERR_LIB_DSA, 0, DSA_R_BN_DECODE_ERROR), "bn decode error"},
+ {ERR_PACK(ERR_LIB_DSA, 0, DSA_R_BN_ERROR), "bn error"},
+ {ERR_PACK(ERR_LIB_DSA, 0, DSA_R_DECODE_ERROR), "decode error"},
+ {ERR_PACK(ERR_LIB_DSA, 0, DSA_R_INVALID_DIGEST_TYPE),
+ "invalid digest type"},
+ {ERR_PACK(ERR_LIB_DSA, 0, DSA_R_INVALID_PARAMETERS), "invalid parameters"},
+ {ERR_PACK(ERR_LIB_DSA, 0, DSA_R_MISSING_PARAMETERS), "missing parameters"},
+ {ERR_PACK(ERR_LIB_DSA, 0, DSA_R_MODULUS_TOO_LARGE), "modulus too large"},
+ {ERR_PACK(ERR_LIB_DSA, 0, DSA_R_NO_PARAMETERS_SET), "no parameters set"},
+ {ERR_PACK(ERR_LIB_DSA, 0, DSA_R_PARAMETER_ENCODING_ERROR),
+ "parameter encoding error"},
+ {ERR_PACK(ERR_LIB_DSA, 0, DSA_R_Q_NOT_PRIME), "q not prime"},
+ {ERR_PACK(ERR_LIB_DSA, 0, DSA_R_SEED_LEN_SMALL),
+ "seed_len is less than the length of q"},
{0, NULL}
};
@@ -67,10 +67,9 @@ static ERR_STRING_DATA DSA_str_reasons[] = {
int ERR_load_DSA_strings(void)
{
#ifndef OPENSSL_NO_ERR
-
if (ERR_func_error_string(DSA_str_functs[0].error) == NULL) {
- ERR_load_strings(0, DSA_str_functs);
- ERR_load_strings(0, DSA_str_reasons);
+ ERR_load_strings_const(DSA_str_functs);
+ ERR_load_strings_const(DSA_str_reasons);
}
#endif
return 1;
diff --git a/deps/openssl/openssl/crypto/dsa/dsa_gen.c b/deps/openssl/openssl/crypto/dsa/dsa_gen.c
index 46f4f01ee0..383d853b6d 100644
--- a/deps/openssl/openssl/crypto/dsa/dsa_gen.c
+++ b/deps/openssl/openssl/crypto/dsa/dsa_gen.c
@@ -327,6 +327,12 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N,
if (mctx == NULL)
goto err;
+ /* make sure L > N, otherwise we'll get trapped in an infinite loop */
+ if (L <= N) {
+ DSAerr(DSA_F_DSA_BUILTIN_PARAMGEN2, DSA_R_INVALID_PARAMETERS);
+ goto err;
+ }
+
if (evpmd == NULL) {
if (N == 160)
evpmd = EVP_sha1();
diff --git a/deps/openssl/openssl/crypto/dsa/dsa_key.c b/deps/openssl/openssl/crypto/dsa/dsa_key.c
index 31442b1cff..a48af58492 100644
--- a/deps/openssl/openssl/crypto/dsa/dsa_key.c
+++ b/deps/openssl/openssl/crypto/dsa/dsa_key.c
@@ -38,7 +38,7 @@ static int dsa_builtin_keygen(DSA *dsa)
priv_key = dsa->priv_key;
do
- if (!BN_rand_range(priv_key, dsa->q))
+ if (!BN_priv_rand_range(priv_key, dsa->q))
goto err;
while (BN_is_zero(priv_key)) ;
@@ -73,5 +73,5 @@ static int dsa_builtin_keygen(DSA *dsa)
if (priv_key != dsa->priv_key)
BN_free(priv_key);
BN_CTX_free(ctx);
- return (ok);
+ return ok;
}
diff --git a/deps/openssl/openssl/crypto/dsa/dsa_lib.c b/deps/openssl/openssl/crypto/dsa/dsa_lib.c
index 08956b9e3d..1048601beb 100644
--- a/deps/openssl/openssl/crypto/dsa/dsa_lib.c
+++ b/deps/openssl/openssl/crypto/dsa/dsa_lib.c
@@ -7,10 +7,9 @@
* https://www.openssl.org/source/license.html
*/
-/* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */
-
#include <stdio.h>
#include "internal/cryptlib.h"
+#include "internal/refcount.h"
#include <openssl/bn.h>
#include "dsa_locl.h"
#include <openssl/asn1.h>
@@ -108,7 +107,7 @@ void DSA_free(DSA *r)
if (r == NULL)
return;
- CRYPTO_atomic_add(&r->references, -1, &i, r->lock);
+ CRYPTO_DOWN_REF(&r->references, &i, r->lock);
REF_PRINT_COUNT("DSA", r);
if (i > 0)
return;
@@ -136,7 +135,7 @@ int DSA_up_ref(DSA *r)
{
int i;
- if (CRYPTO_atomic_add(&r->references, 1, &i, r->lock) <= 0)
+ if (CRYPTO_UP_REF(&r->references, &i, r->lock) <= 0)
return 0;
REF_PRINT_COUNT("DSA", r);
@@ -163,17 +162,17 @@ int DSA_size(const DSA *r)
i = i2d_ASN1_INTEGER(&bs, NULL);
i += i; /* r and s */
ret = ASN1_object_size(1, i, V_ASN1_SEQUENCE);
- return (ret);
+ return ret;
}
int DSA_set_ex_data(DSA *d, int idx, void *arg)
{
- return (CRYPTO_set_ex_data(&d->ex_data, idx, arg));
+ return CRYPTO_set_ex_data(&d->ex_data, idx, arg);
}
void *DSA_get_ex_data(DSA *d, int idx)
{
- return (CRYPTO_get_ex_data(&d->ex_data, idx));
+ return CRYPTO_get_ex_data(&d->ex_data, idx);
}
int DSA_security_bits(const DSA *d)
@@ -308,6 +307,31 @@ int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key)
return 1;
}
+const BIGNUM *DSA_get0_p(const DSA *d)
+{
+ return d->p;
+}
+
+const BIGNUM *DSA_get0_q(const DSA *d)
+{
+ return d->q;
+}
+
+const BIGNUM *DSA_get0_g(const DSA *d)
+{
+ return d->g;
+}
+
+const BIGNUM *DSA_get0_pub_key(const DSA *d)
+{
+ return d->pub_key;
+}
+
+const BIGNUM *DSA_get0_priv_key(const DSA *d)
+{
+ return d->priv_key;
+}
+
void DSA_clear_flags(DSA *d, int flags)
{
d->flags &= ~flags;
diff --git a/deps/openssl/openssl/crypto/dsa/dsa_locl.h b/deps/openssl/openssl/crypto/dsa/dsa_locl.h
index 9021fce0bf..a81a4b4978 100644
--- a/deps/openssl/openssl/crypto/dsa/dsa_locl.h
+++ b/deps/openssl/openssl/crypto/dsa/dsa_locl.h
@@ -8,6 +8,7 @@
*/
#include <openssl/dsa.h>
+#include "internal/refcount.h"
struct dsa_st {
/*
@@ -15,7 +16,7 @@ struct dsa_st {
* instead of of a EVP_PKEY
*/
int pad;
- long version;
+ int32_t version;
BIGNUM *p;
BIGNUM *q; /* == 20 */
BIGNUM *g;
@@ -24,7 +25,7 @@ struct dsa_st {
int flags;
/* Normally used to cache montgomery values */
BN_MONT_CTX *method_mont_p;
- int references;
+ CRYPTO_REF_COUNT references;
CRYPTO_EX_DATA ex_data;
const DSA_METHOD *meth;
/* functional reference if 'meth' is ENGINE-provided */
diff --git a/deps/openssl/openssl/crypto/dsa/dsa_meth.c b/deps/openssl/openssl/crypto/dsa/dsa_meth.c
index 04203780c4..ff4fae44a7 100644
--- a/deps/openssl/openssl/crypto/dsa/dsa_meth.c
+++ b/deps/openssl/openssl/crypto/dsa/dsa_meth.c
@@ -132,7 +132,7 @@ int DSA_meth_set_sign_setup(DSA_METHOD *dsam,
}
int (*DSA_meth_get_verify(const DSA_METHOD *dsam))
- (const unsigned char *, int , DSA_SIG *, DSA *)
+ (const unsigned char *, int, DSA_SIG *, DSA *)
{
return dsam->dsa_do_verify;
}
diff --git a/deps/openssl/openssl/crypto/dsa/dsa_ossl.c b/deps/openssl/openssl/crypto/dsa/dsa_ossl.c
index 868283ac63..7a0b0874c5 100644
--- a/deps/openssl/openssl/crypto/dsa/dsa_ossl.c
+++ b/deps/openssl/openssl/crypto/dsa/dsa_ossl.c
@@ -7,8 +7,6 @@
* https://www.openssl.org/source/license.html
*/
-/* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */
-
#include <stdio.h>
#include "internal/cryptlib.h"
#include "internal/bn_int.h"
@@ -119,8 +117,8 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
/* Generate a blinding value */
do {
- if (!BN_rand(blind, BN_num_bits(dsa->q) - 1, BN_RAND_TOP_ANY,
- BN_RAND_BOTTOM_ANY))
+ if (!BN_priv_rand(blind, BN_num_bits(dsa->q) - 1,
+ BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY))
goto err;
} while (BN_is_zero(blind));
BN_set_flags(blind, BN_FLG_CONSTTIME);
@@ -220,7 +218,7 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
if (!BN_generate_dsa_nonce(k, dsa->q, dsa->priv_key, dgst,
dlen, ctx))
goto err;
- } else if (!BN_rand_range(k, dsa->q))
+ } else if (!BN_priv_rand_range(k, dsa->q))
goto err;
} while (BN_is_zero(k));
@@ -386,19 +384,19 @@ static int dsa_do_verify(const unsigned char *dgst, int dgst_len,
BN_free(u1);
BN_free(u2);
BN_free(t1);
- return (ret);
+ return ret;
}
static int dsa_init(DSA *dsa)
{
dsa->flags |= DSA_FLAG_CACHE_MONT_P;
- return (1);
+ return 1;
}
static int dsa_finish(DSA *dsa)
{
BN_MONT_CTX_free(dsa->method_mont_p);
- return (1);
+ return 1;
}
/*
diff --git a/deps/openssl/openssl/crypto/dsa/dsa_pmeth.c b/deps/openssl/openssl/crypto/dsa/dsa_pmeth.c
index d606316954..b4ee5a7571 100644
--- a/deps/openssl/openssl/crypto/dsa/dsa_pmeth.c
+++ b/deps/openssl/openssl/crypto/dsa/dsa_pmeth.c
@@ -31,8 +31,8 @@ typedef struct {
static int pkey_dsa_init(EVP_PKEY_CTX *ctx)
{
- DSA_PKEY_CTX *dctx;
- dctx = OPENSSL_malloc(sizeof(*dctx));
+ DSA_PKEY_CTX *dctx = OPENSSL_malloc(sizeof(*dctx));
+
if (dctx == NULL)
return 0;
dctx->nbits = 1024;
@@ -50,6 +50,7 @@ static int pkey_dsa_init(EVP_PKEY_CTX *ctx)
static int pkey_dsa_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
{
DSA_PKEY_CTX *dctx, *sctx;
+
if (!pkey_dsa_init(dst))
return 0;
sctx = src->data;
@@ -106,6 +107,7 @@ static int pkey_dsa_verify(EVP_PKEY_CTX *ctx,
static int pkey_dsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
{
DSA_PKEY_CTX *dctx = ctx->data;
+
switch (type) {
case EVP_PKEY_CTRL_DSA_PARAMGEN_BITS:
if (p1 < 256)
@@ -196,6 +198,7 @@ static int pkey_dsa_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
DSA_PKEY_CTX *dctx = ctx->data;
BN_GENCB *pcb;
int ret;
+
if (ctx->pkey_gencb) {
pcb = BN_GENCB_new();
if (pcb == NULL)
@@ -221,6 +224,7 @@ static int pkey_dsa_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
static int pkey_dsa_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
{
DSA *dsa = NULL;
+
if (ctx->pkey == NULL) {
DSAerr(DSA_F_PKEY_DSA_KEYGEN, DSA_R_NO_PARAMETERS_SET);
return 0;
diff --git a/deps/openssl/openssl/crypto/dsa/dsa_prn.c b/deps/openssl/openssl/crypto/dsa/dsa_prn.c
index f3c20ea0ac..a4a1fd5650 100644
--- a/deps/openssl/openssl/crypto/dsa/dsa_prn.c
+++ b/deps/openssl/openssl/crypto/dsa/dsa_prn.c
@@ -20,12 +20,12 @@ int DSA_print_fp(FILE *fp, const DSA *x, int off)
if ((b = BIO_new(BIO_s_file())) == NULL) {
DSAerr(DSA_F_DSA_PRINT_FP, ERR_R_BUF_LIB);
- return (0);
+ return 0;
}
BIO_set_fp(b, fp, BIO_NOCLOSE);
ret = DSA_print(b, x, off);
BIO_free(b);
- return (ret);
+ return ret;
}
int DSAparams_print_fp(FILE *fp, const DSA *x)
@@ -35,12 +35,12 @@ int DSAparams_print_fp(FILE *fp, const DSA *x)
if ((b = BIO_new(BIO_s_file())) == NULL) {
DSAerr(DSA_F_DSAPARAMS_PRINT_FP, ERR_R_BUF_LIB);
- return (0);
+ return 0;
}
BIO_set_fp(b, fp, BIO_NOCLOSE);
ret = DSAparams_print(b, x);
BIO_free(b);
- return (ret);
+ return ret;
}
#endif
diff --git a/deps/openssl/openssl/crypto/dsa/dsa_sign.c b/deps/openssl/openssl/crypto/dsa/dsa_sign.c
index 2e29d40088..e9466b29f1 100644
--- a/deps/openssl/openssl/crypto/dsa/dsa_sign.c
+++ b/deps/openssl/openssl/crypto/dsa/dsa_sign.c
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -7,8 +7,6 @@
* https://www.openssl.org/source/license.html
*/
-/* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */
-
#include "internal/cryptlib.h"
#include "dsa_locl.h"
#include <openssl/bn.h>
@@ -18,7 +16,9 @@ DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
return dsa->meth->dsa_do_sign(dgst, dlen, dsa);
}
+#if OPENSSL_API_COMPAT < 0x10200000L
int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp)
{
return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp);
}
+#endif
diff --git a/deps/openssl/openssl/crypto/dsa/dsa_vrf.c b/deps/openssl/openssl/crypto/dsa/dsa_vrf.c
index a84d521283..21f98cd94e 100644
--- a/deps/openssl/openssl/crypto/dsa/dsa_vrf.c
+++ b/deps/openssl/openssl/crypto/dsa/dsa_vrf.c
@@ -7,8 +7,6 @@
* https://www.openssl.org/source/license.html
*/
-/* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */
-
#include "internal/cryptlib.h"
#include "dsa_locl.h"