summaryrefslogtreecommitdiff
path: root/lib/libcrypto/rsa
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2017-01-29 17:49:24 +0000
committerBob Beck <beck@cvs.openbsd.org>2017-01-29 17:49:24 +0000
commitc95f3b2c0c39020aafaffd84899a33ece0210769 (patch)
tree6d6e55f6c8b4047319196f43823ad30170dfe061 /lib/libcrypto/rsa
parentb8dd3a8e12bfab2c15794994bc5bdc1397125536 (diff)
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing libssl had more reacharounds into this. ok jsing@ inoguchi@
Diffstat (limited to 'lib/libcrypto/rsa')
-rw-r--r--lib/libcrypto/rsa/rsa_ameth.c32
-rw-r--r--lib/libcrypto/rsa/rsa_chk.c23
-rw-r--r--lib/libcrypto/rsa/rsa_crpt.c7
-rw-r--r--lib/libcrypto/rsa/rsa_eay.c72
-rw-r--r--lib/libcrypto/rsa/rsa_err.c61
-rw-r--r--lib/libcrypto/rsa/rsa_gen.c7
-rw-r--r--lib/libcrypto/rsa/rsa_lib.c8
-rw-r--r--lib/libcrypto/rsa/rsa_none.c10
-rw-r--r--lib/libcrypto/rsa/rsa_oaep.c18
-rw-r--r--lib/libcrypto/rsa/rsa_pk1.c35
-rw-r--r--lib/libcrypto/rsa/rsa_pmeth.c33
-rw-r--r--lib/libcrypto/rsa/rsa_prn.c4
-rw-r--r--lib/libcrypto/rsa/rsa_pss.c32
-rw-r--r--lib/libcrypto/rsa/rsa_saos.c16
-rw-r--r--lib/libcrypto/rsa/rsa_sign.c32
-rw-r--r--lib/libcrypto/rsa/rsa_ssl.c18
-rw-r--r--lib/libcrypto/rsa/rsa_x931.c15
17 files changed, 148 insertions, 275 deletions
diff --git a/lib/libcrypto/rsa/rsa_ameth.c b/lib/libcrypto/rsa/rsa_ameth.c
index aa911251cc9..ec8a71b7b96 100644
--- a/lib/libcrypto/rsa/rsa_ameth.c
+++ b/lib/libcrypto/rsa/rsa_ameth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_ameth.c,v 1.17 2016/12/30 15:47:07 jsing Exp $ */
+/* $OpenBSD: rsa_ameth.c,v 1.18 2017/01/29 17:49:23 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
@@ -96,7 +96,7 @@ rsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, NULL, pubkey))
return 0;
if (!(rsa = d2i_RSAPublicKey(NULL, &p, pklen))) {
- RSAerr(RSA_F_RSA_PUB_DECODE, ERR_R_RSA_LIB);
+ RSAerror(ERR_R_RSA_LIB);
return 0;
}
EVP_PKEY_assign_RSA (pkey, rsa);
@@ -118,7 +118,7 @@ old_rsa_priv_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen)
RSA *rsa;
if (!(rsa = d2i_RSAPrivateKey (NULL, pder, derlen))) {
- RSAerr(RSA_F_OLD_RSA_PRIV_DECODE, ERR_R_RSA_LIB);
+ RSAerror(ERR_R_RSA_LIB);
return 0;
}
EVP_PKEY_assign_RSA(pkey, rsa);
@@ -140,13 +140,13 @@ rsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
rklen = i2d_RSAPrivateKey(pkey->pkey.rsa, &rk);
if (rklen <= 0) {
- RSAerr(RSA_F_RSA_PRIV_ENCODE, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
return 0;
}
if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_rsaEncryption), 0,
V_ASN1_NULL, NULL, rk, rklen)) {
- RSAerr(RSA_F_RSA_PRIV_ENCODE, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
return 0;
}
@@ -216,7 +216,7 @@ do_rsa_print(BIO *bp, const RSA *x, int off, int priv)
m = malloc(buf_len + 10);
if (m == NULL) {
- RSAerr(RSA_F_DO_RSA_PRINT, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
goto err;
}
@@ -450,7 +450,7 @@ rsa_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
/* Sanity check: make sure it is PSS */
if (OBJ_obj2nid(sigalg->algorithm) != NID_rsassaPss) {
- RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNSUPPORTED_SIGNATURE_TYPE);
+ RSAerror(RSA_R_UNSUPPORTED_SIGNATURE_TYPE);
return -1;
}
@@ -458,25 +458,22 @@ rsa_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
pss = rsa_pss_decode(sigalg, &maskHash);
if (pss == NULL) {
- RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_INVALID_PSS_PARAMETERS);
+ RSAerror(RSA_R_INVALID_PSS_PARAMETERS);
goto err;
}
/* Check mask and lookup mask hash algorithm */
if (pss->maskGenAlgorithm) {
if (OBJ_obj2nid(pss->maskGenAlgorithm->algorithm) != NID_mgf1) {
- RSAerr(RSA_F_RSA_ITEM_VERIFY,
- RSA_R_UNSUPPORTED_MASK_ALGORITHM);
+ RSAerror(RSA_R_UNSUPPORTED_MASK_ALGORITHM);
goto err;
}
if (!maskHash) {
- RSAerr(RSA_F_RSA_ITEM_VERIFY,
- RSA_R_UNSUPPORTED_MASK_PARAMETER);
+ RSAerror(RSA_R_UNSUPPORTED_MASK_PARAMETER);
goto err;
}
mgf1md = EVP_get_digestbyobj(maskHash->algorithm);
if (mgf1md == NULL) {
- RSAerr(RSA_F_RSA_ITEM_VERIFY,
- RSA_R_UNKNOWN_MASK_DIGEST);
+ RSAerror(RSA_R_UNKNOWN_MASK_DIGEST);
goto err;
}
} else
@@ -485,7 +482,7 @@ rsa_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
if (pss->hashAlgorithm) {
md = EVP_get_digestbyobj(pss->hashAlgorithm->algorithm);
if (md == NULL) {
- RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_UNKNOWN_PSS_DIGEST);
+ RSAerror(RSA_R_UNKNOWN_PSS_DIGEST);
goto err;
}
} else
@@ -498,8 +495,7 @@ rsa_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
* RSA routines will trap other invalid values anyway.
*/
if (saltlen < 0) {
- RSAerr(RSA_F_RSA_ITEM_VERIFY,
- RSA_R_INVALID_SALT_LENGTH);
+ RSAerror(RSA_R_INVALID_SALT_LENGTH);
goto err;
}
} else
@@ -509,7 +505,7 @@ rsa_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
* and PKCS#1 says we should reject any other value anyway.
*/
if (pss->trailerField && ASN1_INTEGER_get(pss->trailerField) != 1) {
- RSAerr(RSA_F_RSA_ITEM_VERIFY, RSA_R_INVALID_TRAILER);
+ RSAerror(RSA_R_INVALID_TRAILER);
goto err;
}
diff --git a/lib/libcrypto/rsa/rsa_chk.c b/lib/libcrypto/rsa/rsa_chk.c
index dd9104f3043..5345d31df98 100644
--- a/lib/libcrypto/rsa/rsa_chk.c
+++ b/lib/libcrypto/rsa/rsa_chk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_chk.c,v 1.12 2017/01/25 06:15:44 beck Exp $ */
+/* $OpenBSD: rsa_chk.c,v 1.13 2017/01/29 17:49:23 beck Exp $ */
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
*
@@ -63,7 +63,7 @@ RSA_check_key(const RSA *key)
int ret = 1;
if (!key->p || !key->q || !key->n || !key->e || !key->d) {
- RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_VALUE_MISSING);
+ RSAerror(RSA_R_VALUE_MISSING);
return 0;
}
@@ -76,7 +76,7 @@ RSA_check_key(const RSA *key)
if (i == NULL || j == NULL || k == NULL || l == NULL || m == NULL ||
ctx == NULL) {
ret = -1;
- RSAerr(RSA_F_RSA_CHECK_KEY, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
goto err;
}
@@ -86,7 +86,7 @@ RSA_check_key(const RSA *key)
ret = r;
if (r != 0)
goto err;
- RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_P_NOT_PRIME);
+ RSAerror(RSA_R_P_NOT_PRIME);
}
/* q prime? */
@@ -95,7 +95,7 @@ RSA_check_key(const RSA *key)
ret = r;
if (r != 0)
goto err;
- RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_Q_NOT_PRIME);
+ RSAerror(RSA_R_Q_NOT_PRIME);
}
/* n = p*q? */
@@ -107,7 +107,7 @@ RSA_check_key(const RSA *key)
if (BN_cmp(i, key->n) != 0) {
ret = 0;
- RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_N_DOES_NOT_EQUAL_P_Q);
+ RSAerror(RSA_R_N_DOES_NOT_EQUAL_P_Q);
}
/* d*e = 1 mod lcm(p-1,q-1)? */
@@ -148,7 +148,7 @@ RSA_check_key(const RSA *key)
if (!BN_is_one(i)) {
ret = 0;
- RSAerr(RSA_F_RSA_CHECK_KEY, RSA_R_D_E_NOT_CONGRUENT_TO_1);
+ RSAerror(RSA_R_D_E_NOT_CONGRUENT_TO_1);
}
if (key->dmp1 != NULL && key->dmq1 != NULL && key->iqmp != NULL) {
@@ -167,8 +167,7 @@ RSA_check_key(const RSA *key)
if (BN_cmp(j, key->dmp1) != 0) {
ret = 0;
- RSAerr(RSA_F_RSA_CHECK_KEY,
- RSA_R_DMP1_NOT_CONGRUENT_TO_D);
+ RSAerror(RSA_R_DMP1_NOT_CONGRUENT_TO_D);
}
/* dmq1 = d mod (q-1)? */
@@ -186,8 +185,7 @@ RSA_check_key(const RSA *key)
if (BN_cmp(j, key->dmq1) != 0) {
ret = 0;
- RSAerr(RSA_F_RSA_CHECK_KEY,
- RSA_R_DMQ1_NOT_CONGRUENT_TO_D);
+ RSAerror(RSA_R_DMQ1_NOT_CONGRUENT_TO_D);
}
/* iqmp = q^-1 mod p? */
@@ -198,8 +196,7 @@ RSA_check_key(const RSA *key)
if (BN_cmp(i, key->iqmp) != 0) {
ret = 0;
- RSAerr(RSA_F_RSA_CHECK_KEY,
- RSA_R_IQMP_NOT_INVERSE_OF_Q);
+ RSAerror(RSA_R_IQMP_NOT_INVERSE_OF_Q);
}
}
diff --git a/lib/libcrypto/rsa/rsa_crpt.c b/lib/libcrypto/rsa/rsa_crpt.c
index 8063a832632..f0c925602f7 100644
--- a/lib/libcrypto/rsa/rsa_crpt.c
+++ b/lib/libcrypto/rsa/rsa_crpt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_crpt.c,v 1.17 2017/01/21 11:00:47 beck Exp $ */
+/* $OpenBSD: rsa_crpt.c,v 1.18 2017/01/29 17:49:23 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -187,8 +187,7 @@ RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
if (rsa->e == NULL) {
e = rsa_get_public_exp(rsa->d, rsa->p, rsa->q, ctx);
if (e == NULL) {
- RSAerr(RSA_F_RSA_SETUP_BLINDING,
- RSA_R_NO_PUBLIC_EXPONENT);
+ RSAerror(RSA_R_NO_PUBLIC_EXPONENT);
goto err;
}
} else
@@ -201,7 +200,7 @@ RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
rsa->_method_mod_n);
if (ret == NULL) {
- RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_BN_LIB);
+ RSAerror(ERR_R_BN_LIB);
goto err;
}
CRYPTO_THREADID_current(BN_BLINDING_thread_id(ret));
diff --git a/lib/libcrypto/rsa/rsa_eay.c b/lib/libcrypto/rsa/rsa_eay.c
index c4da147ddfb..90a3be8dd33 100644
--- a/lib/libcrypto/rsa/rsa_eay.c
+++ b/lib/libcrypto/rsa/rsa_eay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_eay.c,v 1.45 2017/01/21 10:38:29 beck Exp $ */
+/* $OpenBSD: rsa_eay.c,v 1.46 2017/01/29 17:49:23 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -160,19 +160,19 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to,
BN_CTX *ctx = NULL;
if (BN_num_bits(rsa->n) > OPENSSL_RSA_MAX_MODULUS_BITS) {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_MODULUS_TOO_LARGE);
+ RSAerror(RSA_R_MODULUS_TOO_LARGE);
return -1;
}
if (BN_ucmp(rsa->n, rsa->e) <= 0) {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_BAD_E_VALUE);
+ RSAerror(RSA_R_BAD_E_VALUE);
return -1;
}
/* for large moduli, enforce exponent limit */
if (BN_num_bits(rsa->n) > OPENSSL_RSA_SMALL_MODULUS_BITS) {
if (BN_num_bits(rsa->e) > OPENSSL_RSA_MAX_PUBEXP_BITS) {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, RSA_R_BAD_E_VALUE);
+ RSAerror(RSA_R_BAD_E_VALUE);
return -1;
}
}
@@ -187,7 +187,7 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to,
buf = malloc(num);
if (f == NULL || ret == NULL || buf == NULL) {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
goto err;
}
@@ -207,8 +207,7 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to,
i = RSA_padding_add_none(buf, num, from, flen);
break;
default:
- RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,
- RSA_R_UNKNOWN_PADDING_TYPE);
+ RSAerror(RSA_R_UNKNOWN_PADDING_TYPE);
goto err;
}
if (i <= 0)
@@ -219,8 +218,7 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to,
if (BN_ucmp(f, rsa->n) >= 0) {
/* usually the padding functions would catch this */
- RSAerr(RSA_F_RSA_EAY_PUBLIC_ENCRYPT,
- RSA_R_DATA_TOO_LARGE_FOR_MODULUS);
+ RSAerror(RSA_R_DATA_TOO_LARGE_FOR_MODULUS);
goto err;
}
@@ -374,7 +372,7 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to,
buf = malloc(num);
if (f == NULL || ret == NULL || buf == NULL) {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
goto err;
}
@@ -390,8 +388,7 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to,
break;
case RSA_SSLV23_PADDING:
default:
- RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,
- RSA_R_UNKNOWN_PADDING_TYPE);
+ RSAerror(RSA_R_UNKNOWN_PADDING_TYPE);
goto err;
}
if (i <= 0)
@@ -402,24 +399,21 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to,
if (BN_ucmp(f, rsa->n) >= 0) {
/* usually the padding functions would catch this */
- RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,
- RSA_R_DATA_TOO_LARGE_FOR_MODULUS);
+ RSAerror(RSA_R_DATA_TOO_LARGE_FOR_MODULUS);
goto err;
}
if (!(rsa->flags & RSA_FLAG_NO_BLINDING)) {
blinding = rsa_get_blinding(rsa, &local_blinding, ctx);
if (blinding == NULL) {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,
- ERR_R_INTERNAL_ERROR);
+ RSAerror(ERR_R_INTERNAL_ERROR);
goto err;
}
}
if (blinding != NULL) {
if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,
- ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
goto err;
}
if (!rsa_blinding_convert(blinding, f, unblind, ctx))
@@ -509,15 +503,14 @@ RSA_eay_private_decrypt(int flen, const unsigned char *from, unsigned char *to,
buf = malloc(num);
if (!f || !ret || !buf) {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
goto err;
}
/* This check was for equality but PGP does evil things
* and chops off the top '0' bytes */
if (flen > num) {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,
- RSA_R_DATA_GREATER_THAN_MOD_LEN);
+ RSAerror(RSA_R_DATA_GREATER_THAN_MOD_LEN);
goto err;
}
@@ -526,24 +519,21 @@ RSA_eay_private_decrypt(int flen, const unsigned char *from, unsigned char *to,
goto err;
if (BN_ucmp(f, rsa->n) >= 0) {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,
- RSA_R_DATA_TOO_LARGE_FOR_MODULUS);
+ RSAerror(RSA_R_DATA_TOO_LARGE_FOR_MODULUS);
goto err;
}
if (!(rsa->flags & RSA_FLAG_NO_BLINDING)) {
blinding = rsa_get_blinding(rsa, &local_blinding, ctx);
if (blinding == NULL) {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,
- ERR_R_INTERNAL_ERROR);
+ RSAerror(ERR_R_INTERNAL_ERROR);
goto err;
}
}
if (blinding != NULL) {
if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) {
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,
- ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
goto err;
}
if (!rsa_blinding_convert(blinding, f, unblind, ctx))
@@ -596,13 +586,11 @@ RSA_eay_private_decrypt(int flen, const unsigned char *from, unsigned char *to,
r = RSA_padding_check_none(to, num, buf, j, num);
break;
default:
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,
- RSA_R_UNKNOWN_PADDING_TYPE);
+ RSAerror(RSA_R_UNKNOWN_PADDING_TYPE);
goto err;
}
if (r < 0)
- RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,
- RSA_R_PADDING_CHECK_FAILED);
+ RSAerror(RSA_R_PADDING_CHECK_FAILED);
err:
if (ctx != NULL) {
@@ -628,19 +616,19 @@ RSA_eay_public_decrypt(int flen, const unsigned char *from, unsigned char *to,
BN_CTX *ctx = NULL;
if (BN_num_bits(rsa->n) > OPENSSL_RSA_MAX_MODULUS_BITS) {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, RSA_R_MODULUS_TOO_LARGE);
+ RSAerror(RSA_R_MODULUS_TOO_LARGE);
return -1;
}
if (BN_ucmp(rsa->n, rsa->e) <= 0) {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, RSA_R_BAD_E_VALUE);
+ RSAerror(RSA_R_BAD_E_VALUE);
return -1;
}
/* for large moduli, enforce exponent limit */
if (BN_num_bits(rsa->n) > OPENSSL_RSA_SMALL_MODULUS_BITS) {
if (BN_num_bits(rsa->e) > OPENSSL_RSA_MAX_PUBEXP_BITS) {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, RSA_R_BAD_E_VALUE);
+ RSAerror(RSA_R_BAD_E_VALUE);
return -1;
}
}
@@ -655,15 +643,14 @@ RSA_eay_public_decrypt(int flen, const unsigned char *from, unsigned char *to,
buf = malloc(num);
if (!f || !ret || !buf) {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
goto err;
}
/* This check was for equality but PGP does evil things
* and chops off the top '0' bytes */
if (flen > num) {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,
- RSA_R_DATA_GREATER_THAN_MOD_LEN);
+ RSAerror(RSA_R_DATA_GREATER_THAN_MOD_LEN);
goto err;
}
@@ -671,8 +658,7 @@ RSA_eay_public_decrypt(int flen, const unsigned char *from, unsigned char *to,
goto err;
if (BN_ucmp(f, rsa->n) >= 0) {
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,
- RSA_R_DATA_TOO_LARGE_FOR_MODULUS);
+ RSAerror(RSA_R_DATA_TOO_LARGE_FOR_MODULUS);
goto err;
}
@@ -703,13 +689,11 @@ RSA_eay_public_decrypt(int flen, const unsigned char *from, unsigned char *to,
r = RSA_padding_check_none(to, num, buf, i, num);
break;
default:
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,
- RSA_R_UNKNOWN_PADDING_TYPE);
+ RSAerror(RSA_R_UNKNOWN_PADDING_TYPE);
goto err;
}
if (r < 0)
- RSAerr(RSA_F_RSA_EAY_PUBLIC_DECRYPT,
- RSA_R_PADDING_CHECK_FAILED);
+ RSAerror(RSA_R_PADDING_CHECK_FAILED);
err:
if (ctx != NULL) {
@@ -735,7 +719,7 @@ RSA_eay_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
m1 = BN_CTX_get(ctx);
vrfy = BN_CTX_get(ctx);
if (r1 == NULL || m1 == NULL || vrfy == NULL) {
- RSAerr(RSA_F_RSA_EAY_MOD_EXP, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
goto err;
}
diff --git a/lib/libcrypto/rsa/rsa_err.c b/lib/libcrypto/rsa/rsa_err.c
index 81622c60994..c2b197c581d 100644
--- a/lib/libcrypto/rsa/rsa_err.c
+++ b/lib/libcrypto/rsa/rsa_err.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_err.c,v 1.16 2015/02/15 14:35:30 miod Exp $ */
+/* $OpenBSD: rsa_err.c,v 1.17 2017/01/29 17:49:23 beck Exp $ */
/* ====================================================================
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved.
*
@@ -72,64 +72,7 @@
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_RSA,0,reason)
static ERR_STRING_DATA RSA_str_functs[] = {
- {ERR_FUNC(RSA_F_CHECK_PADDING_MD), "CHECK_PADDING_MD"},
- {ERR_FUNC(RSA_F_DO_RSA_PRINT), "DO_RSA_PRINT"},
- {ERR_FUNC(RSA_F_INT_RSA_VERIFY), "INT_RSA_VERIFY"},
- {ERR_FUNC(RSA_F_MEMORY_LOCK), "MEMORY_LOCK"},
- {ERR_FUNC(RSA_F_OLD_RSA_PRIV_DECODE), "OLD_RSA_PRIV_DECODE"},
- {ERR_FUNC(RSA_F_PKEY_RSA_CTRL), "PKEY_RSA_CTRL"},
- {ERR_FUNC(RSA_F_PKEY_RSA_CTRL_STR), "PKEY_RSA_CTRL_STR"},
- {ERR_FUNC(RSA_F_PKEY_RSA_SIGN), "PKEY_RSA_SIGN"},
- {ERR_FUNC(RSA_F_PKEY_RSA_VERIFY), "PKEY_RSA_VERIFY"},
- {ERR_FUNC(RSA_F_PKEY_RSA_VERIFYRECOVER), "PKEY_RSA_VERIFYRECOVER"},
- {ERR_FUNC(RSA_F_RSA_BUILTIN_KEYGEN), "RSA_BUILTIN_KEYGEN"},
- {ERR_FUNC(RSA_F_RSA_CHECK_KEY), "RSA_check_key"},
- {ERR_FUNC(RSA_F_RSA_EAY_MOD_EXP), "RSA_EAY_MOD_EXP"},
- {ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_DECRYPT), "RSA_EAY_PRIVATE_DECRYPT"},
- {ERR_FUNC(RSA_F_RSA_EAY_PRIVATE_ENCRYPT), "RSA_EAY_PRIVATE_ENCRYPT"},
- {ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_DECRYPT), "RSA_EAY_PUBLIC_DECRYPT"},
- {ERR_FUNC(RSA_F_RSA_EAY_PUBLIC_ENCRYPT), "RSA_EAY_PUBLIC_ENCRYPT"},
- {ERR_FUNC(RSA_F_RSA_GENERATE_KEY), "RSA_generate_key"},
- {ERR_FUNC(RSA_F_RSA_GENERATE_KEY_EX), "RSA_generate_key_ex"},
- {ERR_FUNC(RSA_F_RSA_ITEM_VERIFY), "RSA_ITEM_VERIFY"},
- {ERR_FUNC(RSA_F_RSA_MEMORY_LOCK), "RSA_memory_lock"},
- {ERR_FUNC(RSA_F_RSA_NEW_METHOD), "RSA_new_method"},
- {ERR_FUNC(RSA_F_RSA_NULL), "RSA_NULL"},
- {ERR_FUNC(RSA_F_RSA_NULL_MOD_EXP), "RSA_NULL_MOD_EXP"},
- {ERR_FUNC(RSA_F_RSA_NULL_PRIVATE_DECRYPT), "RSA_NULL_PRIVATE_DECRYPT"},
- {ERR_FUNC(RSA_F_RSA_NULL_PRIVATE_ENCRYPT), "RSA_NULL_PRIVATE_ENCRYPT"},
- {ERR_FUNC(RSA_F_RSA_NULL_PUBLIC_DECRYPT), "RSA_NULL_PUBLIC_DECRYPT"},
- {ERR_FUNC(RSA_F_RSA_NULL_PUBLIC_ENCRYPT), "RSA_NULL_PUBLIC_ENCRYPT"},
- {ERR_FUNC(RSA_F_RSA_PADDING_ADD_NONE), "RSA_padding_add_none"},
- {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP), "RSA_padding_add_PKCS1_OAEP"},
- {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_PSS), "RSA_padding_add_PKCS1_PSS"},
- {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1), "RSA_padding_add_PKCS1_PSS_mgf1"},
- {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1), "RSA_padding_add_PKCS1_type_1"},
- {ERR_FUNC(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2), "RSA_padding_add_PKCS1_type_2"},
- {ERR_FUNC(RSA_F_RSA_PADDING_ADD_SSLV23), "RSA_padding_add_SSLv23"},
- {ERR_FUNC(RSA_F_RSA_PADDING_ADD_X931), "RSA_padding_add_X931"},
- {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_NONE), "RSA_padding_check_none"},
- {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP), "RSA_padding_check_PKCS1_OAEP"},
- {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1), "RSA_padding_check_PKCS1_type_1"},
- {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2), "RSA_padding_check_PKCS1_type_2"},
- {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_SSLV23), "RSA_padding_check_SSLv23"},
- {ERR_FUNC(RSA_F_RSA_PADDING_CHECK_X931), "RSA_padding_check_X931"},
- {ERR_FUNC(RSA_F_RSA_PRINT), "RSA_print"},
- {ERR_FUNC(RSA_F_RSA_PRINT_FP), "RSA_print_fp"},
- {ERR_FUNC(RSA_F_RSA_PRIVATE_DECRYPT), "RSA_private_decrypt"},
- {ERR_FUNC(RSA_F_RSA_PRIVATE_ENCRYPT), "RSA_private_encrypt"},
- {ERR_FUNC(RSA_F_RSA_PRIV_DECODE), "RSA_PRIV_DECODE"},
- {ERR_FUNC(RSA_F_RSA_PRIV_ENCODE), "RSA_PRIV_ENCODE"},
- {ERR_FUNC(RSA_F_RSA_PUBLIC_DECRYPT), "RSA_public_decrypt"},
- {ERR_FUNC(RSA_F_RSA_PUBLIC_ENCRYPT), "RSA_public_encrypt"},
- {ERR_FUNC(RSA_F_RSA_PUB_DECODE), "RSA_PUB_DECODE"},
- {ERR_FUNC(RSA_F_RSA_SETUP_BLINDING), "RSA_setup_blinding"},
- {ERR_FUNC(RSA_F_RSA_SIGN), "RSA_sign"},
- {ERR_FUNC(RSA_F_RSA_SIGN_ASN1_OCTET_STRING), "RSA_sign_ASN1_OCTET_STRING"},
- {ERR_FUNC(RSA_F_RSA_VERIFY), "RSA_verify"},
- {ERR_FUNC(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING), "RSA_verify_ASN1_OCTET_STRING"},
- {ERR_FUNC(RSA_F_RSA_VERIFY_PKCS1_PSS), "RSA_verify_PKCS1_PSS"},
- {ERR_FUNC(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1), "RSA_verify_PKCS1_PSS_mgf1"},
+ {ERR_FUNC(0xfff), "CRYPTO_internal"},
{0, NULL}
};
diff --git a/lib/libcrypto/rsa/rsa_gen.c b/lib/libcrypto/rsa/rsa_gen.c
index e09dccb4a86..596eb8eb783 100644
--- a/lib/libcrypto/rsa/rsa_gen.c
+++ b/lib/libcrypto/rsa/rsa_gen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_gen.c,v 1.21 2017/01/25 06:15:44 beck Exp $ */
+/* $OpenBSD: rsa_gen.c,v 1.22 2017/01/29 17:49:23 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -162,8 +162,7 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb)
++degenerate < 3);
if (degenerate == 3) {
ok = 0; /* we set our own err */
- RSAerr(RSA_F_RSA_BUILTIN_KEYGEN,
- RSA_R_KEY_SIZE_TOO_SMALL);
+ RSAerror(RSA_R_KEY_SIZE_TOO_SMALL);
goto err;
}
if (!BN_sub(r2, rsa->q, BN_value_one()))
@@ -219,7 +218,7 @@ rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb)
ok = 1;
err:
if (ok == -1) {
- RSAerr(RSA_F_RSA_BUILTIN_KEYGEN, ERR_LIB_BN);
+ RSAerror(ERR_LIB_BN);
ok = 0;
}
if (ctx != NULL) {
diff --git a/lib/libcrypto/rsa/rsa_lib.c b/lib/libcrypto/rsa/rsa_lib.c
index 51dc94a1340..31ea418427a 100644
--- a/lib/libcrypto/rsa/rsa_lib.c
+++ b/lib/libcrypto/rsa/rsa_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_lib.c,v 1.30 2015/02/11 03:19:37 doug Exp $ */
+/* $OpenBSD: rsa_lib.c,v 1.31 2017/01/29 17:49:23 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -132,7 +132,7 @@ RSA_new_method(ENGINE *engine)
ret = malloc(sizeof(RSA));
if (ret == NULL) {
- RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
return NULL;
}
@@ -140,7 +140,7 @@ RSA_new_method(ENGINE *engine)
#ifndef OPENSSL_NO_ENGINE
if (engine) {
if (!ENGINE_init(engine)) {
- RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB);
+ RSAerror(ERR_R_ENGINE_LIB);
free(ret);
return NULL;
}
@@ -150,7 +150,7 @@ RSA_new_method(ENGINE *engine)
if (ret->engine) {
ret->meth = ENGINE_get_RSA(ret->engine);
if (!ret->meth) {
- RSAerr(RSA_F_RSA_NEW_METHOD, ERR_R_ENGINE_LIB);
+ RSAerror(ERR_R_ENGINE_LIB);
ENGINE_finish(ret->engine);
free(ret);
return NULL;
diff --git a/lib/libcrypto/rsa/rsa_none.c b/lib/libcrypto/rsa/rsa_none.c
index 5222b3c1ebf..13d3449a9f4 100644
--- a/lib/libcrypto/rsa/rsa_none.c
+++ b/lib/libcrypto/rsa/rsa_none.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_none.c,v 1.10 2014/10/18 17:20:40 jsing Exp $ */
+/* $OpenBSD: rsa_none.c,v 1.11 2017/01/29 17:49:23 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -68,14 +68,12 @@ RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *from,
int flen)
{
if (flen > tlen) {
- RSAerr(RSA_F_RSA_PADDING_ADD_NONE,
- RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
+ RSAerror(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
return 0;
}
if (flen < tlen) {
- RSAerr(RSA_F_RSA_PADDING_ADD_NONE,
- RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE);
+ RSAerror(RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE);
return 0;
}
@@ -88,7 +86,7 @@ RSA_padding_check_none(unsigned char *to, int tlen, const unsigned char *from,
int flen, int num)
{
if (flen > tlen) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_NONE, RSA_R_DATA_TOO_LARGE);
+ RSAerror(RSA_R_DATA_TOO_LARGE);
return -1;
}
diff --git a/lib/libcrypto/rsa/rsa_oaep.c b/lib/libcrypto/rsa/rsa_oaep.c
index 86e2bfc34f4..cd7af203b76 100644
--- a/lib/libcrypto/rsa/rsa_oaep.c
+++ b/lib/libcrypto/rsa/rsa_oaep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_oaep.c,v 1.25 2015/06/20 12:01:14 jsing Exp $ */
+/* $OpenBSD: rsa_oaep.c,v 1.26 2017/01/29 17:49:23 beck Exp $ */
/* Written by Ulf Moeller. This software is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. */
@@ -44,14 +44,12 @@ RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
unsigned char *dbmask, seedmask[SHA_DIGEST_LENGTH];
if (flen > emlen - 2 * SHA_DIGEST_LENGTH - 1) {
- RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP,
- RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
+ RSAerror(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
return 0;
}
if (emlen < 2 * SHA_DIGEST_LENGTH + 1) {
- RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP,
- RSA_R_KEY_SIZE_TOO_SMALL);
+ RSAerror(RSA_R_KEY_SIZE_TOO_SMALL);
return 0;
}
@@ -69,7 +67,7 @@ RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
dbmask = malloc(emlen - SHA_DIGEST_LENGTH);
if (dbmask == NULL) {
- RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_OAEP, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
return 0;
}
@@ -126,8 +124,7 @@ RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
dblen = num - SHA_DIGEST_LENGTH;
db = malloc(dblen + num);
if (db == NULL) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP,
- ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
return -1;
}
@@ -167,8 +164,7 @@ RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
mlen = dblen - ++i;
if (tlen < mlen) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP,
- RSA_R_DATA_TOO_LARGE);
+ RSAerror(RSA_R_DATA_TOO_LARGE);
mlen = -1;
} else
memcpy(to, db + i, mlen);
@@ -182,7 +178,7 @@ decoding_err:
* To avoid chosen ciphertext attacks, the error message should not
* reveal which kind of decoding error happened
*/
- RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP, RSA_R_OAEP_DECODING_ERROR);
+ RSAerror(RSA_R_OAEP_DECODING_ERROR);
free(db);
return -1;
}
diff --git a/lib/libcrypto/rsa/rsa_pk1.c b/lib/libcrypto/rsa/rsa_pk1.c
index 6c3e7fb8461..6de263113f6 100644
--- a/lib/libcrypto/rsa/rsa_pk1.c
+++ b/lib/libcrypto/rsa/rsa_pk1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_pk1.c,v 1.14 2014/10/22 13:02:04 jsing Exp $ */
+/* $OpenBSD: rsa_pk1.c,v 1.15 2017/01/29 17:49:23 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -72,8 +72,7 @@ RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen,
unsigned char *p;
if (flen > (tlen - RSA_PKCS1_PADDING_SIZE)) {
- RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1,
- RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
+ RSAerror(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
return 0;
}
@@ -101,8 +100,7 @@ RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,
p = from;
if (num != flen + 1 || *(p++) != 01) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1,
- RSA_R_BLOCK_TYPE_IS_NOT_01);
+ RSAerror(RSA_R_BLOCK_TYPE_IS_NOT_01);
return -1;
}
@@ -115,8 +113,7 @@ RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,
p++;
break;
} else {
- RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1,
- RSA_R_BAD_FIXED_HEADER_DECRYPT);
+ RSAerror(RSA_R_BAD_FIXED_HEADER_DECRYPT);
return -1;
}
}
@@ -124,21 +121,18 @@ RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,
}
if (i == j) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1,
- RSA_R_NULL_BEFORE_BLOCK_MISSING);
+ RSAerror(RSA_R_NULL_BEFORE_BLOCK_MISSING);
return -1;
}
if (i < 8) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1,
- RSA_R_BAD_PAD_BYTE_COUNT);
+ RSAerror(RSA_R_BAD_PAD_BYTE_COUNT);
return -1;
}
i++; /* Skip over the '\0' */
j -= i;
if (j > tlen) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1,
- RSA_R_DATA_TOO_LARGE);
+ RSAerror(RSA_R_DATA_TOO_LARGE);
return -1;
}
memcpy(to, p, j);
@@ -154,8 +148,7 @@ RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen,
unsigned char *p;
if (flen > tlen - 11) {
- RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2,
- RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
+ RSAerror(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
return 0;
}
@@ -189,8 +182,7 @@ RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen,
p = from;
if (num != flen + 1 || *(p++) != 02) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2,
- RSA_R_BLOCK_TYPE_IS_NOT_02);
+ RSAerror(RSA_R_BLOCK_TYPE_IS_NOT_02);
return -1;
}
@@ -201,21 +193,18 @@ RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen,
break;
if (i == j) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2,
- RSA_R_NULL_BEFORE_BLOCK_MISSING);
+ RSAerror(RSA_R_NULL_BEFORE_BLOCK_MISSING);
return -1;
}
if (i < 8) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2,
- RSA_R_BAD_PAD_BYTE_COUNT);
+ RSAerror(RSA_R_BAD_PAD_BYTE_COUNT);
return -1;
}
i++; /* Skip over the '\0' */
j -= i;
if (j > tlen) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2,
- RSA_R_DATA_TOO_LARGE);
+ RSAerror(RSA_R_DATA_TOO_LARGE);
return -1;
}
memcpy(to, p, j);
diff --git a/lib/libcrypto/rsa/rsa_pmeth.c b/lib/libcrypto/rsa/rsa_pmeth.c
index 4b7fc09514f..2ef1f3c64ad 100644
--- a/lib/libcrypto/rsa/rsa_pmeth.c
+++ b/lib/libcrypto/rsa/rsa_pmeth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_pmeth.c,v 1.18 2016/10/19 16:49:11 jsing Exp $ */
+/* $OpenBSD: rsa_pmeth.c,v 1.19 2017/01/29 17:49:23 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
@@ -170,8 +170,7 @@ pkey_rsa_sign(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
if (rctx->md) {
if (tbslen != (size_t)EVP_MD_size(rctx->md)) {
- RSAerr(RSA_F_PKEY_RSA_SIGN,
- RSA_R_INVALID_DIGEST_LENGTH);
+ RSAerror(RSA_R_INVALID_DIGEST_LENGTH);
return -1;
}
@@ -228,13 +227,11 @@ pkey_rsa_verifyrecover(EVP_PKEY_CTX *ctx, unsigned char *rout, size_t *routlen,
ret--;
if (rctx->tbuf[ret] !=
RSA_X931_hash_id(EVP_MD_type(rctx->md))) {
- RSAerr(RSA_F_PKEY_RSA_VERIFYRECOVER,
- RSA_R_ALGORITHM_MISMATCH);
+ RSAerror(RSA_R_ALGORITHM_MISMATCH);
return 0;
}
if (ret != EVP_MD_size(rctx->md)) {
- RSAerr(RSA_F_PKEY_RSA_VERIFYRECOVER,
- RSA_R_INVALID_DIGEST_LENGTH);
+ RSAerror(RSA_R_INVALID_DIGEST_LENGTH);
return 0;
}
if (rout)
@@ -342,14 +339,13 @@ check_padding_md(const EVP_MD *md, int padding)
return 1;
if (padding == RSA_NO_PADDING) {
- RSAerr(RSA_F_CHECK_PADDING_MD, RSA_R_INVALID_PADDING_MODE);
+ RSAerror(RSA_R_INVALID_PADDING_MODE);
return 0;
}
if (padding == RSA_X931_PADDING) {
if (RSA_X931_hash_id(EVP_MD_type(md)) == -1) {
- RSAerr(RSA_F_CHECK_PADDING_MD,
- RSA_R_INVALID_X931_DIGEST);
+ RSAerror(RSA_R_INVALID_X931_DIGEST);
return 0;
}
return 1;
@@ -385,8 +381,7 @@ pkey_rsa_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
return 1;
}
bad_pad:
- RSAerr(RSA_F_PKEY_RSA_CTRL,
- RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE);
+ RSAerror(RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE);
return -2;
case EVP_PKEY_CTRL_GET_RSA_PADDING:
@@ -396,7 +391,7 @@ bad_pad:
case EVP_PKEY_CTRL_RSA_PSS_SALTLEN:
case EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN:
if (rctx->pad_mode != RSA_PKCS1_PSS_PADDING) {
- RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_PSS_SALTLEN);
+ RSAerror(RSA_R_INVALID_PSS_SALTLEN);
return -2;
}
if (type == EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN)
@@ -410,7 +405,7 @@ bad_pad:
case EVP_PKEY_CTRL_RSA_KEYGEN_BITS:
if (p1 < 256) {
- RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_KEYBITS);
+ RSAerror(RSA_R_INVALID_KEYBITS);
return -2;
}
rctx->nbits = p1;
@@ -431,7 +426,7 @@ bad_pad:
case EVP_PKEY_CTRL_RSA_MGF1_MD:
case EVP_PKEY_CTRL_GET_RSA_MGF1_MD:
if (rctx->pad_mode != RSA_PKCS1_PSS_PADDING) {
- RSAerr(RSA_F_PKEY_RSA_CTRL, RSA_R_INVALID_MGF1_MD);
+ RSAerror(RSA_R_INVALID_MGF1_MD);
return -2;
}
if (type == EVP_PKEY_CTRL_GET_RSA_MGF1_MD) {
@@ -449,8 +444,7 @@ bad_pad:
case EVP_PKEY_CTRL_PKCS7_SIGN:
return 1;
case EVP_PKEY_CTRL_PEER_KEY:
- RSAerr(RSA_F_PKEY_RSA_CTRL,
- RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
+ RSAerror(RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
return -2;
default:
@@ -465,7 +459,7 @@ pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value)
char *ep;
if (!value) {
- RSAerr(RSA_F_PKEY_RSA_CTRL_STR, RSA_R_VALUE_MISSING);
+ RSAerror(RSA_R_VALUE_MISSING);
return 0;
}
if (!strcmp(type, "rsa_padding_mode")) {
@@ -485,8 +479,7 @@ pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value)
else if (!strcmp(value, "pss"))
pm = RSA_PKCS1_PSS_PADDING;
else {
- RSAerr(RSA_F_PKEY_RSA_CTRL_STR,
- RSA_R_UNKNOWN_PADDING_TYPE);
+ RSAerror(RSA_R_UNKNOWN_PADDING_TYPE);
return -2;
}
return EVP_PKEY_CTX_set_rsa_padding(ctx, pm);
diff --git a/lib/libcrypto/rsa/rsa_prn.c b/lib/libcrypto/rsa/rsa_prn.c
index db82dab5be1..c46b08c00d9 100644
--- a/lib/libcrypto/rsa/rsa_prn.c
+++ b/lib/libcrypto/rsa/rsa_prn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_prn.c,v 1.6 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: rsa_prn.c,v 1.7 2017/01/29 17:49:23 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
@@ -69,7 +69,7 @@ RSA_print_fp(FILE *fp, const RSA *x, int off)
int ret;
if ((b = BIO_new(BIO_s_file())) == NULL) {
- RSAerr(RSA_F_RSA_PRINT_FP, ERR_R_BUF_LIB);
+ RSAerror(ERR_R_BUF_LIB);
return 0;
}
BIO_set_fp(b, fp, BIO_NOCLOSE);
diff --git a/lib/libcrypto/rsa/rsa_pss.c b/lib/libcrypto/rsa/rsa_pss.c
index 5e137a30901..870f634b8de 100644
--- a/lib/libcrypto/rsa/rsa_pss.c
+++ b/lib/libcrypto/rsa/rsa_pss.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_pss.c,v 1.11 2014/10/22 13:02:04 jsing Exp $ */
+/* $OpenBSD: rsa_pss.c,v 1.12 2017/01/29 17:49:23 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2005.
*/
@@ -107,16 +107,14 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
else if (sLen == -2)
sLen = -2;
else if (sLen < -2) {
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1,
- RSA_R_SLEN_CHECK_FAILED);
+ RSAerror(RSA_R_SLEN_CHECK_FAILED);
goto err;
}
MSBits = (BN_num_bits(rsa->n) - 1) & 0x7;
emLen = RSA_size(rsa);
if (EM[0] & (0xFF << MSBits)) {
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1,
- RSA_R_FIRST_OCTET_INVALID);
+ RSAerror(RSA_R_FIRST_OCTET_INVALID);
goto err;
}
if (MSBits == 0) {
@@ -125,19 +123,18 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
}
if (emLen < (hLen + sLen + 2)) {
/* sLen can be small negative */
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_DATA_TOO_LARGE);
+ RSAerror(RSA_R_DATA_TOO_LARGE);
goto err;
}
if (EM[emLen - 1] != 0xbc) {
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1,
- RSA_R_LAST_OCTET_INVALID);
+ RSAerror(RSA_R_LAST_OCTET_INVALID);
goto err;
}
maskedDBLen = emLen - hLen - 1;
H = EM + maskedDBLen;
DB = malloc(maskedDBLen);
if (!DB) {
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
goto err;
}
if (PKCS1_MGF1(DB, maskedDBLen, H, hLen, mgf1Hash) < 0)
@@ -149,13 +146,11 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
for (i = 0; DB[i] == 0 && i < (maskedDBLen - 1); i++)
;
if (DB[i++] != 0x1) {
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1,
- RSA_R_SLEN_RECOVERY_FAILED);
+ RSAerror(RSA_R_SLEN_RECOVERY_FAILED);
goto err;
}
if (sLen >= 0 && (maskedDBLen - i) != sLen) {
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1,
- RSA_R_SLEN_CHECK_FAILED);
+ RSAerror(RSA_R_SLEN_CHECK_FAILED);
goto err;
}
if (!EVP_DigestInit_ex(&ctx, Hash, NULL) ||
@@ -169,7 +164,7 @@ RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
if (!EVP_DigestFinal_ex(&ctx, H_, NULL))
goto err;
if (memcmp(H_, H, hLen)) {
- RSAerr(RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1, RSA_R_BAD_SIGNATURE);
+ RSAerror(RSA_R_BAD_SIGNATURE);
ret = 0;
} else
ret = 1;
@@ -218,8 +213,7 @@ RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
else if (sLen == -2)
sLen = -2;
else if (sLen < -2) {
- RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,
- RSA_R_SLEN_CHECK_FAILED);
+ RSAerror(RSA_R_SLEN_CHECK_FAILED);
goto err;
}
@@ -232,15 +226,13 @@ RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
if (sLen == -2)
sLen = emLen - hLen - 2;
else if (emLen < (hLen + sLen + 2)) {
- RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,
- RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
+ RSAerror(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
goto err;
}
if (sLen > 0) {
salt = malloc(sLen);
if (!salt) {
- RSAerr(RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1,
- ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
goto err;
}
arc4random_buf(salt, sLen);
diff --git a/lib/libcrypto/rsa/rsa_saos.c b/lib/libcrypto/rsa/rsa_saos.c
index 5dbc10dbb20..179217c2362 100644
--- a/lib/libcrypto/rsa/rsa_saos.c
+++ b/lib/libcrypto/rsa/rsa_saos.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_saos.c,v 1.19 2015/09/30 18:41:06 jsing Exp $ */
+/* $OpenBSD: rsa_saos.c,v 1.20 2017/01/29 17:49:23 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -80,13 +80,12 @@ RSA_sign_ASN1_OCTET_STRING(int type, const unsigned char *m, unsigned int m_len,
i = i2d_ASN1_OCTET_STRING(&sig, NULL);
j = RSA_size(rsa);
if (i > (j - RSA_PKCS1_PADDING_SIZE)) {
- RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING,
- RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY);
+ RSAerror(RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY);
return 0;
}
s = malloc(j + 1);
if (s == NULL) {
- RSAerr(RSA_F_RSA_SIGN_ASN1_OCTET_STRING, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
return 0;
}
p = s;
@@ -112,15 +111,13 @@ RSA_verify_ASN1_OCTET_STRING(int dtype, const unsigned char *m,
ASN1_OCTET_STRING *sig = NULL;
if (siglen != (unsigned int)RSA_size(rsa)) {
- RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,
- RSA_R_WRONG_SIGNATURE_LENGTH);
+ RSAerror(RSA_R_WRONG_SIGNATURE_LENGTH);
return 0;
}
s = malloc(siglen);
if (s == NULL) {
- RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,
- ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
goto err;
}
i = RSA_public_decrypt((int)siglen, sigbuf, s, rsa, RSA_PKCS1_PADDING);
@@ -135,8 +132,7 @@ RSA_verify_ASN1_OCTET_STRING(int dtype, const unsigned char *m,
if ((unsigned int)sig->length != m_len ||
memcmp(m, sig->data, m_len) != 0) {
- RSAerr(RSA_F_RSA_VERIFY_ASN1_OCTET_STRING,
- RSA_R_BAD_SIGNATURE);
+ RSAerror(RSA_R_BAD_SIGNATURE);
} else
ret = 1;
err:
diff --git a/lib/libcrypto/rsa/rsa_sign.c b/lib/libcrypto/rsa/rsa_sign.c
index 7be08f544b0..52cbc3dfe35 100644
--- a/lib/libcrypto/rsa/rsa_sign.c
+++ b/lib/libcrypto/rsa/rsa_sign.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_sign.c,v 1.25 2015/09/10 15:56:25 jsing Exp $ */
+/* $OpenBSD: rsa_sign.c,v 1.26 2017/01/29 17:49:23 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -88,7 +88,7 @@ RSA_sign(int type, const unsigned char *m, unsigned int m_len,
/* Special case: SSL signature, just check the length */
if (type == NID_md5_sha1) {
if (m_len != SSL_SIG_LENGTH) {
- RSAerr(RSA_F_RSA_SIGN, RSA_R_INVALID_MESSAGE_LENGTH);
+ RSAerror(RSA_R_INVALID_MESSAGE_LENGTH);
return 0;
}
i = SSL_SIG_LENGTH;
@@ -97,12 +97,11 @@ RSA_sign(int type, const unsigned char *m, unsigned int m_len,
sig.algor = &algor;
sig.algor->algorithm = OBJ_nid2obj(type);
if (sig.algor->algorithm == NULL) {
- RSAerr(RSA_F_RSA_SIGN, RSA_R_UNKNOWN_ALGORITHM_TYPE);
+ RSAerror(RSA_R_UNKNOWN_ALGORITHM_TYPE);
return 0;
}
if (sig.algor->algorithm->length == 0) {
- RSAerr(RSA_F_RSA_SIGN,
- RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD);
+ RSAerror(RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD);
return 0;
}
parameter.type = V_ASN1_NULL;
@@ -117,13 +116,13 @@ RSA_sign(int type, const unsigned char *m, unsigned int m_len,
}
j = RSA_size(rsa);
if (i > j - RSA_PKCS1_PADDING_SIZE) {
- RSAerr(RSA_F_RSA_SIGN, RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY);
+ RSAerror(RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY);
return 0;
}
if (type != NID_md5_sha1) {
tmps = malloc(j + 1);
if (tmps == NULL) {
- RSAerr(RSA_F_RSA_SIGN, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
return 0;
}
p = tmps;
@@ -153,7 +152,7 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len,
X509_SIG *sig = NULL;
if (siglen != (unsigned int)RSA_size(rsa)) {
- RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_WRONG_SIGNATURE_LENGTH);
+ RSAerror(RSA_R_WRONG_SIGNATURE_LENGTH);
return 0;
}
@@ -168,11 +167,11 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len,
s = malloc(siglen);
if (s == NULL) {
- RSAerr(RSA_F_INT_RSA_VERIFY, ERR_R_MALLOC_FAILURE);
+ RSAerror(ERR_R_MALLOC_FAILURE);
goto err;
}
if (dtype == NID_md5_sha1 && m_len != SSL_SIG_LENGTH) {
- RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_INVALID_MESSAGE_LENGTH);
+ RSAerror(RSA_R_INVALID_MESSAGE_LENGTH);
goto err;
}
i = RSA_public_decrypt((int)siglen, sigbuf, s, rsa, RSA_PKCS1_PADDING);
@@ -183,7 +182,7 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len,
/* Special case: SSL signature */
if (dtype == NID_md5_sha1) {
if (i != SSL_SIG_LENGTH || memcmp(s, m, SSL_SIG_LENGTH))
- RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_BAD_SIGNATURE);
+ RSAerror(RSA_R_BAD_SIGNATURE);
else
ret = 1;
} else {
@@ -196,7 +195,7 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len,
/* Excess data can be used to create forgeries */
if (p != s + i) {
- RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_BAD_SIGNATURE);
+ RSAerror(RSA_R_BAD_SIGNATURE);
goto err;
}
@@ -204,14 +203,14 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len,
create forgeries */
if (sig->algor->parameter &&
ASN1_TYPE_get(sig->algor->parameter) != V_ASN1_NULL) {
- RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_BAD_SIGNATURE);
+ RSAerror(RSA_R_BAD_SIGNATURE);
goto err;
}
sigtype = OBJ_obj2nid(sig->algor->algorithm);
if (sigtype != dtype) {
- RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_ALGORITHM_MISMATCH);
+ RSAerror(RSA_R_ALGORITHM_MISMATCH);
goto err;
}
if (rm) {
@@ -219,8 +218,7 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len,
md = EVP_get_digestbynid(dtype);
if (md && (EVP_MD_size(md) != sig->digest->length))
- RSAerr(RSA_F_INT_RSA_VERIFY,
- RSA_R_INVALID_DIGEST_LENGTH);
+ RSAerror(RSA_R_INVALID_DIGEST_LENGTH);
else {
memcpy(rm, sig->digest->data,
sig->digest->length);
@@ -229,7 +227,7 @@ int_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len,
}
} else if ((unsigned int)sig->digest->length != m_len ||
memcmp(m, sig->digest->data, m_len) != 0) {
- RSAerr(RSA_F_INT_RSA_VERIFY, RSA_R_BAD_SIGNATURE);
+ RSAerror(RSA_R_BAD_SIGNATURE);
} else
ret = 1;
}
diff --git a/lib/libcrypto/rsa/rsa_ssl.c b/lib/libcrypto/rsa/rsa_ssl.c
index 73262f29c16..60fc8ec94f8 100644
--- a/lib/libcrypto/rsa/rsa_ssl.c
+++ b/lib/libcrypto/rsa/rsa_ssl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_ssl.c,v 1.14 2014/10/22 13:02:04 jsing Exp $ */
+/* $OpenBSD: rsa_ssl.c,v 1.15 2017/01/29 17:49:23 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -72,8 +72,7 @@ RSA_padding_add_SSLv23(unsigned char *to, int tlen, const unsigned char *from,
unsigned char *p;
if (flen > tlen - 11) {
- RSAerr(RSA_F_RSA_PADDING_ADD_SSLV23,
- RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
+ RSAerror(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
return 0;
}
@@ -109,12 +108,11 @@ RSA_padding_check_SSLv23(unsigned char *to, int tlen, const unsigned char *from,
p = from;
if (flen < 10) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_DATA_TOO_SMALL);
+ RSAerror(RSA_R_DATA_TOO_SMALL);
return -1;
}
if (num != flen + 1 || *(p++) != 02) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23,
- RSA_R_BLOCK_TYPE_IS_NOT_02);
+ RSAerror(RSA_R_BLOCK_TYPE_IS_NOT_02);
return -1;
}
@@ -125,8 +123,7 @@ RSA_padding_check_SSLv23(unsigned char *to, int tlen, const unsigned char *from,
break;
if (i == j || i < 8) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23,
- RSA_R_NULL_BEFORE_BLOCK_MISSING);
+ RSAerror(RSA_R_NULL_BEFORE_BLOCK_MISSING);
return -1;
}
for (k = -9; k < -1; k++) {
@@ -134,15 +131,14 @@ RSA_padding_check_SSLv23(unsigned char *to, int tlen, const unsigned char *from,
break;
}
if (k == -1) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23,
- RSA_R_SSLV3_ROLLBACK_ATTACK);
+ RSAerror(RSA_R_SSLV3_ROLLBACK_ATTACK);
return -1;
}
i++; /* Skip over the '\0' */
j -= i;
if (j > tlen) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_DATA_TOO_LARGE);
+ RSAerror(RSA_R_DATA_TOO_LARGE);
return -1;
}
memcpy(to, p, j);
diff --git a/lib/libcrypto/rsa/rsa_x931.c b/lib/libcrypto/rsa/rsa_x931.c
index 2993b4028da..3579735ab24 100644
--- a/lib/libcrypto/rsa/rsa_x931.c
+++ b/lib/libcrypto/rsa/rsa_x931.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_x931.c,v 1.9 2014/10/18 17:20:40 jsing Exp $ */
+/* $OpenBSD: rsa_x931.c,v 1.10 2017/01/29 17:49:23 beck Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2005.
*/
@@ -78,8 +78,7 @@ RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *from,
j = tlen - flen - 2;
if (j < 0) {
- RSAerr(RSA_F_RSA_PADDING_ADD_X931,
- RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
+ RSAerror(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
return -1;
}
@@ -110,7 +109,7 @@ RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *from,
const unsigned char *p = from;
if (num != flen || (*p != 0x6A && *p != 0x6B)) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_X931, RSA_R_INVALID_HEADER);
+ RSAerror(RSA_R_INVALID_HEADER);
return -1;
}
@@ -121,15 +120,13 @@ RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *from,
if (c == 0xBA)
break;
if (c != 0xBB) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_X931,
- RSA_R_INVALID_PADDING);
+ RSAerror(RSA_R_INVALID_PADDING);
return -1;
}
}
if (i == 0) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_X931,
- RSA_R_INVALID_PADDING);
+ RSAerror(RSA_R_INVALID_PADDING);
return -1;
}
@@ -138,7 +135,7 @@ RSA_padding_check_X931(unsigned char *to, int tlen, const unsigned char *from,
j = flen - 2;
if (j < 0 || p[j] != 0xCC) {
- RSAerr(RSA_F_RSA_PADDING_CHECK_X931, RSA_R_INVALID_TRAILER);
+ RSAerror(RSA_R_INVALID_TRAILER);
return -1;
}