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/rsa | |
parent | 5de75fb4fb0a0f724c259a5477603c7d0dfd2235 (diff) | |
download | openssl-a773b52a61bb269e75ebbac01cfca9ebcb6c78b9.tar.gz |
Remove unused parameters from internal functions
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/rsa')
-rw-r--r-- | crypto/rsa/rsa_ameth.c | 52 | ||||
-rw-r--r-- | crypto/rsa/rsa_pmeth.c | 2 |
2 files changed, 11 insertions, 43 deletions
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; -} - static int do_rsa_print(BIO *bp, const RSA *x, int off, int priv) { char *str; const char *s; - unsigned char *m = NULL; int ret = 0, mod_len = 0; - size_t buf_len = 0; - - update_buflen(x->n, &buf_len); - update_buflen(x->e, &buf_len); - - if (priv) { - update_buflen(x->d, &buf_len); - update_buflen(x->p, &buf_len); - update_buflen(x->q, &buf_len); - update_buflen(x->dmp1, &buf_len); - update_buflen(x->dmq1, &buf_len); - update_buflen(x->iqmp, &buf_len); - } - - m = OPENSSL_malloc(buf_len + 10); - if (m == NULL) { - RSAerr(RSA_F_DO_RSA_PRINT, ERR_R_MALLOC_FAILURE); - goto err; - } if (x->n != NULL) mod_len = BN_num_bits(x->n); @@ -223,39 +194,36 @@ static int do_rsa_print(BIO *bp, const RSA *x, int off, int priv) goto err; if (priv && x->d) { - if (BIO_printf(bp, "Private-Key: (%d bit)\n", mod_len) - <= 0) + if (BIO_printf(bp, "Private-Key: (%d bit)\n", mod_len) <= 0) goto err; str = "modulus:"; s = "publicExponent:"; } else { - if (BIO_printf(bp, "Public-Key: (%d bit)\n", mod_len) - <= 0) + if (BIO_printf(bp, "Public-Key: (%d bit)\n", mod_len) <= 0) goto err; str = "Modulus:"; s = "Exponent:"; } - if (!ASN1_bn_print(bp, str, x->n, m, off)) + if (!ASN1_bn_print(bp, str, x->n, NULL, off)) goto err; - if (!ASN1_bn_print(bp, s, x->e, m, off)) + if (!ASN1_bn_print(bp, s, x->e, NULL, off)) goto err; if (priv) { - if (!ASN1_bn_print(bp, "privateExponent:", x->d, m, off)) + if (!ASN1_bn_print(bp, "privateExponent:", x->d, NULL, off)) goto err; - if (!ASN1_bn_print(bp, "prime1:", x->p, m, off)) + if (!ASN1_bn_print(bp, "prime1:", x->p, NULL, off)) goto err; - if (!ASN1_bn_print(bp, "prime2:", x->q, m, off)) + if (!ASN1_bn_print(bp, "prime2:", x->q, NULL, off)) goto err; - if (!ASN1_bn_print(bp, "exponent1:", x->dmp1, m, off)) + if (!ASN1_bn_print(bp, "exponent1:", x->dmp1, NULL, off)) goto err; - if (!ASN1_bn_print(bp, "exponent2:", x->dmq1, m, off)) + if (!ASN1_bn_print(bp, "exponent2:", x->dmq1, NULL, off)) goto err; - if (!ASN1_bn_print(bp, "coefficient:", x->iqmp, m, off)) + if (!ASN1_bn_print(bp, "coefficient:", x->iqmp, NULL, off)) goto err; } ret = 1; err: - OPENSSL_free(m); return (ret); } diff --git a/crypto/rsa/rsa_pmeth.c b/crypto/rsa/rsa_pmeth.c index 3362f99895..93c8756068 100644 --- a/crypto/rsa/rsa_pmeth.c +++ b/crypto/rsa/rsa_pmeth.c @@ -174,7 +174,7 @@ static int pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, unsigned int sltmp; if (rctx->pad_mode != RSA_PKCS1_PADDING) return -1; - ret = RSA_sign_ASN1_OCTET_STRING(NID_mdc2, + ret = RSA_sign_ASN1_OCTET_STRING(0, tbs, tbslen, sig, &sltmp, rsa); if (ret <= 0) |