Align with upstream's error strings, take two.

I messed up a few of these.

ASN1_R_UNSUPPORTED_ALGORITHM doesn't exist. X509_R_UNSUPPORTED_ALGORITHM does
exist as part of X509_PUBKEY_set, but the SPKI parser doesn't emit this. (I
don't mind the legacy code having really weird errors, but since EVP is now
limited to things we like, let's try to keep that clean.) To avoid churn in
Conscrypt, we'll keep defining X509_R_UNSUPPORTED_ALGORITHM, but not actually
do anything with it anymore.  Conscrypt was already aware of
EVP_R_UNSUPPORTED_ALGORITHM, so this should be fine. (I don't expect
EVP_R_UNSUPPORTED_ALGORITHM to go away. The SPKI parsers we like live in EVP
now.)

A few other ASN1_R_* values didn't quite match upstream, so make those match
again. Finally, I got some of the rsa_pss.c values wrong. Each of those
corresponds to an (overly specific) RSA_R_* value in upstream. However, those
were gone in BoringSSL since even the initial commit. We placed the RSA <-> EVP
glue in crypto/evp (so crypto/rsa wouldn't depend on crypto/evp) while upstream
placed them in crypto/rsa.

Since no one seemed to notice the loss of RSA_R_INVALID_SALT_LENGTH, let's undo
all the cross-module errors inserted in crypto/rsa. Instead, since that kind of
specificity is not useful, funnel it all into X509_R_INVALID_PSS_PARAMETERS
(formerly EVP_R_INVALID_PSS_PARAMETERS, formerly RSA_R_INVALID_PSS_PARAMETERS).

Reset the error codes for all affected modules.

(That our error code story means error codes are not stable across this kind of
refactoring is kind of a problem. Hopefully this will be the last of it.)

Change-Id: Ibfb3a0ac340bfc777bc7de6980ef3ddf0a8c84bc
Reviewed-on: https://boringssl-review.googlesource.com/7458
Reviewed-by: Emily Stark (Dunn) <estark@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
David Benjamin 2016-03-14 17:13:54 -04:00
parent a5177cb319
commit a2f2bc3a40
11 changed files with 322 additions and 328 deletions

View File

@ -68,11 +68,10 @@ OPENSSL_DECLARE_ERROR_REASON(ASN1, UNSUPPORTED_PUBLIC_KEY_TYPE);
/* Cross-module errors from crypto/x509/algorithm.c. */
OPENSSL_DECLARE_ERROR_REASON(ASN1, CONTEXT_NOT_INITIALISED);
OPENSSL_DECLARE_ERROR_REASON(ASN1, DIGEST_AND_KEY_TYPE_NOT_SUPPORTED);
OPENSSL_DECLARE_ERROR_REASON(ASN1, UNKNOWN_MESSAGE_DIGEST_ALGORITHM);
OPENSSL_DECLARE_ERROR_REASON(ASN1, UNKNOWN_SIGNATURE_ALGORITHM);
OPENSSL_DECLARE_ERROR_REASON(ASN1, UNSUPPORTED_ALGORITHM);
OPENSSL_DECLARE_ERROR_REASON(ASN1, WRONG_PUBLIC_KEY_TYPE);
/*
* Cross-module errors from crypto/x509/asn1_gen.c. TODO(davidben): Remove
* these once asn1_gen.c is gone.

View File

@ -6,87 +6,87 @@ ASN1,104,BMPSTRING_IS_WRONG_LENGTH
ASN1,105,BN_LIB
ASN1,106,BOOLEAN_IS_WRONG_LENGTH
ASN1,107,BUFFER_TOO_SMALL
ASN1,190,CONTEXT_NOT_INITIALISED
ASN1,108,DECODE_ERROR
ASN1,109,DEPTH_EXCEEDED
ASN1,110,ENCODE_ERROR
ASN1,111,ERROR_GETTING_TIME
ASN1,112,EXPECTING_AN_ASN1_SEQUENCE
ASN1,113,EXPECTING_AN_INTEGER
ASN1,114,EXPECTING_AN_OBJECT
ASN1,115,EXPECTING_A_BOOLEAN
ASN1,116,EXPECTING_A_TIME
ASN1,117,EXPLICIT_LENGTH_MISMATCH
ASN1,118,EXPLICIT_TAG_NOT_CONSTRUCTED
ASN1,119,FIELD_MISSING
ASN1,120,FIRST_NUM_TOO_LARGE
ASN1,121,HEADER_TOO_LONG
ASN1,122,ILLEGAL_BITSTRING_FORMAT
ASN1,123,ILLEGAL_BOOLEAN
ASN1,124,ILLEGAL_CHARACTERS
ASN1,125,ILLEGAL_FORMAT
ASN1,126,ILLEGAL_HEX
ASN1,127,ILLEGAL_IMPLICIT_TAG
ASN1,128,ILLEGAL_INTEGER
ASN1,129,ILLEGAL_NESTED_TAGGING
ASN1,130,ILLEGAL_NULL
ASN1,131,ILLEGAL_NULL_VALUE
ASN1,132,ILLEGAL_OBJECT
ASN1,133,ILLEGAL_OPTIONAL_ANY
ASN1,134,ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE
ASN1,135,ILLEGAL_TAGGED_ANY
ASN1,136,ILLEGAL_TIME_VALUE
ASN1,137,INTEGER_NOT_ASCII_FORMAT
ASN1,138,INTEGER_TOO_LARGE_FOR_LONG
ASN1,139,INVALID_BIT_STRING_BITS_LEFT
ASN1,140,INVALID_BMPSTRING_LENGTH
ASN1,141,INVALID_DIGIT
ASN1,142,INVALID_MODIFIER
ASN1,143,INVALID_NUMBER
ASN1,144,INVALID_OBJECT_ENCODING
ASN1,145,INVALID_SEPARATOR
ASN1,146,INVALID_TIME_FORMAT
ASN1,147,INVALID_UNIVERSALSTRING_LENGTH
ASN1,148,INVALID_UTF8STRING
ASN1,149,LIST_ERROR
ASN1,150,MISSING_ASN1_EOS
ASN1,151,MISSING_EOC
ASN1,152,MISSING_SECOND_NUMBER
ASN1,153,MISSING_VALUE
ASN1,154,MSTRING_NOT_UNIVERSAL
ASN1,155,MSTRING_WRONG_TAG
ASN1,156,NESTED_ASN1_ERROR
ASN1,157,NESTED_ASN1_STRING
ASN1,158,NON_HEX_CHARACTERS
ASN1,159,NOT_ASCII_FORMAT
ASN1,160,NOT_ENOUGH_DATA
ASN1,161,NO_MATCHING_CHOICE_TYPE
ASN1,162,NULL_IS_WRONG_LENGTH
ASN1,163,OBJECT_NOT_ASCII_FORMAT
ASN1,164,ODD_NUMBER_OF_CHARS
ASN1,165,SECOND_NUMBER_TOO_LARGE
ASN1,166,SEQUENCE_LENGTH_MISMATCH
ASN1,167,SEQUENCE_NOT_CONSTRUCTED
ASN1,168,SEQUENCE_OR_SET_NEEDS_CONFIG
ASN1,169,SHORT_LINE
ASN1,170,STREAMING_NOT_SUPPORTED
ASN1,171,STRING_TOO_LONG
ASN1,172,STRING_TOO_SHORT
ASN1,173,TAG_VALUE_TOO_HIGH
ASN1,174,TIME_NOT_ASCII_FORMAT
ASN1,175,TOO_LONG
ASN1,176,TYPE_NOT_CONSTRUCTED
ASN1,177,TYPE_NOT_PRIMITIVE
ASN1,178,UNEXPECTED_EOC
ASN1,179,UNIVERSALSTRING_IS_WRONG_LENGTH
ASN1,180,UNKNOWN_FORMAT
ASN1,187,UNKNOWN_MESSAGE_DIGEST_ALGORITHM
ASN1,188,UNKNOWN_SIGNATURE_ALGORITHM
ASN1,181,UNKNOWN_TAG
ASN1,191,UNSUPPORTED_ALGORITHM
ASN1,182,UNSUPPORTED_ANY_DEFINED_BY_TYPE
ASN1,183,UNSUPPORTED_PUBLIC_KEY_TYPE
ASN1,184,UNSUPPORTED_TYPE
ASN1,108,CONTEXT_NOT_INITIALISED
ASN1,109,DECODE_ERROR
ASN1,110,DEPTH_EXCEEDED
ASN1,111,DIGEST_AND_KEY_TYPE_NOT_SUPPORTED
ASN1,112,ENCODE_ERROR
ASN1,113,ERROR_GETTING_TIME
ASN1,114,EXPECTING_AN_ASN1_SEQUENCE
ASN1,115,EXPECTING_AN_INTEGER
ASN1,116,EXPECTING_AN_OBJECT
ASN1,117,EXPECTING_A_BOOLEAN
ASN1,118,EXPECTING_A_TIME
ASN1,119,EXPLICIT_LENGTH_MISMATCH
ASN1,120,EXPLICIT_TAG_NOT_CONSTRUCTED
ASN1,121,FIELD_MISSING
ASN1,122,FIRST_NUM_TOO_LARGE
ASN1,123,HEADER_TOO_LONG
ASN1,124,ILLEGAL_BITSTRING_FORMAT
ASN1,125,ILLEGAL_BOOLEAN
ASN1,126,ILLEGAL_CHARACTERS
ASN1,127,ILLEGAL_FORMAT
ASN1,128,ILLEGAL_HEX
ASN1,129,ILLEGAL_IMPLICIT_TAG
ASN1,130,ILLEGAL_INTEGER
ASN1,131,ILLEGAL_NESTED_TAGGING
ASN1,132,ILLEGAL_NULL
ASN1,133,ILLEGAL_NULL_VALUE
ASN1,134,ILLEGAL_OBJECT
ASN1,135,ILLEGAL_OPTIONAL_ANY
ASN1,136,ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE
ASN1,137,ILLEGAL_TAGGED_ANY
ASN1,138,ILLEGAL_TIME_VALUE
ASN1,139,INTEGER_NOT_ASCII_FORMAT
ASN1,140,INTEGER_TOO_LARGE_FOR_LONG
ASN1,141,INVALID_BIT_STRING_BITS_LEFT
ASN1,142,INVALID_BMPSTRING_LENGTH
ASN1,143,INVALID_DIGIT
ASN1,144,INVALID_MODIFIER
ASN1,145,INVALID_NUMBER
ASN1,146,INVALID_OBJECT_ENCODING
ASN1,147,INVALID_SEPARATOR
ASN1,148,INVALID_TIME_FORMAT
ASN1,149,INVALID_UNIVERSALSTRING_LENGTH
ASN1,150,INVALID_UTF8STRING
ASN1,151,LIST_ERROR
ASN1,152,MISSING_ASN1_EOS
ASN1,153,MISSING_EOC
ASN1,154,MISSING_SECOND_NUMBER
ASN1,155,MISSING_VALUE
ASN1,156,MSTRING_NOT_UNIVERSAL
ASN1,157,MSTRING_WRONG_TAG
ASN1,158,NESTED_ASN1_ERROR
ASN1,159,NESTED_ASN1_STRING
ASN1,160,NON_HEX_CHARACTERS
ASN1,161,NOT_ASCII_FORMAT
ASN1,162,NOT_ENOUGH_DATA
ASN1,163,NO_MATCHING_CHOICE_TYPE
ASN1,164,NULL_IS_WRONG_LENGTH
ASN1,165,OBJECT_NOT_ASCII_FORMAT
ASN1,166,ODD_NUMBER_OF_CHARS
ASN1,167,SECOND_NUMBER_TOO_LARGE
ASN1,168,SEQUENCE_LENGTH_MISMATCH
ASN1,169,SEQUENCE_NOT_CONSTRUCTED
ASN1,170,SEQUENCE_OR_SET_NEEDS_CONFIG
ASN1,171,SHORT_LINE
ASN1,172,STREAMING_NOT_SUPPORTED
ASN1,173,STRING_TOO_LONG
ASN1,174,STRING_TOO_SHORT
ASN1,175,TAG_VALUE_TOO_HIGH
ASN1,176,TIME_NOT_ASCII_FORMAT
ASN1,177,TOO_LONG
ASN1,178,TYPE_NOT_CONSTRUCTED
ASN1,179,TYPE_NOT_PRIMITIVE
ASN1,180,UNEXPECTED_EOC
ASN1,181,UNIVERSALSTRING_IS_WRONG_LENGTH
ASN1,182,UNKNOWN_FORMAT
ASN1,183,UNKNOWN_MESSAGE_DIGEST_ALGORITHM
ASN1,184,UNKNOWN_SIGNATURE_ALGORITHM
ASN1,185,UNKNOWN_TAG
ASN1,186,UNSUPPORTED_ANY_DEFINED_BY_TYPE
ASN1,187,UNSUPPORTED_PUBLIC_KEY_TYPE
ASN1,188,UNSUPPORTED_TYPE
ASN1,189,WRONG_PUBLIC_KEY_TYPE
ASN1,185,WRONG_TAG
ASN1,186,WRONG_TYPE
ASN1,190,WRONG_TAG
ASN1,191,WRONG_TYPE

View File

@ -1,49 +1,46 @@
RSA,143,BAD_ENCODING
RSA,100,BAD_E_VALUE
RSA,101,BAD_FIXED_HEADER_DECRYPT
RSA,102,BAD_PAD_BYTE_COUNT
RSA,103,BAD_RSA_PARAMETERS
RSA,104,BAD_SIGNATURE
RSA,145,BAD_VERSION
RSA,105,BLOCK_TYPE_IS_NOT_01
RSA,106,BN_NOT_INITIALIZED
RSA,142,CANNOT_RECOVER_MULTI_PRIME_KEY
RSA,107,CRT_PARAMS_ALREADY_GIVEN
RSA,108,CRT_VALUES_INCORRECT
RSA,109,DATA_LEN_NOT_EQUAL_TO_MOD_LEN
RSA,110,DATA_TOO_LARGE
RSA,111,DATA_TOO_LARGE_FOR_KEY_SIZE
RSA,112,DATA_TOO_LARGE_FOR_MODULUS
RSA,113,DATA_TOO_SMALL
RSA,114,DATA_TOO_SMALL_FOR_KEY_SIZE
RSA,115,DIGEST_TOO_BIG_FOR_RSA_KEY
RSA,116,D_E_NOT_CONGRUENT_TO_1
RSA,117,EMPTY_PUBLIC_KEY
RSA,144,ENCODE_ERROR
RSA,118,FIRST_OCTET_INVALID
RSA,119,INCONSISTENT_SET_OF_CRT_VALUES
RSA,120,INTERNAL_ERROR
RSA,121,INVALID_MESSAGE_LENGTH
RSA,146,INVALID_PSS_PARAMETERS
RSA,147,INVALID_SALT_LENGTH
RSA,148,INVALID_TRAILER
RSA,122,KEY_SIZE_TOO_SMALL
RSA,123,LAST_OCTET_INVALID
RSA,124,MODULUS_TOO_LARGE
RSA,141,MUST_HAVE_AT_LEAST_TWO_PRIMES
RSA,125,NO_PUBLIC_EXPONENT
RSA,126,NULL_BEFORE_BLOCK_MISSING
RSA,127,N_NOT_EQUAL_P_Q
RSA,128,OAEP_DECODING_ERROR
RSA,129,ONLY_ONE_OF_P_Q_GIVEN
RSA,130,OUTPUT_BUFFER_TOO_SMALL
RSA,131,PADDING_CHECK_FAILED
RSA,132,PKCS_DECODING_ERROR
RSA,133,SLEN_CHECK_FAILED
RSA,134,SLEN_RECOVERY_FAILED
RSA,135,TOO_LONG
RSA,136,TOO_MANY_ITERATIONS
RSA,137,UNKNOWN_ALGORITHM_TYPE
RSA,138,UNKNOWN_PADDING_TYPE
RSA,139,VALUE_MISSING
RSA,140,WRONG_SIGNATURE_LENGTH
RSA,100,BAD_ENCODING
RSA,101,BAD_E_VALUE
RSA,102,BAD_FIXED_HEADER_DECRYPT
RSA,103,BAD_PAD_BYTE_COUNT
RSA,104,BAD_RSA_PARAMETERS
RSA,105,BAD_SIGNATURE
RSA,106,BAD_VERSION
RSA,107,BLOCK_TYPE_IS_NOT_01
RSA,108,BN_NOT_INITIALIZED
RSA,109,CANNOT_RECOVER_MULTI_PRIME_KEY
RSA,110,CRT_PARAMS_ALREADY_GIVEN
RSA,111,CRT_VALUES_INCORRECT
RSA,112,DATA_LEN_NOT_EQUAL_TO_MOD_LEN
RSA,113,DATA_TOO_LARGE
RSA,114,DATA_TOO_LARGE_FOR_KEY_SIZE
RSA,115,DATA_TOO_LARGE_FOR_MODULUS
RSA,116,DATA_TOO_SMALL
RSA,117,DATA_TOO_SMALL_FOR_KEY_SIZE
RSA,118,DIGEST_TOO_BIG_FOR_RSA_KEY
RSA,119,D_E_NOT_CONGRUENT_TO_1
RSA,120,EMPTY_PUBLIC_KEY
RSA,121,ENCODE_ERROR
RSA,122,FIRST_OCTET_INVALID
RSA,123,INCONSISTENT_SET_OF_CRT_VALUES
RSA,124,INTERNAL_ERROR
RSA,125,INVALID_MESSAGE_LENGTH
RSA,126,KEY_SIZE_TOO_SMALL
RSA,127,LAST_OCTET_INVALID
RSA,128,MODULUS_TOO_LARGE
RSA,129,MUST_HAVE_AT_LEAST_TWO_PRIMES
RSA,130,NO_PUBLIC_EXPONENT
RSA,131,NULL_BEFORE_BLOCK_MISSING
RSA,132,N_NOT_EQUAL_P_Q
RSA,133,OAEP_DECODING_ERROR
RSA,134,ONLY_ONE_OF_P_Q_GIVEN
RSA,135,OUTPUT_BUFFER_TOO_SMALL
RSA,136,PADDING_CHECK_FAILED
RSA,137,PKCS_DECODING_ERROR
RSA,138,SLEN_CHECK_FAILED
RSA,139,SLEN_RECOVERY_FAILED
RSA,140,TOO_LONG
RSA,141,TOO_MANY_ITERATIONS
RSA,142,UNKNOWN_ALGORITHM_TYPE
RSA,143,UNKNOWN_PADDING_TYPE
RSA,144,VALUE_MISSING
RSA,145,WRONG_SIGNATURE_LENGTH

View File

@ -10,24 +10,26 @@ X509,108,IDP_MISMATCH
X509,109,INVALID_BIT_STRING_BITS_LEFT
X509,110,INVALID_DIRECTORY
X509,111,INVALID_FIELD_NAME
X509,112,INVALID_TRUST
X509,113,ISSUER_MISMATCH
X509,114,KEY_TYPE_MISMATCH
X509,115,KEY_VALUES_MISMATCH
X509,116,LOADING_CERT_DIR
X509,117,LOADING_DEFAULTS
X509,118,NEWER_CRL_NOT_NEWER
X509,119,NOT_PKCS7_SIGNED_DATA
X509,120,NO_CERTIFICATES_INCLUDED
X509,121,NO_CERT_SET_FOR_US_TO_VERIFY
X509,122,NO_CRLS_INCLUDED
X509,123,NO_CRL_NUMBER
X509,124,PUBLIC_KEY_DECODE_ERROR
X509,125,PUBLIC_KEY_ENCODE_ERROR
X509,126,SHOULD_RETRY
X509,127,UNKNOWN_KEY_TYPE
X509,128,UNKNOWN_NID
X509,129,UNKNOWN_PURPOSE_ID
X509,130,UNKNOWN_TRUST_ID
X509,131,WRONG_LOOKUP_TYPE
X509,132,WRONG_TYPE
X509,112,INVALID_PSS_PARAMETERS
X509,113,INVALID_TRUST
X509,114,ISSUER_MISMATCH
X509,115,KEY_TYPE_MISMATCH
X509,116,KEY_VALUES_MISMATCH
X509,117,LOADING_CERT_DIR
X509,118,LOADING_DEFAULTS
X509,119,NEWER_CRL_NOT_NEWER
X509,120,NOT_PKCS7_SIGNED_DATA
X509,121,NO_CERTIFICATES_INCLUDED
X509,122,NO_CERT_SET_FOR_US_TO_VERIFY
X509,123,NO_CRLS_INCLUDED
X509,124,NO_CRL_NUMBER
X509,125,PUBLIC_KEY_DECODE_ERROR
X509,126,PUBLIC_KEY_ENCODE_ERROR
X509,127,SHOULD_RETRY
X509,128,UNKNOWN_KEY_TYPE
X509,129,UNKNOWN_NID
X509,130,UNKNOWN_PURPOSE_ID
X509,131,UNKNOWN_TRUST_ID
X509,132,UNSUPPORTED_ALGORITHM
X509,133,WRONG_LOOKUP_TYPE
X509,134,WRONG_TYPE

View File

@ -71,11 +71,6 @@
#include "../internal.h"
/* Cross-module errors from crypto/x509/rsa_pss.c. */
OPENSSL_DECLARE_ERROR_REASON(RSA, INVALID_PSS_PARAMETERS);
OPENSSL_DECLARE_ERROR_REASON(RSA, INVALID_SALT_LENGTH);
OPENSSL_DECLARE_ERROR_REASON(RSA, INVALID_TRAILER);
static CRYPTO_EX_DATA_CLASS g_ex_data_class = CRYPTO_EX_DATA_CLASS_INIT;
RSA *RSA_new(void) { return RSA_new_method(NULL); }

View File

@ -89,7 +89,7 @@ int x509_digest_sign_algorithm(EVP_MD_CTX *ctx, X509_ALGOR *algor) {
int sign_nid;
if (!OBJ_find_sigid_by_algs(&sign_nid, EVP_MD_type(digest),
EVP_PKEY_id(pkey))) {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNSUPPORTED_ALGORITHM);
OPENSSL_PUT_ERROR(ASN1, ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED);
return 0;
}
@ -107,7 +107,7 @@ int x509_digest_verify_init(EVP_MD_CTX *ctx, X509_ALGOR *sigalg,
int sigalg_nid = OBJ_obj2nid(sigalg->algorithm);
int digest_nid, pkey_nid;
if (!OBJ_find_sigid_algs(sigalg_nid, &digest_nid, &pkey_nid)) {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNSUPPORTED_ALGORITHM);
OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM);
return 0;
}
@ -120,7 +120,7 @@ int x509_digest_verify_init(EVP_MD_CTX *ctx, X509_ALGOR *sigalg,
/* NID_undef signals that there are custom parameters to set. */
if (digest_nid == NID_undef) {
if (sigalg_nid != NID_rsassaPss) {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNSUPPORTED_ALGORITHM);
OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM);
return 0;
}
return x509_rsa_pss_to_ctx(ctx, sigalg, pkey);
@ -129,7 +129,7 @@ int x509_digest_verify_init(EVP_MD_CTX *ctx, X509_ALGOR *sigalg,
/* Otherwise, initialize with the digest from the OID. */
const EVP_MD *digest = EVP_get_digestbynid(digest_nid);
if (digest == NULL) {
OPENSSL_PUT_ERROR(X509, X509_R_UNKNOWN_NID);
OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM);
return 0;
}

View File

@ -161,7 +161,7 @@ static const EVP_MD *rsa_algor_to_md(X509_ALGOR *alg) {
}
md = EVP_get_digestbyobj(alg->algorithm);
if (md == NULL) {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNSUPPORTED_ALGORITHM);
OPENSSL_PUT_ERROR(X509, X509_R_INVALID_PSS_PARAMETERS);
}
return md;
}
@ -173,17 +173,14 @@ static const EVP_MD *rsa_mgf1_to_md(X509_ALGOR *alg, X509_ALGOR *maskHash) {
return EVP_sha1();
}
/* Check mask and lookup mask hash algorithm */
if (OBJ_obj2nid(alg->algorithm) != NID_mgf1) {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNSUPPORTED_ALGORITHM);
return NULL;
}
if (!maskHash) {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNSUPPORTED_ALGORITHM);
if (OBJ_obj2nid(alg->algorithm) != NID_mgf1 ||
maskHash == NULL) {
OPENSSL_PUT_ERROR(X509, X509_R_INVALID_PSS_PARAMETERS);
return NULL;
}
md = EVP_get_digestbyobj(maskHash->algorithm);
if (md == NULL) {
OPENSSL_PUT_ERROR(ASN1, ASN1_R_UNSUPPORTED_ALGORITHM);
OPENSSL_PUT_ERROR(X509, X509_R_INVALID_PSS_PARAMETERS);
return NULL;
}
return md;
@ -253,7 +250,7 @@ int x509_rsa_pss_to_ctx(EVP_MD_CTX *ctx, X509_ALGOR *sigalg, EVP_PKEY *pkey) {
X509_ALGOR *maskHash;
RSA_PSS_PARAMS *pss = rsa_pss_decode(sigalg, &maskHash);
if (pss == NULL) {
OPENSSL_PUT_ERROR(RSA, RSA_R_INVALID_PSS_PARAMETERS);
OPENSSL_PUT_ERROR(X509, X509_R_INVALID_PSS_PARAMETERS);
goto err;
}
@ -270,7 +267,7 @@ int x509_rsa_pss_to_ctx(EVP_MD_CTX *ctx, X509_ALGOR *sigalg, EVP_PKEY *pkey) {
/* Could perform more salt length sanity checks but the main
* RSA routines will trap other invalid values anyway. */
if (saltlen < 0) {
OPENSSL_PUT_ERROR(RSA, RSA_R_INVALID_SALT_LENGTH);
OPENSSL_PUT_ERROR(X509, X509_R_INVALID_PSS_PARAMETERS);
goto err;
}
}
@ -278,7 +275,7 @@ int x509_rsa_pss_to_ctx(EVP_MD_CTX *ctx, X509_ALGOR *sigalg, EVP_PKEY *pkey) {
/* low-level routines support only trailer field 0xbc (value 1)
* and PKCS#1 says we should reject any other value anyway. */
if (pss->trailerField != NULL && ASN1_INTEGER_get(pss->trailerField) != 1) {
OPENSSL_PUT_ERROR(RSA, RSA_R_INVALID_TRAILER);
OPENSSL_PUT_ERROR(X509, X509_R_INVALID_PSS_PARAMETERS);
goto err;
}

View File

@ -57,9 +57,14 @@
#include <openssl/x509.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/mem.h>
/* |X509_R_UNSUPPORTED_ALGORITHM| is no longer emitted, but continue to define
* it to avoid downstream churn. */
OPENSSL_DECLARE_ERROR_REASON(X509, UNSUPPORTED_ALGORITHM)
int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, int version,
int ptype, void *pval, uint8_t *penc, int penclen) {
uint8_t **ppenc = NULL;

View File

@ -1086,89 +1086,89 @@ OPENSSL_EXPORT int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, asn1_ps_f
#define ASN1_R_BN_LIB 105
#define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106
#define ASN1_R_BUFFER_TOO_SMALL 107
#define ASN1_R_DECODE_ERROR 108
#define ASN1_R_DEPTH_EXCEEDED 109
#define ASN1_R_ENCODE_ERROR 110
#define ASN1_R_ERROR_GETTING_TIME 111
#define ASN1_R_EXPECTING_AN_ASN1_SEQUENCE 112
#define ASN1_R_EXPECTING_AN_INTEGER 113
#define ASN1_R_EXPECTING_AN_OBJECT 114
#define ASN1_R_EXPECTING_A_BOOLEAN 115
#define ASN1_R_EXPECTING_A_TIME 116
#define ASN1_R_EXPLICIT_LENGTH_MISMATCH 117
#define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 118
#define ASN1_R_FIELD_MISSING 119
#define ASN1_R_FIRST_NUM_TOO_LARGE 120
#define ASN1_R_HEADER_TOO_LONG 121
#define ASN1_R_ILLEGAL_BITSTRING_FORMAT 122
#define ASN1_R_ILLEGAL_BOOLEAN 123
#define ASN1_R_ILLEGAL_CHARACTERS 124
#define ASN1_R_ILLEGAL_FORMAT 125
#define ASN1_R_ILLEGAL_HEX 126
#define ASN1_R_ILLEGAL_IMPLICIT_TAG 127
#define ASN1_R_ILLEGAL_INTEGER 128
#define ASN1_R_ILLEGAL_NESTED_TAGGING 129
#define ASN1_R_ILLEGAL_NULL 130
#define ASN1_R_ILLEGAL_NULL_VALUE 131
#define ASN1_R_ILLEGAL_OBJECT 132
#define ASN1_R_ILLEGAL_OPTIONAL_ANY 133
#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 134
#define ASN1_R_ILLEGAL_TAGGED_ANY 135
#define ASN1_R_ILLEGAL_TIME_VALUE 136
#define ASN1_R_INTEGER_NOT_ASCII_FORMAT 137
#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 138
#define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 139
#define ASN1_R_INVALID_BMPSTRING_LENGTH 140
#define ASN1_R_INVALID_DIGIT 141
#define ASN1_R_INVALID_MODIFIER 142
#define ASN1_R_INVALID_NUMBER 143
#define ASN1_R_INVALID_OBJECT_ENCODING 144
#define ASN1_R_INVALID_SEPARATOR 145
#define ASN1_R_INVALID_TIME_FORMAT 146
#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 147
#define ASN1_R_INVALID_UTF8STRING 148
#define ASN1_R_LIST_ERROR 149
#define ASN1_R_MISSING_ASN1_EOS 150
#define ASN1_R_MISSING_EOC 151
#define ASN1_R_MISSING_SECOND_NUMBER 152
#define ASN1_R_MISSING_VALUE 153
#define ASN1_R_MSTRING_NOT_UNIVERSAL 154
#define ASN1_R_MSTRING_WRONG_TAG 155
#define ASN1_R_NESTED_ASN1_ERROR 156
#define ASN1_R_NESTED_ASN1_STRING 157
#define ASN1_R_NON_HEX_CHARACTERS 158
#define ASN1_R_NOT_ASCII_FORMAT 159
#define ASN1_R_NOT_ENOUGH_DATA 160
#define ASN1_R_NO_MATCHING_CHOICE_TYPE 161
#define ASN1_R_NULL_IS_WRONG_LENGTH 162
#define ASN1_R_OBJECT_NOT_ASCII_FORMAT 163
#define ASN1_R_ODD_NUMBER_OF_CHARS 164
#define ASN1_R_SECOND_NUMBER_TOO_LARGE 165
#define ASN1_R_SEQUENCE_LENGTH_MISMATCH 166
#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 167
#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 168
#define ASN1_R_SHORT_LINE 169
#define ASN1_R_STREAMING_NOT_SUPPORTED 170
#define ASN1_R_STRING_TOO_LONG 171
#define ASN1_R_STRING_TOO_SHORT 172
#define ASN1_R_TAG_VALUE_TOO_HIGH 173
#define ASN1_R_TIME_NOT_ASCII_FORMAT 174
#define ASN1_R_TOO_LONG 175
#define ASN1_R_TYPE_NOT_CONSTRUCTED 176
#define ASN1_R_TYPE_NOT_PRIMITIVE 177
#define ASN1_R_UNEXPECTED_EOC 178
#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 179
#define ASN1_R_UNKNOWN_FORMAT 180
#define ASN1_R_UNKNOWN_TAG 181
#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 182
#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 183
#define ASN1_R_UNSUPPORTED_TYPE 184
#define ASN1_R_WRONG_TAG 185
#define ASN1_R_WRONG_TYPE 186
#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 187
#define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 188
#define ASN1_R_CONTEXT_NOT_INITIALISED 108
#define ASN1_R_DECODE_ERROR 109
#define ASN1_R_DEPTH_EXCEEDED 110
#define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 111
#define ASN1_R_ENCODE_ERROR 112
#define ASN1_R_ERROR_GETTING_TIME 113
#define ASN1_R_EXPECTING_AN_ASN1_SEQUENCE 114
#define ASN1_R_EXPECTING_AN_INTEGER 115
#define ASN1_R_EXPECTING_AN_OBJECT 116
#define ASN1_R_EXPECTING_A_BOOLEAN 117
#define ASN1_R_EXPECTING_A_TIME 118
#define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119
#define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120
#define ASN1_R_FIELD_MISSING 121
#define ASN1_R_FIRST_NUM_TOO_LARGE 122
#define ASN1_R_HEADER_TOO_LONG 123
#define ASN1_R_ILLEGAL_BITSTRING_FORMAT 124
#define ASN1_R_ILLEGAL_BOOLEAN 125
#define ASN1_R_ILLEGAL_CHARACTERS 126
#define ASN1_R_ILLEGAL_FORMAT 127
#define ASN1_R_ILLEGAL_HEX 128
#define ASN1_R_ILLEGAL_IMPLICIT_TAG 129
#define ASN1_R_ILLEGAL_INTEGER 130
#define ASN1_R_ILLEGAL_NESTED_TAGGING 131
#define ASN1_R_ILLEGAL_NULL 132
#define ASN1_R_ILLEGAL_NULL_VALUE 133
#define ASN1_R_ILLEGAL_OBJECT 134
#define ASN1_R_ILLEGAL_OPTIONAL_ANY 135
#define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 136
#define ASN1_R_ILLEGAL_TAGGED_ANY 137
#define ASN1_R_ILLEGAL_TIME_VALUE 138
#define ASN1_R_INTEGER_NOT_ASCII_FORMAT 139
#define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 140
#define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 141
#define ASN1_R_INVALID_BMPSTRING_LENGTH 142
#define ASN1_R_INVALID_DIGIT 143
#define ASN1_R_INVALID_MODIFIER 144
#define ASN1_R_INVALID_NUMBER 145
#define ASN1_R_INVALID_OBJECT_ENCODING 146
#define ASN1_R_INVALID_SEPARATOR 147
#define ASN1_R_INVALID_TIME_FORMAT 148
#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 149
#define ASN1_R_INVALID_UTF8STRING 150
#define ASN1_R_LIST_ERROR 151
#define ASN1_R_MISSING_ASN1_EOS 152
#define ASN1_R_MISSING_EOC 153
#define ASN1_R_MISSING_SECOND_NUMBER 154
#define ASN1_R_MISSING_VALUE 155
#define ASN1_R_MSTRING_NOT_UNIVERSAL 156
#define ASN1_R_MSTRING_WRONG_TAG 157
#define ASN1_R_NESTED_ASN1_ERROR 158
#define ASN1_R_NESTED_ASN1_STRING 159
#define ASN1_R_NON_HEX_CHARACTERS 160
#define ASN1_R_NOT_ASCII_FORMAT 161
#define ASN1_R_NOT_ENOUGH_DATA 162
#define ASN1_R_NO_MATCHING_CHOICE_TYPE 163
#define ASN1_R_NULL_IS_WRONG_LENGTH 164
#define ASN1_R_OBJECT_NOT_ASCII_FORMAT 165
#define ASN1_R_ODD_NUMBER_OF_CHARS 166
#define ASN1_R_SECOND_NUMBER_TOO_LARGE 167
#define ASN1_R_SEQUENCE_LENGTH_MISMATCH 168
#define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 169
#define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 170
#define ASN1_R_SHORT_LINE 171
#define ASN1_R_STREAMING_NOT_SUPPORTED 172
#define ASN1_R_STRING_TOO_LONG 173
#define ASN1_R_STRING_TOO_SHORT 174
#define ASN1_R_TAG_VALUE_TOO_HIGH 175
#define ASN1_R_TIME_NOT_ASCII_FORMAT 176
#define ASN1_R_TOO_LONG 177
#define ASN1_R_TYPE_NOT_CONSTRUCTED 178
#define ASN1_R_TYPE_NOT_PRIMITIVE 179
#define ASN1_R_UNEXPECTED_EOC 180
#define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 181
#define ASN1_R_UNKNOWN_FORMAT 182
#define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 183
#define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 184
#define ASN1_R_UNKNOWN_TAG 185
#define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 186
#define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 187
#define ASN1_R_UNSUPPORTED_TYPE 188
#define ASN1_R_WRONG_PUBLIC_KEY_TYPE 189
#define ASN1_R_CONTEXT_NOT_INITIALISED 190
#define ASN1_R_UNSUPPORTED_ALGORITHM 191
#define ASN1_R_WRONG_TAG 190
#define ASN1_R_WRONG_TYPE 191
#endif

View File

@ -591,54 +591,51 @@ struct rsa_st {
} /* extern C */
#endif
#define RSA_R_BAD_E_VALUE 100
#define RSA_R_BAD_FIXED_HEADER_DECRYPT 101
#define RSA_R_BAD_PAD_BYTE_COUNT 102
#define RSA_R_BAD_RSA_PARAMETERS 103
#define RSA_R_BAD_SIGNATURE 104
#define RSA_R_BLOCK_TYPE_IS_NOT_01 105
#define RSA_R_BN_NOT_INITIALIZED 106
#define RSA_R_CRT_PARAMS_ALREADY_GIVEN 107
#define RSA_R_CRT_VALUES_INCORRECT 108
#define RSA_R_DATA_LEN_NOT_EQUAL_TO_MOD_LEN 109
#define RSA_R_DATA_TOO_LARGE 110
#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 111
#define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 112
#define RSA_R_DATA_TOO_SMALL 113
#define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 114
#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 115
#define RSA_R_D_E_NOT_CONGRUENT_TO_1 116
#define RSA_R_EMPTY_PUBLIC_KEY 117
#define RSA_R_FIRST_OCTET_INVALID 118
#define RSA_R_INCONSISTENT_SET_OF_CRT_VALUES 119
#define RSA_R_INTERNAL_ERROR 120
#define RSA_R_INVALID_MESSAGE_LENGTH 121
#define RSA_R_KEY_SIZE_TOO_SMALL 122
#define RSA_R_LAST_OCTET_INVALID 123
#define RSA_R_MODULUS_TOO_LARGE 124
#define RSA_R_NO_PUBLIC_EXPONENT 125
#define RSA_R_NULL_BEFORE_BLOCK_MISSING 126
#define RSA_R_N_NOT_EQUAL_P_Q 127
#define RSA_R_OAEP_DECODING_ERROR 128
#define RSA_R_ONLY_ONE_OF_P_Q_GIVEN 129
#define RSA_R_OUTPUT_BUFFER_TOO_SMALL 130
#define RSA_R_PADDING_CHECK_FAILED 131
#define RSA_R_PKCS_DECODING_ERROR 132
#define RSA_R_SLEN_CHECK_FAILED 133
#define RSA_R_SLEN_RECOVERY_FAILED 134
#define RSA_R_TOO_LONG 135
#define RSA_R_TOO_MANY_ITERATIONS 136
#define RSA_R_UNKNOWN_ALGORITHM_TYPE 137
#define RSA_R_UNKNOWN_PADDING_TYPE 138
#define RSA_R_VALUE_MISSING 139
#define RSA_R_WRONG_SIGNATURE_LENGTH 140
#define RSA_R_MUST_HAVE_AT_LEAST_TWO_PRIMES 141
#define RSA_R_CANNOT_RECOVER_MULTI_PRIME_KEY 142
#define RSA_R_BAD_ENCODING 143
#define RSA_R_ENCODE_ERROR 144
#define RSA_R_BAD_VERSION 145
#define RSA_R_INVALID_PSS_PARAMETERS 146
#define RSA_R_INVALID_SALT_LENGTH 147
#define RSA_R_INVALID_TRAILER 148
#define RSA_R_BAD_ENCODING 100
#define RSA_R_BAD_E_VALUE 101
#define RSA_R_BAD_FIXED_HEADER_DECRYPT 102
#define RSA_R_BAD_PAD_BYTE_COUNT 103
#define RSA_R_BAD_RSA_PARAMETERS 104
#define RSA_R_BAD_SIGNATURE 105
#define RSA_R_BAD_VERSION 106
#define RSA_R_BLOCK_TYPE_IS_NOT_01 107
#define RSA_R_BN_NOT_INITIALIZED 108
#define RSA_R_CANNOT_RECOVER_MULTI_PRIME_KEY 109
#define RSA_R_CRT_PARAMS_ALREADY_GIVEN 110
#define RSA_R_CRT_VALUES_INCORRECT 111
#define RSA_R_DATA_LEN_NOT_EQUAL_TO_MOD_LEN 112
#define RSA_R_DATA_TOO_LARGE 113
#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 114
#define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 115
#define RSA_R_DATA_TOO_SMALL 116
#define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 117
#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 118
#define RSA_R_D_E_NOT_CONGRUENT_TO_1 119
#define RSA_R_EMPTY_PUBLIC_KEY 120
#define RSA_R_ENCODE_ERROR 121
#define RSA_R_FIRST_OCTET_INVALID 122
#define RSA_R_INCONSISTENT_SET_OF_CRT_VALUES 123
#define RSA_R_INTERNAL_ERROR 124
#define RSA_R_INVALID_MESSAGE_LENGTH 125
#define RSA_R_KEY_SIZE_TOO_SMALL 126
#define RSA_R_LAST_OCTET_INVALID 127
#define RSA_R_MODULUS_TOO_LARGE 128
#define RSA_R_MUST_HAVE_AT_LEAST_TWO_PRIMES 129
#define RSA_R_NO_PUBLIC_EXPONENT 130
#define RSA_R_NULL_BEFORE_BLOCK_MISSING 131
#define RSA_R_N_NOT_EQUAL_P_Q 132
#define RSA_R_OAEP_DECODING_ERROR 133
#define RSA_R_ONLY_ONE_OF_P_Q_GIVEN 134
#define RSA_R_OUTPUT_BUFFER_TOO_SMALL 135
#define RSA_R_PADDING_CHECK_FAILED 136
#define RSA_R_PKCS_DECODING_ERROR 137
#define RSA_R_SLEN_CHECK_FAILED 138
#define RSA_R_SLEN_RECOVERY_FAILED 139
#define RSA_R_TOO_LONG 140
#define RSA_R_TOO_MANY_ITERATIONS 141
#define RSA_R_UNKNOWN_ALGORITHM_TYPE 142
#define RSA_R_UNKNOWN_PADDING_TYPE 143
#define RSA_R_VALUE_MISSING 144
#define RSA_R_WRONG_SIGNATURE_LENGTH 145
#endif /* OPENSSL_HEADER_RSA_H */

View File

@ -1238,26 +1238,28 @@ OPENSSL_EXPORT int PKCS7_get_PEM_CRLs(STACK_OF(X509_CRL) *out_crls,
#define X509_R_INVALID_BIT_STRING_BITS_LEFT 109
#define X509_R_INVALID_DIRECTORY 110
#define X509_R_INVALID_FIELD_NAME 111
#define X509_R_INVALID_TRUST 112
#define X509_R_ISSUER_MISMATCH 113
#define X509_R_KEY_TYPE_MISMATCH 114
#define X509_R_KEY_VALUES_MISMATCH 115
#define X509_R_LOADING_CERT_DIR 116
#define X509_R_LOADING_DEFAULTS 117
#define X509_R_NEWER_CRL_NOT_NEWER 118
#define X509_R_NOT_PKCS7_SIGNED_DATA 119
#define X509_R_NO_CERTIFICATES_INCLUDED 120
#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 121
#define X509_R_NO_CRLS_INCLUDED 122
#define X509_R_NO_CRL_NUMBER 123
#define X509_R_PUBLIC_KEY_DECODE_ERROR 124
#define X509_R_PUBLIC_KEY_ENCODE_ERROR 125
#define X509_R_SHOULD_RETRY 126
#define X509_R_UNKNOWN_KEY_TYPE 127
#define X509_R_UNKNOWN_NID 128
#define X509_R_UNKNOWN_PURPOSE_ID 129
#define X509_R_UNKNOWN_TRUST_ID 130
#define X509_R_WRONG_LOOKUP_TYPE 131
#define X509_R_WRONG_TYPE 132
#define X509_R_INVALID_PSS_PARAMETERS 112
#define X509_R_INVALID_TRUST 113
#define X509_R_ISSUER_MISMATCH 114
#define X509_R_KEY_TYPE_MISMATCH 115
#define X509_R_KEY_VALUES_MISMATCH 116
#define X509_R_LOADING_CERT_DIR 117
#define X509_R_LOADING_DEFAULTS 118
#define X509_R_NEWER_CRL_NOT_NEWER 119
#define X509_R_NOT_PKCS7_SIGNED_DATA 120
#define X509_R_NO_CERTIFICATES_INCLUDED 121
#define X509_R_NO_CERT_SET_FOR_US_TO_VERIFY 122
#define X509_R_NO_CRLS_INCLUDED 123
#define X509_R_NO_CRL_NUMBER 124
#define X509_R_PUBLIC_KEY_DECODE_ERROR 125
#define X509_R_PUBLIC_KEY_ENCODE_ERROR 126
#define X509_R_SHOULD_RETRY 127
#define X509_R_UNKNOWN_KEY_TYPE 128
#define X509_R_UNKNOWN_NID 129
#define X509_R_UNKNOWN_PURPOSE_ID 130
#define X509_R_UNKNOWN_TRUST_ID 131
#define X509_R_UNSUPPORTED_ALGORITHM 132
#define X509_R_WRONG_LOOKUP_TYPE 133
#define X509_R_WRONG_TYPE 134
#endif