diff options
author | Rich Salz <rsalz@akamai.com> | 2016-02-13 22:33:56 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-02-22 13:39:44 -0500 |
commit | a773b52a61bb269e75ebbac01cfca9ebcb6c78b9 (patch) | |
tree | b70a39274abcb667620e2bb8f99570cad672ea65 /crypto | |
parent | 5de75fb4fb0a0f724c259a5477603c7d0dfd2235 (diff) |
Remove unused parameters from internal functions
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/asn1/tasn_prn.c | 20 | ||||
-rw-r--r-- | crypto/cms/cms_smime.c | 6 | ||||
-rw-r--r-- | crypto/conf/conf_mod.c | 8 | ||||
-rw-r--r-- | crypto/dh/dh_ameth.c | 57 | ||||
-rw-r--r-- | crypto/dsa/dsa_ameth.c | 50 | ||||
-rw-r--r-- | crypto/dsa/dsa_pmeth.c | 12 | ||||
-rw-r--r-- | crypto/ec/ecdh_ossl.c | 2 | ||||
-rw-r--r-- | crypto/ec/eck_prn.c | 39 | ||||
-rw-r--r-- | crypto/mem.c | 7 | ||||
-rw-r--r-- | crypto/mem_sec.c | 10 | ||||
-rw-r--r-- | crypto/ocsp/ocsp_prn.c | 6 | ||||
-rw-r--r-- | crypto/ocsp/ocsp_vfy.c | 30 | ||||
-rw-r--r-- | crypto/pem/pvkfmt.c | 16 | ||||
-rw-r--r-- | crypto/rsa/rsa_ameth.c | 52 | ||||
-rw-r--r-- | crypto/rsa/rsa_pmeth.c | 2 | ||||
-rw-r--r-- | crypto/x509v3/v3_utl.c | 6 |
16 files changed, 93 insertions, 230 deletions
diff --git a/crypto/asn1/tasn_prn.c b/crypto/asn1/tasn_prn.c index 10570ca576..f6bd2189cf 100644 --- a/crypto/asn1/tasn_prn.c +++ b/crypto/asn1/tasn_prn.c @@ -402,8 +402,7 @@ static int asn1_print_fsname(BIO *out, int indent, return 1; } -static int asn1_print_boolean_ctx(BIO *out, int boolval, - const ASN1_PCTX *pctx) +static int asn1_print_boolean(BIO *out, int boolval) { const char *str; switch (boolval) { @@ -427,8 +426,7 @@ static int asn1_print_boolean_ctx(BIO *out, int boolval, } -static int asn1_print_integer_ctx(BIO *out, ASN1_INTEGER *str, - const ASN1_PCTX *pctx) +static int asn1_print_integer(BIO *out, ASN1_INTEGER *str) { char *s; int ret = 1; @@ -439,8 +437,7 @@ static int asn1_print_integer_ctx(BIO *out, ASN1_INTEGER *str, return ret; } -static int asn1_print_oid_ctx(BIO *out, const ASN1_OBJECT *oid, - const ASN1_PCTX *pctx) +static int asn1_print_oid(BIO *out, const ASN1_OBJECT *oid) { char objbuf[80]; const char *ln; @@ -453,8 +450,7 @@ static int asn1_print_oid_ctx(BIO *out, const ASN1_OBJECT *oid, return 1; } -static int asn1_print_obstring_ctx(BIO *out, ASN1_STRING *str, int indent, - const ASN1_PCTX *pctx) +static int asn1_print_obstring(BIO *out, ASN1_STRING *str, int indent) { if (str->type == V_ASN1_BIT_STRING) { if (BIO_printf(out, " (%ld unused bits)\n", str->flags & 0x7) <= 0) @@ -523,13 +519,13 @@ static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld, int boolval = *(int *)fld; if (boolval == -1) boolval = it->size; - ret = asn1_print_boolean_ctx(out, boolval, pctx); + ret = asn1_print_boolean(out, boolval); } break; case V_ASN1_INTEGER: case V_ASN1_ENUMERATED: - ret = asn1_print_integer_ctx(out, str, pctx); + ret = asn1_print_integer(out, str); break; case V_ASN1_UTCTIME: @@ -541,12 +537,12 @@ static int asn1_primitive_print(BIO *out, ASN1_VALUE **fld, break; case V_ASN1_OBJECT: - ret = asn1_print_oid_ctx(out, (const ASN1_OBJECT *)*fld, pctx); + ret = asn1_print_oid(out, (const ASN1_OBJECT *)*fld); break; case V_ASN1_OCTET_STRING: case V_ASN1_BIT_STRING: - ret = asn1_print_obstring_ctx(out, str, indent, pctx); + ret = asn1_print_obstring(out, str, indent); needlf = 0; break; diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c index 621667bdb9..e84b7e7e5f 100644 --- a/crypto/cms/cms_smime.c +++ b/crypto/cms/cms_smime.c @@ -271,8 +271,7 @@ CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher, static int cms_signerinfo_verify_cert(CMS_SignerInfo *si, X509_STORE *store, STACK_OF(X509) *certs, - STACK_OF(X509_CRL) *crls, - unsigned int flags) + STACK_OF(X509_CRL) *crls) { X509_STORE_CTX ctx; X509 *signer; @@ -353,8 +352,7 @@ int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, crls = CMS_get1_crls(cms); for (i = 0; i < sk_CMS_SignerInfo_num(sinfos); i++) { si = sk_CMS_SignerInfo_value(sinfos, i); - if (!cms_signerinfo_verify_cert(si, store, - cms_certs, crls, flags)) + if (!cms_signerinfo_verify_cert(si, store, cms_certs, crls)) goto err; } } diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c index 9f02c77402..d78396bbdf 100644 --- a/crypto/conf/conf_mod.c +++ b/crypto/conf/conf_mod.c @@ -113,8 +113,7 @@ static CONF_MODULE *module_add(DSO *dso, const char *name, static CONF_MODULE *module_find(char *name); static int module_init(CONF_MODULE *pmod, char *name, char *value, const CONF *cnf); -static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value, - unsigned long flags); +static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value); /* Main function: load modules from a CONF structure */ @@ -204,7 +203,7 @@ static int module_run(const CONF *cnf, char *name, char *value, /* Module not found: try to load DSO */ if (!md && !(flags & CONF_MFLAGS_NO_DSO)) - md = module_load_dso(cnf, name, value, flags); + md = module_load_dso(cnf, name, value); if (!md) { if (!(flags & CONF_MFLAGS_SILENT)) { @@ -230,8 +229,7 @@ static int module_run(const CONF *cnf, char *name, char *value, } /* Load a module from a DSO */ -static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value, - unsigned long flags) +static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value) { DSO *dso = NULL; conf_init_func *ifunc; diff --git a/crypto/dh/dh_ameth.c b/crypto/dh/dh_ameth.c index fbb0613239..d644c86531 100644 --- a/crypto/dh/dh_ameth.c +++ b/crypto/dh/dh_ameth.c @@ -297,15 +297,6 @@ static int dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) return 0; } -static void update_buflen(const BIGNUM *b, size_t *pbuflen) -{ - size_t i; - if (!b) - return; - if (*pbuflen < (i = (size_t)BN_num_bytes(b))) - *pbuflen = i; -} - static int dh_param_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen) { @@ -324,15 +315,10 @@ static int dh_param_encode(const EVP_PKEY *pkey, unsigned char **pder) return i2d_dhp(pkey, pkey->pkey.dh, pder); } -static int do_dh_print(BIO *bp, const DH *x, int indent, - ASN1_PCTX *ctx, int ptype) +static int do_dh_print(BIO *bp, const DH *x, int indent, int ptype) { - unsigned char *m = NULL; int reason = ERR_R_BUF_LIB; - size_t buf_len = 0; - const char *ktype = NULL; - BIGNUM *priv_key, *pub_key; if (ptype == 2) @@ -345,20 +331,11 @@ static int do_dh_print(BIO *bp, const DH *x, int indent, else pub_key = NULL; - update_buflen(x->p, &buf_len); - - if (buf_len == 0) { + if (priv_key == NULL && pub_key == NULL) { reason = ERR_R_PASSED_NULL_PARAMETER; goto err; } - update_buflen(x->g, &buf_len); - update_buflen(x->q, &buf_len); - update_buflen(x->j, &buf_len); - update_buflen(x->counter, &buf_len); - update_buflen(pub_key, &buf_len); - update_buflen(priv_key, &buf_len); - if (ptype == 2) ktype = "DH Private-Key"; else if (ptype == 1) @@ -366,29 +343,23 @@ static int do_dh_print(BIO *bp, const DH *x, int indent, else ktype = "DH Parameters"; - m = OPENSSL_malloc(buf_len + 10); - if (m == NULL) { - reason = ERR_R_MALLOC_FAILURE; - goto err; - } - BIO_indent(bp, indent, 128); if (BIO_printf(bp, "%s: (%d bit)\n", ktype, BN_num_bits(x->p)) <= 0) goto err; indent += 4; - if (!ASN1_bn_print(bp, "private-key:", priv_key, m, indent)) + if (!ASN1_bn_print(bp, "private-key:", priv_key, NULL, indent)) goto err; - if (!ASN1_bn_print(bp, "public-key:", pub_key, m, indent)) + if (!ASN1_bn_print(bp, "public-key:", pub_key, NULL, indent)) goto err; - if (!ASN1_bn_print(bp, "prime:", x->p, m, indent)) + if (!ASN1_bn_print(bp, "prime:", x->p, NULL, indent)) goto err; - if (!ASN1_bn_print(bp, "generator:", x->g, m, indent)) + if (!ASN1_bn_print(bp, "generator:", x->g, NULL, indent)) goto err; - if (x->q && !ASN1_bn_print(bp, "subgroup order:", x->q, m, indent)) + if (x->q && !ASN1_bn_print(bp, "subgroup order:", x->q, NULL, indent)) goto err; - if (x->j && !ASN1_bn_print(bp, "subgroup factor:", x->j, m, indent)) + if (x->j && !ASN1_bn_print(bp, "subgroup factor:", x->j, NULL, indent)) goto err; if (x->seed) { int i; @@ -407,7 +378,7 @@ static int do_dh_print(BIO *bp, const DH *x, int indent, if (BIO_write(bp, "\n", 1) <= 0) return (0); } - if (x->counter && !ASN1_bn_print(bp, "counter:", x->counter, m, indent)) + if (x->counter && !ASN1_bn_print(bp, "counter:", x->counter, NULL, indent)) goto err; if (x->length != 0) { BIO_indent(bp, indent, 128); @@ -416,12 +387,10 @@ static int do_dh_print(BIO *bp, const DH *x, int indent, goto err; } - OPENSSL_free(m); return 1; err: DHerr(DH_F_DO_DH_PRINT, reason); - OPENSSL_free(m); return 0; } @@ -537,24 +506,24 @@ static int dh_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b) static int dh_param_print(BIO *bp, const EVP_PKEY *pkey, int indent, ASN1_PCTX *ctx) { - return do_dh_print(bp, pkey->pkey.dh, indent, ctx, 0); + return do_dh_print(bp, pkey->pkey.dh, indent, 0); } static int dh_public_print(BIO *bp, const EVP_PKEY *pkey, int indent, ASN1_PCTX *ctx) { - return do_dh_print(bp, pkey->pkey.dh, indent, ctx, 1); + return do_dh_print(bp, pkey->pkey.dh, indent, 1); } static int dh_private_print(BIO *bp, const EVP_PKEY *pkey, int indent, ASN1_PCTX *ctx) { - return do_dh_print(bp, pkey->pkey.dh, indent, ctx, 2); + return do_dh_print(bp, pkey->pkey.dh, indent, 2); } int DHparams_print(BIO *bp, const DH *x) { - return do_dh_print(bp, x, 4, NULL, 0); + return do_dh_print(bp, x, 4, 0); } #ifndef OPENSSL_NO_CMS diff --git a/crypto/dsa/dsa_ameth.c b/crypto/dsa/dsa_ameth.c index 5c45078e0c..e046fe79d3 100644 --- a/crypto/dsa/dsa_ameth.c +++ b/crypto/dsa/dsa_ameth.c @@ -372,22 +372,10 @@ static void int_dsa_free(EVP_PKEY *pkey) DSA_free(pkey->pkey.dsa); } -static void update_buflen(const BIGNUM *b, size_t *pbuflen) -{ - size_t i; - if (!b) - return; - if (*pbuflen < (i = (size_t)BN_num_bytes(b))) - *pbuflen = i; -} - static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype) { - unsigned char *m = NULL; int ret = 0; - size_t buf_len = 0; const char *ktype = NULL; - const BIGNUM *priv_key, *pub_key; if (ptype == 2) @@ -407,18 +395,6 @@ static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype) else ktype = "DSA-Parameters"; - update_buflen(x->p, &buf_len); - update_buflen(x->q, &buf_len); - update_buflen(x->g, &buf_len); - update_buflen(priv_key, &buf_len); - update_buflen(pub_key, &buf_len); - - m = OPENSSL_malloc(buf_len + 10); - if (m == NULL) { - DSAerr(DSA_F_DO_DSA_PRINT, ERR_R_MALLOC_FAILURE); - goto err; - } - if (priv_key) { if (!BIO_indent(bp, off, 128)) goto err; @@ -427,19 +403,18 @@ static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype) goto err; } - if (!ASN1_bn_print(bp, "priv:", priv_key, m, off)) + if (!ASN1_bn_print(bp, "priv:", priv_key, NULL, off)) goto err; - if (!ASN1_bn_print(bp, "pub: ", pub_key, m, off)) + if (!ASN1_bn_print(bp, "pub: ", pub_key, NULL, off)) goto err; - if (!ASN1_bn_print(bp, "P: ", x->p, m, off)) + if (!ASN1_bn_print(bp, "P: ", x->p, NULL, off)) goto err; - if (!ASN1_bn_print(bp, "Q: ", x->q, m, off)) + if (!ASN1_bn_print(bp, "Q: ", x->q, NULL, off)) goto err; - if (!ASN1_bn_print(bp, "G: ", x->g, m, off)) + if (!ASN1_bn_print(bp, "G: ", x->g, NULL, off)) goto err; ret = 1; err: - OPENSSL_free(m); return (ret); } @@ -502,6 +477,7 @@ static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg, { DSA_SIG *dsa_sig; const unsigned char *p; + if (!sig) { if (BIO_puts(bp, "\n") <= 0) return 0; @@ -512,26 +488,16 @@ static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg, dsa_sig = d2i_DSA_SIG(NULL, &p, sig->length); if (dsa_sig) { int rv = 0; - size_t buf_len = 0; - unsigned char *m = NULL; - update_buflen(dsa_sig->r, &buf_len); - update_buflen(dsa_sig->s, &buf_len); - m = OPENSSL_malloc(buf_len + 10); - if (m == NULL) { - DSAerr(DSA_F_DSA_SIG_PRINT, ERR_R_MALLOC_FAILURE); - goto err; - } if (BIO_write(bp, "\n", 1) != 1) goto err; - if (!ASN1_bn_print(bp, "r: ", dsa_sig->r, m, indent)) + if (!ASN1_bn_print(bp, "r: ", dsa_sig->r, NULL, indent)) goto err; - if (!ASN1_bn_print(bp, "s: ", dsa_sig->s, m, indent)) + if (!ASN1_bn_print(bp, "s: ", dsa_sig->s, NULL, indent)) goto err; rv = 1; err: - OPENSSL_free(m); DSA_SIG_free(dsa_sig); return rv; } diff --git a/crypto/dsa/dsa_pmeth.c b/crypto/dsa/dsa_pmeth.c index 1110e01b39..8eca37fd0a 100644 --- a/crypto/dsa/dsa_pmeth.c +++ b/crypto/dsa/dsa_pmeth.c @@ -120,7 +120,7 @@ static int pkey_dsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, const unsigned char *tbs, size_t tbslen) { - int ret, type; + int ret; unsigned int sltmp; DSA_PKEY_CTX *dctx = ctx->data; DSA *dsa = ctx->pkey->pkey.dsa; @@ -128,14 +128,12 @@ static int pkey_dsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, if (dctx->md) { if (tbslen != (size_t)EVP_MD_size(dctx->md)) return 0; - type = EVP_MD_type(dctx->md); } else { if (tbslen != SHA_DIGEST_LENGTH) return 0; - type = NID_sha1; } - ret = DSA_sign(type, tbs, tbslen, sig, &sltmp, dsa); + ret = DSA_sign(0, tbs, tbslen, sig, &sltmp, dsa); if (ret <= 0) return ret; @@ -147,21 +145,19 @@ static int pkey_dsa_verify(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen, const unsigned char *tbs, size_t tbslen) { - int ret, type; + int ret; DSA_PKEY_CTX *dctx = ctx->data; DSA *dsa = ctx->pkey->pkey.dsa; if (dctx->md) { if (tbslen != (size_t)EVP_MD_size(dctx->md)) return 0; - type = EVP_MD_type(dctx->md); } else { if (tbslen != SHA_DIGEST_LENGTH) return 0; - type = NID_sha1; } - ret = DSA_verify(type, tbs, tbslen, sig, siglen, dsa); + ret = DSA_verify(0, tbs, tbslen, sig, siglen, dsa); return ret; } diff --git a/crypto/ec/ecdh_ossl.c b/crypto/ec/ecdh_ossl.c index beb3fc20b8..15a179fbc6 100644 --- a/crypto/ec/ecdh_ossl.c +++ b/crypto/ec/ecdh_ossl.c @@ -118,7 +118,7 @@ int ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, group = EC_KEY_get0_group(ecdh); if (EC_KEY_get_flags(ecdh) & EC_FLAG_COFACTOR_ECDH) { - if (!EC_GROUP_get_cofactor(group, x, ctx) || + if (!EC_GROUP_get_cofactor(group, x, NULL) || !BN_mul(x, x, priv_key, ctx)) { ECerr(EC_F_OSSL_ECDH_COMPUTE_KEY, ERR_R_MALLOC_FAILURE); goto err; diff --git a/crypto/ec/eck_prn.c b/crypto/ec/eck_prn.c index fa4cf6aefc..eacdb9ed72 100644 --- a/crypto/ec/eck_prn.c +++ b/crypto/ec/eck_prn.c @@ -142,8 +142,6 @@ static int print_bin(BIO *fp, const char *str, const unsigned char *num, int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) { - unsigned char *buffer = NULL; - size_t buf_len = 0, i; int ret = 0, reason = ERR_R_BIO_LIB; BN_CTX *ctx = NULL; const EC_POINT *point = NULL; @@ -236,27 +234,9 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) goto err; } - buf_len = (size_t)BN_num_bytes(p); - if (buf_len < (i = (size_t)BN_num_bytes(a))) - buf_len = i; - if (buf_len < (i = (size_t)BN_num_bytes(b))) - buf_len = i; - if (buf_len < (i = (size_t)BN_num_bytes(gen))) - buf_len = i; - if (buf_len < (i = (size_t)BN_num_bytes(order))) - buf_len = i; - if (buf_len < (i = (size_t)BN_num_bytes(cofactor))) - buf_len = i; - if ((seed = EC_GROUP_get0_seed(x)) != NULL) seed_len = EC_GROUP_get_seed_len(x); - buf_len += 10; - if ((buffer = OPENSSL_malloc(buf_len)) == NULL) { - reason = ERR_R_MALLOC_FAILURE; - goto err; - } - if (!BIO_indent(bp, off, 128)) goto err; @@ -279,36 +259,36 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) goto err; /* print the polynomial */ - if ((p != NULL) && !ASN1_bn_print(bp, "Polynomial:", p, buffer, + if ((p != NULL) && !ASN1_bn_print(bp, "Polynomial:", p, NULL, off)) goto err; } else { - if ((p != NULL) && !ASN1_bn_print(bp, "Prime:", p, buffer, off)) + if ((p != NULL) && !ASN1_bn_print(bp, "Prime:", p, NULL, off)) goto err; } - if ((a != NULL) && !ASN1_bn_print(bp, "A: ", a, buffer, off)) + if ((a != NULL) && !ASN1_bn_print(bp, "A: ", a, NULL, off)) goto err; - if ((b != NULL) && !ASN1_bn_print(bp, "B: ", b, buffer, off)) + if ((b != NULL) && !ASN1_bn_print(bp, "B: ", b, NULL, off)) goto err; if (form == POINT_CONVERSION_COMPRESSED) { if ((gen != NULL) && !ASN1_bn_print(bp, gen_compressed, gen, - buffer, off)) + NULL, off)) goto err; } else if (form == POINT_CONVERSION_UNCOMPRESSED) { if ((gen != NULL) && !ASN1_bn_print(bp, gen_uncompressed, gen, - buffer, off)) + NULL, off)) goto err; } else { /* form == POINT_CONVERSION_HYBRID */ if ((gen != NULL) && !ASN1_bn_print(bp, gen_hybrid, gen, - buffer, off)) + NULL, off)) goto err; } if ((order != NULL) && !ASN1_bn_print(bp, "Order: ", order, - buffer, off)) + NULL, off)) goto err; if ((cofactor != NULL) && !ASN1_bn_print(bp, "Cofactor: ", cofactor, - buffer, off)) + NULL, off)) goto err; if (seed && !print_bin(bp, "Seed:", seed, seed_len, off)) goto err; @@ -322,7 +302,6 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off) BN_free(b); BN_free(gen); BN_CTX_free(ctx); - OPENSSL_free(buffer); return (ret); } diff --git a/crypto/mem.c b/crypto/mem.c index 46f00176ab..f4da4fad67 100644 --- a/crypto/mem.c +++ b/crypto/mem.c @@ -136,8 +136,7 @@ void *CRYPTO_malloc(size_t num, const char *file, int line) ret = malloc(num); } #else - (void)file; - (void)line; + osslargused(file); osslargused(line); ret = malloc(num); #endif @@ -188,8 +187,7 @@ void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) return ret; } #else - (void)file; - (void)line; + osslargused(file); osslargused(line); #endif return realloc(str, num); @@ -215,7 +213,6 @@ void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num, } ret = CRYPTO_malloc(num, file, line); - if (ret) memcpy(ret, str, old_len); CRYPTO_clear_free(str, old_len, file, line); diff --git a/crypto/mem_sec.c b/crypto/mem_sec.c index fdda487efc..7e41765b30 100644 --- a/crypto/mem_sec.c +++ b/crypto/mem_sec.c @@ -307,7 +307,7 @@ static void sh_add_to_list(char **list, char *ptr) *list = ptr; } -static void sh_remove_from_list(char *ptr, char *list) +static void sh_remove_from_list(char *ptr) { SH_LIST *temp, *temp2; @@ -484,7 +484,7 @@ static char *sh_malloc(size_t size) /* remove from bigger list */ OPENSSL_assert(!sh_testbit(temp, slist, sh.bitmalloc)); sh_clearbit(temp, slist, sh.bittable); - sh_remove_from_list(temp, sh.freelist[slist]); + sh_remove_from_list(temp); OPENSSL_assert(temp != sh.freelist[slist]); /* done with bigger list */ @@ -510,7 +510,7 @@ static char *sh_malloc(size_t size) chunk = sh.freelist[list]; OPENSSL_assert(sh_testbit(chunk, list, sh.bittable)); sh_setbit(chunk, list, sh.bitmalloc); - sh_remove_from_list(chunk, sh.freelist[list]); + sh_remove_from_list(chunk); OPENSSL_assert(WITHIN_ARENA(chunk)); @@ -539,10 +539,10 @@ static void sh_free(char *ptr) OPENSSL_assert(ptr != NULL); OPENSSL_assert(!sh_testbit(ptr, list, sh.bitmalloc)); sh_clearbit(ptr, list, sh.bittable); - sh_remove_from_list(ptr, sh.freelist[list]); + sh_remove_from_list(ptr); OPENSSL_assert(!sh_testbit(ptr, list, sh.bitmalloc)); sh_clearbit(buddy, list, sh.bittable); - sh_remove_from_list(buddy, sh.freelist[list]); + sh_remove_from_list(buddy); list--; diff --git a/crypto/ocsp/ocsp_prn.c b/crypto/ocsp/ocsp_prn.c index ff006cb892..8ac3d820ad 100644 --- a/crypto/ocsp/ocsp_prn.c +++ b/crypto/ocsp/ocsp_prn.c @@ -76,9 +76,9 @@ static int ocsp_certid_print(BIO *bp, OCSP_CERTID *a, int indent) BIO_printf(bp, "%*sHash Algorithm: ", indent, ""); i2a_ASN1_OBJECT(bp, a->hashAlgorithm.algorithm); BIO_printf(bp, "\n%*sIssuer Name Hash: ", indent, ""); - i2a_ASN1_STRING(bp, &a->issuerNameHash, V_ASN1_OCTET_STRING); + i2a_ASN1_STRING(bp, &a->issuerNameHash, 0); BIO_printf(bp, "\n%*sIssuer Key Hash: ", indent, ""); - i2a_ASN1_STRING(bp, &a->issuerKeyHash, V_ASN1_OCTET_STRING); + i2a_ASN1_STRING(bp, &a->issuerKeyHash, 0); BIO_printf(bp, "\n%*sSerial Number: ", indent, ""); i2a_ASN1_INTEGER(bp, &a->serialNumber); BIO_printf(bp, "\n"); @@ -227,7 +227,7 @@ int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags) X509_NAME_print_ex(bp, rid->value.byName, 0, XN_FLAG_ONELINE); break; case V_OCSP_RESPID_KEY: - i2a_ASN1_STRING(bp, rid->value.byKey, V_ASN1_OCTET_STRING); + i2a_ASN1_STRING(bp, rid->value.byKey, 0); break; } diff --git a/crypto/ocsp/ocsp_vfy.c b/crypto/ocsp/ocsp_vfy.c index fa4fde543f..356c79768f 100644 --- a/crypto/ocsp/ocsp_vfy.c +++ b/crypto/ocsp/ocsp_vfy.c @@ -62,19 +62,17 @@ #include <string.h> static int ocsp_find_signer(X509 **psigner, OCSP_BASICRESP *bs, - STACK_OF(X509) *certs, X509_STORE *st, - unsigned long flags); + STACK_OF(X509) *certs, unsigned long flags); static X509 *ocsp_find_signer_sk(STACK_OF(X509) *certs, OCSP_RESPID *id); -static int ocsp_check_issuer(OCSP_BASICRESP *bs, STACK_OF(X509) *chain, - unsigned long flags); +static int ocsp_check_issuer(OCSP_BASICRESP *bs, STACK_OF(X509) *chain); static int ocsp_check_ids(STACK_OF(OCSP_SINGLERESP) *sresp, OCSP_CERTID **ret); static int ocsp_match_issuerid(X509 *cert, OCSP_CERTID *cid, STACK_OF(OCSP_SINGLERESP) *sresp); -static int ocsp_check_delegated(X509 *x, int flags); +static int ocsp_check_delegated(X509 *x); static int ocsp_req_find_signer(X509 **psigner, OCSP_REQUEST *req, X509_NAME *nm, STACK_OF(X509) *certs, - X509_STORE *st, unsigned long flags); + unsigned long flags); /* Verify a basic response message */ @@ -85,8 +83,8 @@ int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, STACK_OF(X509) *chain = NULL; STACK_OF(X509) *untrusted = NULL; X509_STORE_CTX ctx; - int i, ret = 0; - ret = ocsp_find_signer(&signer, bs, certs, st, flags); + int i, ret = ocsp_find_signer(&signer, bs, certs, flags); + if (!ret) { OCSPerr(OCSP_F_OCSP_BASIC_VERIFY, OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND); @@ -146,7 +144,7 @@ int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, * At this point we have a valid certificate chain need to verify it * against the OCSP issuer criteria. */ - ret = ocsp_check_issuer(bs, chain, flags); + ret = ocsp_check_issuer(bs, chain); /* If fatal error or valid match then finish */ if (ret != 0) @@ -175,8 +173,7 @@ int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs, } static int ocsp_find_signer(X509 **psigner, OCSP_BASICRESP *bs, - STACK_OF(X509) *certs, X509_STORE *st, - unsigned long flags) + STACK_OF(X509) *certs, unsigned long flags) { X509 *signer; OCSP_RESPID *rid = &bs->tbsResponseData.responderId; @@ -221,8 +218,7 @@ static X509 *ocsp_find_signer_sk(STACK_OF(X509) *certs, OCSP_RESPID *id) return NULL; } -static int ocsp_check_issuer(OCSP_BASICRESP *bs, STACK_OF(X509) *chain, - unsigned long flags) +static int ocsp_check_issuer(OCSP_BASICRESP *bs, STACK_OF(X509) *chain) { STACK_OF(OCSP_SINGLERESP) *sresp; X509 *signer, *sca; @@ -251,7 +247,7 @@ static int ocsp_check_issuer(OCSP_BASICRESP *bs, STACK_OF(X509) *chain, return i; if (i) { /* We have a match, if extensions OK then success */ - if (ocsp_check_delegated(signer, flags)) + if (ocsp_check_delegated(signer)) return 1; return 0; } @@ -350,7 +346,7 @@ static int ocsp_match_issuerid(X509 *cert, OCSP_CERTID *cid, } -static int ocsp_check_delegated(X509 *x, int flags) +static int ocsp_check_delegated(X509 *x) { if ((X509_get_extension_flags(x) & EXFLAG_XKUSAGE) && (X509_get_extended_key_usage(x) & XKU_OCSP_SIGN)) @@ -384,7 +380,7 @@ int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, return 0; } nm = gen->d.directoryName; - ret = ocsp_req_find_signer(&signer, req, nm, certs, store, flags); + ret = ocsp_req_find_signer(&signer, req, nm, certs, flags); if (ret <= 0) { OCSPerr(OCSP_F_OCSP_REQUEST_VERIFY, OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND); @@ -431,7 +427,7 @@ int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, static int ocsp_req_find_signer(X509 **psigner, OCSP_REQUEST *req, X509_NAME *nm, STACK_OF(X509) *certs, - X509_STORE *st, unsigned long flags) + unsigned long flags) { X509 *signer; if (!(flags & OCSP_NOINTERN)) { diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c index 736eb27b69..2cd79036a6 100644 --- a/crypto/pem/pvkfmt.c +++ b/crypto/pem/pvkfmt.c @@ -120,9 +120,9 @@ static int read_lebn(const unsigned char **in, unsigned int nbyte, BIGNUM **r) /* Salt length for PVK files */ # define PVK_SALTLEN 0x10 -static EVP_PKEY *b2i_rsa(const unsigned char **in, unsigned int length, +static EVP_PKEY *b2i_rsa(const unsigned char **in, unsigned int bitlen, int ispub); -static EVP_PKEY *b2i_dss(const unsigned char **in, unsigned int length, +static EVP_PKEY *b2i_dss(const unsigned char **in, unsigned int bitlen, int ispub); static int do_blob_header(const unsigned char **in, unsigned int length, @@ -235,9 +235,9 @@ static EVP_PKEY *do_b2i(const unsigned char **in, unsigned int length, return NULL; } if (isdss) - return b2i_dss(&p, length, bitlen, ispub); + return b2i_dss(&p, bitlen, ispub); else - return b2i_rsa(&p, length, bitlen, ispub); + return b2i_rsa(&p, bitlen, ispub); } static EVP_PKEY *do_b2i_bio(BIO *in, int ispub) @@ -268,16 +268,16 @@ static EVP_PKEY *do_b2i_bio(BIO *in, int ispub) } if (isdss) - ret = b2i_dss(&p, length, bitlen, ispub); + ret = b2i_dss(&p, bitlen, ispub); else - ret = b2i_rsa(&p, length, bitlen, ispub); + ret = b2i_rsa(&p, bitlen, ispub); err: OPENSSL_free(buf); return ret; } -static EVP_PKEY *b2i_dss(const unsigned char **in, unsigned int length, +static EVP_PKEY *b2i_dss(const unsigned char **in, unsigned int bitlen, int ispub) { const unsigned char *p = *in; @@ -327,7 +327,7 @@ static EVP_PKEY *b2i_dss(const unsigned char **in, unsigned int length, return NULL; } -static EVP_PKEY *b2i_rsa(const unsigned char **in, unsigned int length, +static EVP_PKEY *b2i_rsa(const unsigned char **in, unsigned int bitlen, int ispub) { const unsigned char *p = *in; diff --git a/crypto/rsa/rsa_ameth.c b/crypto/rsa/rsa_ameth.c index 959aa23d1f..15f2194bf1 100644 --- a/crypto/rsa/rsa_ameth.c +++ b/crypto/rsa/rsa_ameth.c @@ -181,40 +181,11 @@ static void int_rsa_free(EVP_PKEY *pkey) RSA_free(pkey->pkey.rsa); } -static void update_buflen(const BIGNUM *b, size_t *pbuflen) -{ - size_t i; - if (!b) - return; - if (*pbuflen < (i = (size_t)BN_num_bytes(b))) - *pbuflen = i; -} < |