aboutsummaryrefslogtreecommitdiffstats
path: root/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err')
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/CMakeLists.txt39
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/asn1.errordata92
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/bio.errordata17
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/bn.errordata19
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/cipher.errordata25
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/conf.errordata6
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/dh.errordata6
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/digest.errordata1
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/dsa.errordata7
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ec.errordata32
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ecdh.errordata3
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ecdsa.errordata6
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/engine.errordata1
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/err.c756
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/err_data_generate.go284
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/err_test.cc121
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/evp.errordata30
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/hkdf.errordata1
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/obj.errordata1
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/pem.errordata15
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/pkcs8.errordata25
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/rsa.errordata46
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ssl.errordata208
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/x509.errordata36
-rw-r--r--roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/x509v3.errordata63
25 files changed, 1840 insertions, 0 deletions
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/CMakeLists.txt b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/CMakeLists.txt
new file mode 100644
index 000000000..579a35be0
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/CMakeLists.txt
@@ -0,0 +1,39 @@
+include_directories(../../include)
+
+add_custom_command(
+ OUTPUT err_data.c
+ COMMAND ${GO_EXECUTABLE} run err_data_generate.go > ${CMAKE_CURRENT_BINARY_DIR}/err_data.c
+ DEPENDS
+ err_data_generate.go
+ asn1.errordata
+ bio.errordata
+ bn.errordata
+ cipher.errordata
+ conf.errordata
+ dh.errordata
+ digest.errordata
+ dsa.errordata
+ ecdh.errordata
+ ecdsa.errordata
+ ec.errordata
+ engine.errordata
+ evp.errordata
+ hkdf.errordata
+ obj.errordata
+ pem.errordata
+ pkcs8.errordata
+ rsa.errordata
+ ssl.errordata
+ x509.errordata
+ x509v3.errordata
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+add_library(
+ err
+
+ OBJECT
+
+ err.c
+ err_data.c
+)
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/asn1.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/asn1.errordata
new file mode 100644
index 000000000..c304b2caf
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/asn1.errordata
@@ -0,0 +1,92 @@
+ASN1,100,ASN1_LENGTH_MISMATCH
+ASN1,101,AUX_ERROR
+ASN1,102,BAD_GET_ASN1_OBJECT_CALL
+ASN1,103,BAD_OBJECT_HEADER
+ASN1,104,BMPSTRING_IS_WRONG_LENGTH
+ASN1,105,BN_LIB
+ASN1,106,BOOLEAN_IS_WRONG_LENGTH
+ASN1,107,BUFFER_TOO_SMALL
+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,190,WRONG_TAG
+ASN1,191,WRONG_TYPE
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/bio.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/bio.errordata
new file mode 100644
index 000000000..94b3c9717
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/bio.errordata
@@ -0,0 +1,17 @@
+BIO,100,BAD_FOPEN_MODE
+BIO,101,BROKEN_PIPE
+BIO,102,CONNECT_ERROR
+BIO,103,ERROR_SETTING_NBIO
+BIO,104,INVALID_ARGUMENT
+BIO,105,IN_USE
+BIO,106,KEEPALIVE
+BIO,107,NBIO_CONNECT_ERROR
+BIO,108,NO_HOSTNAME_SPECIFIED
+BIO,109,NO_PORT_SPECIFIED
+BIO,110,NO_SUCH_FILE
+BIO,111,NULL_PARAMETER
+BIO,112,SYS_LIB
+BIO,113,UNABLE_TO_CREATE_SOCKET
+BIO,114,UNINITIALIZED
+BIO,115,UNSUPPORTED_METHOD
+BIO,116,WRITE_TO_READ_ONLY_BIO
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/bn.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/bn.errordata
new file mode 100644
index 000000000..76b63925d
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/bn.errordata
@@ -0,0 +1,19 @@
+BN,100,ARG2_LT_ARG3
+BN,117,BAD_ENCODING
+BN,101,BAD_RECIPROCAL
+BN,102,BIGNUM_TOO_LONG
+BN,103,BITS_TOO_SMALL
+BN,104,CALLED_WITH_EVEN_MODULUS
+BN,105,DIV_BY_ZERO
+BN,118,ENCODE_ERROR
+BN,106,EXPAND_ON_STATIC_BIGNUM_DATA
+BN,107,INPUT_NOT_REDUCED
+BN,108,INVALID_RANGE
+BN,109,NEGATIVE_NUMBER
+BN,110,NOT_A_SQUARE
+BN,111,NOT_INITIALIZED
+BN,112,NO_INVERSE
+BN,113,PRIVATE_KEY_TOO_LARGE
+BN,114,P_IS_NOT_PRIME
+BN,115,TOO_MANY_ITERATIONS
+BN,116,TOO_MANY_TEMPORARY_VARIABLES
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/cipher.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/cipher.errordata
new file mode 100644
index 000000000..103750558
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/cipher.errordata
@@ -0,0 +1,25 @@
+CIPHER,100,AES_KEY_SETUP_FAILED
+CIPHER,101,BAD_DECRYPT
+CIPHER,102,BAD_KEY_LENGTH
+CIPHER,103,BUFFER_TOO_SMALL
+CIPHER,104,CTRL_NOT_IMPLEMENTED
+CIPHER,105,CTRL_OPERATION_NOT_IMPLEMENTED
+CIPHER,106,DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH
+CIPHER,107,INITIALIZATION_ERROR
+CIPHER,108,INPUT_NOT_INITIALIZED
+CIPHER,109,INVALID_AD_SIZE
+CIPHER,110,INVALID_KEY_LENGTH
+CIPHER,111,INVALID_NONCE_SIZE
+CIPHER,112,INVALID_OPERATION
+CIPHER,113,IV_TOO_LARGE
+CIPHER,114,NO_CIPHER_SET
+CIPHER,124,NO_DIRECTION_SET
+CIPHER,115,OUTPUT_ALIASES_INPUT
+CIPHER,116,TAG_TOO_LARGE
+CIPHER,117,TOO_LARGE
+CIPHER,118,UNSUPPORTED_AD_SIZE
+CIPHER,119,UNSUPPORTED_INPUT_SIZE
+CIPHER,120,UNSUPPORTED_KEY_SIZE
+CIPHER,121,UNSUPPORTED_NONCE_SIZE
+CIPHER,122,UNSUPPORTED_TAG_SIZE
+CIPHER,123,WRONG_FINAL_BLOCK_LENGTH
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/conf.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/conf.errordata
new file mode 100644
index 000000000..651fabe10
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/conf.errordata
@@ -0,0 +1,6 @@
+CONF,100,LIST_CANNOT_BE_NULL
+CONF,101,MISSING_CLOSE_SQUARE_BRACKET
+CONF,102,MISSING_EQUAL_SIGN
+CONF,103,NO_CLOSE_BRACE
+CONF,104,UNABLE_TO_CREATE_NEW_SECTION
+CONF,105,VARIABLE_HAS_NO_VALUE
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/dh.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/dh.errordata
new file mode 100644
index 000000000..9e1b87d85
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/dh.errordata
@@ -0,0 +1,6 @@
+DH,100,BAD_GENERATOR
+DH,104,DECODE_ERROR
+DH,105,ENCODE_ERROR
+DH,101,INVALID_PUBKEY
+DH,102,MODULUS_TOO_LARGE
+DH,103,NO_PRIVATE_VALUE
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/digest.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/digest.errordata
new file mode 100644
index 000000000..411e778b8
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/digest.errordata
@@ -0,0 +1 @@
+DIGEST,100,INPUT_NOT_INITIALIZED
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/dsa.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/dsa.errordata
new file mode 100644
index 000000000..6f4bc138a
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/dsa.errordata
@@ -0,0 +1,7 @@
+DSA,100,BAD_Q_VALUE
+DSA,104,BAD_VERSION
+DSA,105,DECODE_ERROR
+DSA,106,ENCODE_ERROR
+DSA,101,MISSING_PARAMETERS
+DSA,102,MODULUS_TOO_LARGE
+DSA,103,NEED_NEW_SETUP_VALUES
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ec.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ec.errordata
new file mode 100644
index 000000000..aada76e2f
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ec.errordata
@@ -0,0 +1,32 @@
+EC,126,BIGNUM_OUT_OF_RANGE
+EC,100,BUFFER_TOO_SMALL
+EC,101,COORDINATES_OUT_OF_RANGE
+EC,102,D2I_ECPKPARAMETERS_FAILURE
+EC,128,DECODE_ERROR
+EC,103,EC_GROUP_NEW_BY_NAME_FAILURE
+EC,129,ENCODE_ERROR
+EC,104,GROUP2PKPARAMETERS_FAILURE
+EC,130,GROUP_MISMATCH
+EC,105,I2D_ECPKPARAMETERS_FAILURE
+EC,106,INCOMPATIBLE_OBJECTS
+EC,131,INVALID_COFACTOR
+EC,107,INVALID_COMPRESSED_POINT
+EC,108,INVALID_COMPRESSION_BIT
+EC,109,INVALID_ENCODING
+EC,110,INVALID_FIELD
+EC,111,INVALID_FORM
+EC,112,INVALID_GROUP_ORDER
+EC,113,INVALID_PRIVATE_KEY
+EC,114,MISSING_PARAMETERS
+EC,115,MISSING_PRIVATE_KEY
+EC,116,NON_NAMED_CURVE
+EC,117,NOT_INITIALIZED
+EC,118,PKPARAMETERS2GROUP_FAILURE
+EC,119,POINT_AT_INFINITY
+EC,120,POINT_IS_NOT_ON_CURVE
+EC,121,SLOT_FULL
+EC,122,UNDEFINED_GENERATOR
+EC,123,UNKNOWN_GROUP
+EC,124,UNKNOWN_ORDER
+EC,127,WRONG_CURVE_PARAMETERS
+EC,125,WRONG_ORDER
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ecdh.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ecdh.errordata
new file mode 100644
index 000000000..f714c3049
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ecdh.errordata
@@ -0,0 +1,3 @@
+ECDH,100,KDF_FAILED
+ECDH,101,NO_PRIVATE_VALUE
+ECDH,102,POINT_ARITHMETIC_FAILURE
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ecdsa.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ecdsa.errordata
new file mode 100644
index 000000000..58ba591fa
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ecdsa.errordata
@@ -0,0 +1,6 @@
+ECDSA,100,BAD_SIGNATURE
+ECDSA,105,ENCODE_ERROR
+ECDSA,101,MISSING_PARAMETERS
+ECDSA,102,NEED_NEW_SETUP_VALUES
+ECDSA,103,NOT_IMPLEMENTED
+ECDSA,104,RANDOM_NUMBER_GENERATION_FAILED
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/engine.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/engine.errordata
new file mode 100644
index 000000000..edbd7b97b
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/engine.errordata
@@ -0,0 +1 @@
+ENGINE,100,OPERATION_NOT_SUPPORTED
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/err.c b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/err.c
new file mode 100644
index 000000000..cbb1260e5
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/err.c
@@ -0,0 +1,756 @@
+/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+ * All rights reserved.
+ *
+ * This package is an SSL implementation written
+ * by Eric Young (eay@cryptsoft.com).
+ * The implementation was written so as to conform with Netscapes SSL.
+ *
+ * This library is free for commercial and non-commercial use as long as
+ * the following conditions are aheared to. The following conditions
+ * apply to all code found in this distribution, be it the RC4, RSA,
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
+ * included with this distribution is covered by the same copyright terms
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
+ *
+ * Copyright remains Eric Young's, and as such any Copyright notices in
+ * the code are not to be removed.
+ * If this package is used in a product, Eric Young should be given attribution
+ * as the author of the parts of the library used.
+ * This can be in the form of a textual message at program startup or
+ * in documentation (online or textual) provided with the package.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * "This product includes cryptographic software written by
+ * Eric Young (eay@cryptsoft.com)"
+ * The word 'cryptographic' can be left out if the rouines from the library
+ * being used are not cryptographic related :-).
+ * 4. If you include any Windows specific code (or a derivative thereof) from
+ * the apps directory (application code) you must include an acknowledgement:
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * The licence and distribution terms for any publically available version or
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
+ * copied and put under another distribution licence
+ * [including the GNU Public Licence.]
+ */
+/* ====================================================================
+ * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ * software must display the following acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * openssl-core@openssl.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ * nor may "OpenSSL" appear in their names without prior written
+ * permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ * "This product includes software developed by the OpenSSL Project
+ * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com). */
+
+#include <openssl/err.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <inttypes.h>
+#include <string.h>
+
+#if defined(OPENSSL_WINDOWS)
+OPENSSL_MSVC_PRAGMA(warning(push, 3))
+#include <windows.h>
+OPENSSL_MSVC_PRAGMA(warning(pop))
+#endif
+
+#include <openssl/mem.h>
+#include <openssl/thread.h>
+
+#include "../internal.h"
+
+
+extern const uint32_t kOpenSSLReasonValues[];
+extern const size_t kOpenSSLReasonValuesLen;
+extern const char kOpenSSLReasonStringData[];
+
+/* err_clear_data frees the optional |data| member of the given error. */
+static void err_clear_data(struct err_error_st *error) {
+ if ((error->flags & ERR_FLAG_MALLOCED) != 0) {
+ OPENSSL_free(error->data);
+ }
+ error->data = NULL;
+ error->flags &= ~ERR_FLAG_MALLOCED;
+}
+
+/* err_clear clears the given queued error. */
+static void err_clear(struct err_error_st *error) {
+ err_clear_data(error);
+ OPENSSL_memset(error, 0, sizeof(struct err_error_st));
+}
+
+/* global_next_library contains the next custom library value to return. */
+static int global_next_library = ERR_NUM_LIBS;
+
+/* global_next_library_mutex protects |global_next_library| from concurrent
+ * updates. */
+static struct CRYPTO_STATIC_MUTEX global_next_library_mutex =
+ CRYPTO_STATIC_MUTEX_INIT;
+
+static void err_state_free(void *statep) {
+ ERR_STATE *state = statep;
+
+ if (state == NULL) {
+ return;
+ }
+
+ unsigned i;
+ for (i = 0; i < ERR_NUM_ERRORS; i++) {
+ err_clear(&state->errors[i]);
+ }
+ OPENSSL_free(state->to_free);
+ OPENSSL_free(state);
+}
+
+/* err_get_state gets the ERR_STATE object for the current thread. */
+static ERR_STATE *err_get_state(void) {
+ ERR_STATE *state = CRYPTO_get_thread_local(OPENSSL_THREAD_LOCAL_ERR);
+ if (state == NULL) {
+ state = OPENSSL_malloc(sizeof(ERR_STATE));
+ if (state == NULL) {
+ return NULL;
+ }
+ OPENSSL_memset(state, 0, sizeof(ERR_STATE));
+ if (!CRYPTO_set_thread_local(OPENSSL_THREAD_LOCAL_ERR, state,
+ err_state_free)) {
+ return NULL;
+ }
+ }
+
+ return state;
+}
+
+static uint32_t get_error_values(int inc, int top, const char **file, int *line,
+ const char **data, int *flags) {
+ unsigned i = 0;
+ ERR_STATE *state;
+ struct err_error_st *error;
+ uint32_t ret;
+
+ state = err_get_state();
+ if (state == NULL || state->bottom == state->top) {
+ return 0;
+ }
+
+ if (top) {
+ assert(!inc);
+ /* last error */
+ i = state->top;
+ } else {
+ i = (state->bottom + 1) % ERR_NUM_ERRORS;
+ }
+
+ error = &state->errors[i];
+ ret = error->packed;
+
+ if (file != NULL && line != NULL) {
+ if (error->file == NULL) {
+ *file = "NA";
+ *line = 0;
+ } else {
+ *file = error->file;
+ *line = error->line;
+ }
+ }
+
+ if (data != NULL) {
+ if (error->data == NULL) {
+ *data = "";
+ if (flags != NULL) {
+ *flags = 0;
+ }
+ } else {
+ *data = error->data;
+ if (flags != NULL) {
+ *flags = error->flags & ERR_FLAG_PUBLIC_MASK;
+ }
+ /* If this error is being removed, take ownership of data from
+ * the error. The semantics are such that the caller doesn't
+ * take ownership either. Instead the error system takes
+ * ownership and retains it until the next call that affects the
+ * error queue. */
+ if (inc) {
+ if (error->flags & ERR_FLAG_MALLOCED) {
+ OPENSSL_free(state->to_free);
+ state->to_free = error->data;
+ }
+ error->data = NULL;
+ error->flags = 0;
+ }
+ }
+ }
+
+ if (inc) {
+ assert(!top);
+ err_clear(error);
+ state->bottom = i;
+ }
+
+ return ret;
+}
+
+uint32_t ERR_get_error(void) {
+ return get_error_values(1 /* inc */, 0 /* bottom */, NULL, NULL, NULL, NULL);
+}
+
+uint32_t ERR_get_error_line(const char **file, int *line) {
+ return get_error_values(1 /* inc */, 0 /* bottom */, file, line, NULL, NULL);
+}
+
+uint32_t ERR_get_error_line_data(const char **file, int *line,
+ const char **data, int *flags) {
+ return get_error_values(1 /* inc */, 0 /* bottom */, file, line, data, flags);
+}
+
+uint32_t ERR_peek_error(void) {
+ return get_error_values(0 /* peek */, 0 /* bottom */, NULL, NULL, NULL, NULL);
+}
+
+uint32_t ERR_peek_error_line(const char **file, int *line) {
+ return get_error_values(0 /* peek */, 0 /* bottom */, file, line, NULL, NULL);
+}
+
+uint32_t ERR_peek_error_line_data(const char **file, int *line,
+ const char **data, int *flags) {
+ return get_error_values(0 /* peek */, 0 /* bottom */, file, line, data,
+ flags);
+}
+
+uint32_t ERR_peek_last_error(void) {
+ return get_error_values(0 /* peek */, 1 /* top */, NULL, NULL, NULL, NULL);
+}
+
+uint32_t ERR_peek_last_error_line(const char **file, int *line) {
+ return get_error_values(0 /* peek */, 1 /* top */, file, line, NULL, NULL);
+}
+
+uint32_t ERR_peek_last_error_line_data(const char **file, int *line,
+ const char **data, int *flags) {
+ return get_error_values(0 /* peek */, 1 /* top */, file, line, data, flags);
+}
+
+void ERR_clear_error(void) {
+ ERR_STATE *const state = err_get_state();
+ unsigned i;
+
+ if (state == NULL) {
+ return;
+ }
+
+ for (i = 0; i < ERR_NUM_ERRORS; i++) {
+ err_clear(&state->errors[i]);
+ }
+ OPENSSL_free(state->to_free);
+ state->to_free = NULL;
+
+ state->top = state->bottom = 0;
+}
+
+void ERR_remove_thread_state(const CRYPTO_THREADID *tid) {
+ if (tid != NULL) {
+ assert(0);
+ return;
+ }
+
+ ERR_clear_error();
+}
+
+int ERR_get_next_error_library(void) {
+ int ret;
+
+ CRYPTO_STATIC_MUTEX_lock_write(&global_next_library_mutex);
+ ret = global_next_library++;
+ CRYPTO_STATIC_MUTEX_unlock_write(&global_next_library_mutex);
+
+ return ret;
+}
+
+void ERR_remove_state(unsigned long pid) {
+ ERR_clear_error();
+}
+
+void ERR_clear_system_error(void) {
+ errno = 0;
+}
+
+char *ERR_error_string(uint32_t packed_error, char *ret) {
+ static char buf[ERR_ERROR_STRING_BUF_LEN];
+
+ if (ret == NULL) {
+ /* TODO(fork): remove this. */
+ ret = buf;
+ }
+
+#if !defined(NDEBUG)
+ /* This is aimed to help catch callers who don't provide
+ * |ERR_ERROR_STRING_BUF_LEN| bytes of space. */
+ OPENSSL_memset(ret, 0, ERR_ERROR_STRING_BUF_LEN);
+#endif
+
+ ERR_error_string_n(packed_error, ret, ERR_ERROR_STRING_BUF_LEN);
+
+ return ret;
+}
+
+void ERR_error_string_n(uint32_t packed_error, char *buf, size_t len) {
+ char lib_buf[64], reason_buf[64];
+ const char *lib_str, *reason_str;
+ unsigned lib, reason;
+
+ if (len == 0) {
+ return;
+ }
+
+ lib = ERR_GET_LIB(packed_error);
+ reason = ERR_GET_REASON(packed_error);
+
+ lib_str = ERR_lib_error_string(packed_error);
+ reason_str = ERR_reason_error_string(packed_error);
+
+ if (lib_str == NULL) {
+ BIO_snprintf(lib_buf, sizeof(lib_buf), "lib(%u)", lib);
+ lib_str = lib_buf;
+ }
+
+ if (reason_str == NULL) {
+ BIO_snprintf(reason_buf, sizeof(reason_buf), "reason(%u)", reason);
+ reason_str = reason_buf;
+ }
+
+ BIO_snprintf(buf, len, "error:%08" PRIx32 ":%s:OPENSSL_internal:%s",
+ packed_error, lib_str, reason_str);
+
+ if (strlen(buf) == len - 1) {
+ /* output may be truncated; make sure we always have 5 colon-separated
+ * fields, i.e. 4 colons. */
+ static const unsigned num_colons = 4;
+ unsigned i;
+ char *s = buf;
+
+ if (len <= num_colons) {
+ /* In this situation it's not possible to ensure that the correct number
+ * of colons are included in the output. */
+ return;
+ }
+
+ for (i = 0; i < num_colons; i++) {
+ char *colon = strchr(s, ':');
+ char *last_pos = &buf[len - 1] - num_colons + i;
+
+ if (colon == NULL || colon > last_pos) {
+ /* set colon |i| at last possible position (buf[len-1] is the
+ * terminating 0). If we're setting this colon, then all whole of the
+ * rest of the string must be colons in order to have the correct
+ * number. */
+ OPENSSL_memset(last_pos, ':', num_colons - i);
+ break;
+ }
+
+ s = colon + 1;
+ }
+ }
+}
+
+// err_string_cmp is a compare function for searching error values with
+// |bsearch| in |err_string_lookup|.
+static int err_string_cmp(const void *a, const void *b) {
+ const uint32_t a_key = *((const uint32_t*) a) >> 15;
+ const uint32_t b_key = *((const uint32_t*) b) >> 15;
+
+ if (a_key < b_key) {
+ return -1;
+ } else if (a_key > b_key) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+/* err_string_lookup looks up the string associated with |lib| and |key| in
+ * |values| and |string_data|. It returns the string or NULL if not found. */
+static const char *err_string_lookup(uint32_t lib, uint32_t key,
+ const uint32_t *values,
+ size_t num_values,
+ const char *string_data) {
+ /* |values| points to data in err_data.h, which is generated by
+ * err_data_generate.go. It's an array of uint32_t values. Each value has the
+ * following structure:
+ * | lib | key | offset |
+ * |6 bits| 11 bits | 15 bits |
+ *
+ * The |lib| value is a library identifier: one of the |ERR_LIB_*| values.
+ * The |key| is a reason code, depending on the context.
+ * The |offset| is the number of bytes from the start of |string_data| where
+ * the (NUL terminated) string for this value can be found.
+ *
+ * Values are sorted based on treating the |lib| and |key| part as an
+ * unsigned integer. */
+ if (lib >= (1 << 6) || key >= (1 << 11)) {
+ return NULL;
+ }
+ uint32_t search_key = lib << 26 | key << 15;
+ const uint32_t *result = bsearch(&search_key, values, num_values,
+ sizeof(uint32_t), err_string_cmp);
+ if (result == NULL) {
+ return NULL;
+ }
+
+ return &string_data[(*result) & 0x7fff];
+}
+
+static const char *const kLibraryNames[ERR_NUM_LIBS] = {
+ "invalid library (0)",
+ "unknown library", /* ERR_LIB_NONE */
+ "system library", /* ERR_LIB_SYS */
+ "bignum routines", /* ERR_LIB_BN */
+ "RSA routines", /* ERR_LIB_RSA */
+ "Diffie-Hellman routines", /* ERR_LIB_DH */
+ "public key routines", /* ERR_LIB_EVP */
+ "memory buffer routines", /* ERR_LIB_BUF */
+ "object identifier routines", /* ERR_LIB_OBJ */
+ "PEM routines", /* ERR_LIB_PEM */
+ "DSA routines", /* ERR_LIB_DSA */
+ "X.509 certificate routines", /* ERR_LIB_X509 */
+ "ASN.1 encoding routines", /* ERR_LIB_ASN1 */
+ "configuration file routines", /* ERR_LIB_CONF */
+ "common libcrypto routines", /* ERR_LIB_CRYPTO */
+ "elliptic curve routines", /* ERR_LIB_EC */
+ "SSL routines", /* ERR_LIB_SSL */
+ "BIO routines", /* ERR_LIB_BIO */
+ "PKCS7 routines", /* ERR_LIB_PKCS7 */
+ "PKCS8 routines", /* ERR_LIB_PKCS8 */
+ "X509 V3 routines", /* ERR_LIB_X509V3 */
+ "random number generator", /* ERR_LIB_RAND */
+ "ENGINE routines", /* ERR_LIB_ENGINE */
+ "OCSP routines", /* ERR_LIB_OCSP */
+ "UI routines", /* ERR_LIB_UI */
+ "COMP routines", /* ERR_LIB_COMP */
+ "ECDSA routines", /* ERR_LIB_ECDSA */
+ "ECDH routines", /* ERR_LIB_ECDH */
+ "HMAC routines", /* ERR_LIB_HMAC */
+ "Digest functions", /* ERR_LIB_DIGEST */
+ "Cipher functions", /* ERR_LIB_CIPHER */
+ "HKDF functions", /* ERR_LIB_HKDF */
+ "User defined functions", /* ERR_LIB_USER */
+};
+
+const char *ERR_lib_error_string(uint32_t packed_error) {
+ const uint32_t lib = ERR_GET_LIB(packed_error);
+
+ if (lib >= ERR_NUM_LIBS) {
+ return NULL;
+ }
+ return kLibraryNames[lib];
+}
+
+const char *ERR_func_error_string(uint32_t packed_error) {
+ return "OPENSSL_internal";
+}
+
+const char *ERR_reason_error_string(uint32_t packed_error) {
+ const uint32_t lib = ERR_GET_LIB(packed_error);
+ const uint32_t reason = ERR_GET_REASON(packed_error);
+
+ if (lib == ERR_LIB_SYS) {
+ if (reason < 127) {
+ return strerror(reason);
+ }
+ return NULL;
+ }
+
+ if (reason < ERR_NUM_LIBS) {
+ return kLibraryNames[reason];
+ }
+
+ if (reason < 100) {
+ switch (reason) {
+ case ERR_R_MALLOC_FAILURE:
+ return "malloc failure";
+ case ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED:
+ return "function should not have been called";
+ case ERR_R_PASSED_NULL_PARAMETER:
+ return "passed a null parameter";
+ case ERR_R_INTERNAL_ERROR:
+ return "internal error";
+ case ERR_R_OVERFLOW:
+ return "overflow";
+ default:
+ return NULL;
+ }
+ }
+
+ return err_string_lookup(lib, reason, kOpenSSLReasonValues,
+ kOpenSSLReasonValuesLen, kOpenSSLReasonStringData);
+}
+
+void ERR_print_errors_cb(ERR_print_errors_callback_t callback, void *ctx) {
+ char buf[ERR_ERROR_STRING_BUF_LEN];
+ char buf2[1024];
+ const char *file, *data;
+ int line, flags;
+ uint32_t packed_error;
+
+ /* thread_hash is the least-significant bits of the |ERR_STATE| pointer value
+ * for this thread. */
+ const unsigned long thread_hash = (uintptr_t) err_get_state();
+
+ for (;;) {
+ packed_error = ERR_get_error_line_data(&file, &line, &data, &flags);
+ if (packed_error == 0) {
+ break;
+ }
+
+ ERR_error_string_n(packed_error, buf, sizeof(buf));
+ BIO_snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", thread_hash, buf,
+ file, line, (flags & ERR_FLAG_STRING) ? data : "");
+ if (callback(buf2, strlen(buf2), ctx) <= 0) {
+ break;
+ }
+ }
+}
+
+static int print_errors_to_file(const char* msg, size_t msg_len, void* ctx) {
+ assert(msg[msg_len] == '\0');
+ FILE* fp = ctx;
+ int res = fputs(msg, fp);
+ return res < 0 ? 0 : 1;
+}
+
+void ERR_print_errors_fp(FILE *file) {
+ ERR_print_errors_cb(print_errors_to_file, file);
+}
+
+/* err_set_error_data sets the data on the most recent error. The |flags|
+ * argument is a combination of the |ERR_FLAG_*| values. */
+static void err_set_error_data(char *data, int flags) {
+ ERR_STATE *const state = err_get_state();
+ struct err_error_st *error;
+
+ if (state == NULL || state->top == state->bottom) {
+ if (flags & ERR_FLAG_MALLOCED) {
+ OPENSSL_free(data);
+ }
+ return;
+ }
+
+ error = &state->errors[state->top];
+
+ err_clear_data(error);
+ error->data = data;
+ error->flags = flags;
+}
+
+void ERR_put_error(int library, int unused, int reason, const char *file,
+ unsigned line) {
+ ERR_STATE *const state = err_get_state();
+ struct err_error_st *error;
+
+ if (state == NULL) {
+ return;
+ }
+
+ if (library == ERR_LIB_SYS && reason == 0) {
+#if defined(OPENSSL_WINDOWS)
+ reason = GetLastError();
+#else
+ reason = errno;
+#endif
+ }
+
+ state->top = (state->top + 1) % ERR_NUM_ERRORS;
+ if (state->top == state->bottom) {
+ state->bottom = (state->bottom + 1) % ERR_NUM_ERRORS;
+ }
+
+ error = &state->errors[state->top];
+ err_clear(error);
+ error->file = file;
+ error->line = line;
+ error->packed = ERR_PACK(library, reason);
+}
+
+/* ERR_add_error_data_vdata takes a variable number of const char* pointers,
+ * concatenates them and sets the result as the data on the most recent
+ * error. */
+static void err_add_error_vdata(unsigned num, va_list args) {
+ size_t alloced, new_len, len = 0, substr_len;
+ char *buf;
+ const char *substr;
+ unsigned i;
+
+ alloced = 80;
+ buf = OPENSSL_malloc(alloced + 1);
+ if (buf == NULL) {
+ return;
+ }
+
+ for (i = 0; i < num; i++) {
+ substr = va_arg(args, const char *);
+ if (substr == NULL) {
+ continue;
+ }
+
+ substr_len = strlen(substr);
+ new_len = len + substr_len;
+ if (new_len > alloced) {
+ char *new_buf;
+
+ if (alloced + 20 + 1 < alloced) {
+ /* overflow. */
+ OPENSSL_free(buf);
+ return;
+ }
+
+ alloced = new_len + 20;
+ new_buf = OPENSSL_realloc(buf, alloced + 1);
+ if (new_buf == NULL) {
+ OPENSSL_free(buf);
+ return;
+ }
+ buf = new_buf;
+ }
+
+ OPENSSL_memcpy(buf + len, substr, substr_len);
+ len = new_len;
+ }
+
+ buf[len] = 0;
+ err_set_error_data(buf, ERR_FLAG_MALLOCED | ERR_FLAG_STRING);
+}
+
+void ERR_add_error_data(unsigned count, ...) {
+ va_list args;
+ va_start(args, count);
+ err_add_error_vdata(count, args);
+ va_end(args);
+}
+
+void ERR_add_error_dataf(const char *format, ...) {
+ va_list ap;
+ char *buf;
+ static const unsigned buf_len = 256;
+
+ /* A fixed-size buffer is used because va_copy (which would be needed in
+ * order to call vsnprintf twice and measure the buffer) wasn't defined until
+ * C99. */
+ buf = OPENSSL_malloc(buf_len + 1);
+ if (buf == NULL) {
+ return;
+ }
+
+ va_start(ap, format);
+ BIO_vsnprintf(buf, buf_len, format, ap);
+ buf[buf_len] = 0;
+ va_end(ap);
+
+ err_set_error_data(buf, ERR_FLAG_MALLOCED | ERR_FLAG_STRING);
+}
+
+int ERR_set_mark(void) {
+ ERR_STATE *const state = err_get_state();
+
+ if (state == NULL || state->bottom == state->top) {
+ return 0;
+ }
+ state->errors[state->top].flags |= ERR_FLAG_MARK;
+ return 1;
+}
+
+int ERR_pop_to_mark(void) {
+ ERR_STATE *const state = err_get_state();
+
+ if (state == NULL) {
+ return 0;
+ }
+
+ while (state->bottom != state->top) {
+ struct err_error_st *error = &state->errors[state->top];
+
+ if ((error->flags & ERR_FLAG_MARK) != 0) {
+ error->flags &= ~ERR_FLAG_MARK;
+ return 1;
+ }
+
+ err_clear(error);
+ if (state->top == 0) {
+ state->top = ERR_NUM_ERRORS - 1;
+ } else {
+ state->top--;
+ }
+ }
+
+ return 0;
+}
+
+void ERR_load_crypto_strings(void) {}
+
+void ERR_free_strings(void) {}
+
+void ERR_load_BIO_strings(void) {}
+
+void ERR_load_ERR_strings(void) {}
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/err_data_generate.go b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/err_data_generate.go
new file mode 100644
index 000000000..893ebffe5
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/err_data_generate.go
@@ -0,0 +1,284 @@
+/* Copyright (c) 2015, Google Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+
+package main
+
+import (
+ "bufio"
+ "bytes"
+ "errors"
+ "flag"
+ "fmt"
+ "io"
+ "os"
+ "sort"
+ "strconv"
+ "strings"
+)
+
+var verbose = flag.Bool("verbose", false, "If true, prints a status message at the end.")
+
+// libraryNames must be kept in sync with the enum in err.h. The generated code
+// will contain static assertions to enforce this.
+var libraryNames = []string{
+ "NONE",
+ "SYS",
+ "BN",
+ "RSA",
+ "DH",
+ "EVP",
+ "BUF",
+ "OBJ",
+ "PEM",
+ "DSA",
+ "X509",
+ "ASN1",
+ "CONF",
+ "CRYPTO",
+ "EC",
+ "SSL",
+ "BIO",
+ "PKCS7",
+ "PKCS8",
+ "X509V3",
+ "RAND",
+ "ENGINE",
+ "OCSP",
+ "UI",
+ "COMP",
+ "ECDSA",
+ "ECDH",
+ "HMAC",
+ "DIGEST",
+ "CIPHER",
+ "HKDF",
+ "USER",
+}
+
+// stringList is a map from uint32 -> string which can output data for a sorted
+// list as C literals.
+type stringList struct {
+ // entries is an array of keys and offsets into |stringData|. The
+ // offsets are in the bottom 15 bits of each uint32 and the key is the
+ // top 17 bits.
+ entries []uint32
+ // internedStrings contains the same strings as are in |stringData|,
+ // but allows for easy deduplication. It maps a string to its offset in
+ // |stringData|.
+ internedStrings map[string]uint32
+ stringData []byte
+}
+
+func newStringList() *stringList {
+ return &stringList{
+ internedStrings: make(map[string]uint32),
+ }
+}
+
+// offsetMask is the bottom 15 bits. It's a mask that selects the offset from a
+// uint32 in entries.
+const offsetMask = 0x7fff
+
+func (st *stringList) Add(key uint32, value string) error {
+ if key&offsetMask != 0 {
+ return errors.New("need bottom 15 bits of the key for the offset")
+ }
+ offset, ok := st.internedStrings[value]
+ if !ok {
+ offset = uint32(len(st.stringData))
+ if offset&offsetMask != offset {
+ return errors.New("stringList overflow")
+ }
+ st.stringData = append(st.stringData, []byte(value)...)
+ st.stringData = append(st.stringData, 0)
+ st.internedStrings[value] = offset
+ }
+
+ for _, existing := range st.entries {
+ if existing>>15 == key>>15 {
+ panic("duplicate entry")
+ }
+ }
+ st.entries = append(st.entries, key|offset)
+ return nil
+}
+
+// keySlice is a type that implements sorting of entries values.
+type keySlice []uint32
+
+func (ks keySlice) Len() int {
+ return len(ks)
+}
+
+func (ks keySlice) Less(i, j int) bool {
+ return (ks[i] >> 15) < (ks[j] >> 15)
+}
+
+func (ks keySlice) Swap(i, j int) {
+ ks[i], ks[j] = ks[j], ks[i]
+}
+
+func (st *stringList) buildList() []uint32 {
+ sort.Sort(keySlice(st.entries))
+ return st.entries
+}
+
+type stringWriter interface {
+ io.Writer
+ WriteString(string) (int, error)
+}
+
+func (st *stringList) WriteTo(out stringWriter, name string) {
+ list := st.buildList()
+ if *verbose {
+ fmt.Fprintf(os.Stderr, "%s: %d bytes of list and %d bytes of string data.\n", name, 4*len(list), len(st.stringData))
+ }
+
+ values := "kOpenSSL" + name + "Values"
+ out.WriteString("const uint32_t " + values + "[] = {\n")
+ for _, v := range list {
+ fmt.Fprintf(out, " 0x%x,\n", v)
+ }
+ out.WriteString("};\n\n")
+ out.WriteString("const size_t " + values + "Len = sizeof(" + values + ") / sizeof(" + values + "[0]);\n\n")
+
+ stringData := "kOpenSSL" + name + "StringData"
+ out.WriteString("const char " + stringData + "[] =\n \"")
+ for i, c := range st.stringData {
+ if c == 0 {
+ out.WriteString("\\0\"\n \"")
+ continue
+ }
+ out.Write(st.stringData[i : i+1])
+ }
+ out.WriteString("\";\n\n")
+}
+
+type errorData struct {
+ reasons *stringList
+ libraryMap map[string]uint32
+}
+
+func (e *errorData) readErrorDataFile(filename string) error {
+ inFile, err := os.Open(filename)
+ if err != nil {
+ return err
+ }
+ defer inFile.Close()
+
+ scanner := bufio.NewScanner(inFile)
+ comma := []byte(",")
+
+ lineNo := 0
+ for scanner.Scan() {
+ lineNo++
+
+ line := scanner.Bytes()
+ if len(line) == 0 {
+ continue
+ }
+ parts := bytes.Split(line, comma)
+ if len(parts) != 3 {
+ return fmt.Errorf("bad line %d in %s: found %d values but want 3", lineNo, filename, len(parts))
+ }
+ libNum, ok := e.libraryMap[string(parts[0])]
+ if !ok {
+ return fmt.Errorf("bad line %d in %s: unknown library", lineNo, filename)
+ }
+ if libNum >= 64 {
+ return fmt.Errorf("bad line %d in %s: library value too large", lineNo, filename)
+ }
+ key, err := strconv.ParseUint(string(parts[1]), 10 /* base */, 32 /* bit size */)
+ if err != nil {
+ return fmt.Errorf("bad line %d in %s: %s", lineNo, filename, err)
+ }
+ if key >= 2048 {
+ return fmt.Errorf("bad line %d in %s: key too large", lineNo, filename)
+ }
+ value := string(parts[2])
+
+ listKey := libNum<<26 | uint32(key)<<15
+
+ err = e.reasons.Add(listKey, value)
+ if err != nil {
+ return err
+ }
+ }
+
+ return scanner.Err()
+}
+
+func main() {
+ flag.Parse()
+
+ e := &errorData{
+ reasons: newStringList(),
+ libraryMap: make(map[string]uint32),
+ }
+ for i, name := range libraryNames {
+ e.libraryMap[name] = uint32(i) + 1
+ }
+
+ cwd, err := os.Open(".")
+ if err != nil {
+ panic(err)
+ }
+ names, err := cwd.Readdirnames(-1)
+ if err != nil {
+ panic(err)
+ }
+
+ sort.Strings(names)
+ for _, name := range names {
+ if !strings.HasSuffix(name, ".errordata") {
+ continue
+ }
+ if err := e.readErrorDataFile(name); err != nil {
+ panic(err)
+ }
+ }
+
+ out := os.Stdout
+
+ out.WriteString(`/* Copyright (c) 2015, Google Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+
+ /* This file was generated by err_data_generate.go. */
+
+#include <openssl/base.h>
+#include <openssl/err.h>
+#include <openssl/type_check.h>
+
+
+`)
+
+ for i, name := range libraryNames {
+ fmt.Fprintf(out, "OPENSSL_COMPILE_ASSERT(ERR_LIB_%s == %d, library_values_changed_%d);\n", name, i+1, i+1)
+ }
+ fmt.Fprintf(out, "OPENSSL_COMPILE_ASSERT(ERR_NUM_LIBS == %d, library_values_changed_num);\n", len(libraryNames)+1)
+ out.WriteString("\n")
+
+ e.reasons.WriteTo(out, "Reason")
+}
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/err_test.cc b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/err_test.cc
new file mode 100644
index 000000000..8e820b851
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/err_test.cc
@@ -0,0 +1,121 @@
+/* Copyright (c) 2014, Google Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <gtest/gtest.h>
+
+#include <openssl/crypto.h>
+#include <openssl/err.h>
+#include <openssl/mem.h>
+
+
+TEST(ErrTest, Overflow) {
+ for (unsigned i = 0; i < ERR_NUM_ERRORS*2; i++) {
+ ERR_put_error(1, 0 /* unused */, i+1, "test", 1);
+ }
+
+ for (unsigned i = 0; i < ERR_NUM_ERRORS - 1; i++) {
+ SCOPED_TRACE(i);
+ uint32_t err = ERR_get_error();
+ /* Errors are returned in order they were pushed, with the least recent ones
+ * removed, up to |ERR_NUM_ERRORS - 1| errors. So the errors returned are
+ * |ERR_NUM_ERRORS + 2| through |ERR_NUM_ERRORS * 2|, inclusive. */
+ EXPECT_NE(0u, err);
+ EXPECT_EQ(static_cast<int>(i + ERR_NUM_ERRORS + 2), ERR_GET_REASON(err));
+ }
+
+ EXPECT_EQ(0u, ERR_get_error());
+}
+
+TEST(ErrTest, PutError) {
+ ASSERT_EQ(0u, ERR_get_error())
+ << "ERR_get_error returned value before an error was added.";
+
+ ERR_put_error(1, 0 /* unused */, 2, "test", 4);
+ ERR_add_error_data(1, "testing");
+
+ int peeked_line, line, peeked_flags, flags;
+ const char *peeked_file, *file, *peeked_data, *data;
+ uint32_t peeked_packed_error =
+ ERR_peek_error_line_data(&peeked_file, &peeked_line, &peeked_data,
+ &peeked_flags);
+ uint32_t packed_error = ERR_get_error_line_data(&file, &line, &data, &flags);
+
+ EXPECT_EQ(peeked_packed_error, packed_error);
+ EXPECT_EQ(peeked_file, file);
+ EXPECT_EQ(peeked_data, data);
+ EXPECT_EQ(peeked_flags, flags);
+
+ EXPECT_STREQ("test", file);
+ EXPECT_EQ(4, line);
+ EXPECT_TRUE(flags & ERR_FLAG_STRING);
+ EXPECT_EQ(1, ERR_GET_LIB(packed_error));
+ EXPECT_EQ(2, ERR_GET_REASON(packed_error));
+ EXPECT_STREQ("testing", data);
+}
+
+TEST(ErrTest, ClearError) {
+ ASSERT_EQ(0u, ERR_get_error())
+ << "ERR_get_error returned value before an error was added.";
+
+ ERR_put_error(1, 0 /* unused */, 2, "test", 4);
+ ERR_clear_error();
+
+ // The error queue should be cleared.
+ EXPECT_EQ(0u, ERR_get_error());
+}
+
+TEST(ErrTest, Print) {
+ ERR_put_error(1, 0 /* unused */, 2, "test", 4);
+ ERR_add_error_data(1, "testing");
+ uint32_t packed_error = ERR_get_error();
+
+ char buf[256];
+ for (size_t i = 0; i <= sizeof(buf); i++) {
+ ERR_error_string_n(packed_error, buf, i);
+ }
+}
+
+TEST(ErrTest, Release) {
+ ERR_put_error(1, 0 /* unused */, 2, "test", 4);
+ ERR_remove_thread_state(NULL);
+
+ // The error queue should be cleared.
+ EXPECT_EQ(0u, ERR_get_error());
+}
+
+static bool HasSuffix(const char *str, const char *suffix) {
+ size_t suffix_len = strlen(suffix);
+ size_t str_len = strlen(str);
+ if (str_len < suffix_len) {
+ return false;
+ }
+ return strcmp(str + str_len - suffix_len, suffix) == 0;
+}
+
+TEST(ErrTest, PutMacro) {
+ int expected_line = __LINE__ + 1;
+ OPENSSL_PUT_ERROR(USER, ERR_R_INTERNAL_ERROR);
+
+ int line;
+ const char *file;
+ uint32_t error = ERR_get_error_line(&file, &line);
+
+ EXPECT_PRED2(HasSuffix, file, "err_test.cc");
+ EXPECT_EQ(expected_line, line);
+ EXPECT_EQ(ERR_LIB_USER, ERR_GET_LIB(error));
+ EXPECT_EQ(ERR_R_INTERNAL_ERROR, ERR_GET_REASON(error));
+}
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/evp.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/evp.errordata
new file mode 100644
index 000000000..a482f7693
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/evp.errordata
@@ -0,0 +1,30 @@
+EVP,100,BUFFER_TOO_SMALL
+EVP,101,COMMAND_NOT_SUPPORTED
+EVP,102,DECODE_ERROR
+EVP,103,DIFFERENT_KEY_TYPES
+EVP,104,DIFFERENT_PARAMETERS
+EVP,105,ENCODE_ERROR
+EVP,106,EXPECTING_AN_EC_KEY_KEY
+EVP,107,EXPECTING_AN_RSA_KEY
+EVP,108,EXPECTING_A_DSA_KEY
+EVP,109,ILLEGAL_OR_UNSUPPORTED_PADDING_MODE
+EVP,110,INVALID_DIGEST_LENGTH
+EVP,111,INVALID_DIGEST_TYPE
+EVP,112,INVALID_KEYBITS
+EVP,113,INVALID_MGF1_MD
+EVP,114,INVALID_OPERATION
+EVP,115,INVALID_PADDING_MODE
+EVP,116,INVALID_PSS_SALTLEN
+EVP,117,KEYS_NOT_SET
+EVP,118,MISSING_PARAMETERS
+EVP,119,NO_DEFAULT_DIGEST
+EVP,120,NO_KEY_SET
+EVP,121,NO_MDC2_SUPPORT
+EVP,122,NO_NID_FOR_CURVE
+EVP,123,NO_OPERATION_SET
+EVP,124,NO_PARAMETERS_SET
+EVP,125,OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE
+EVP,126,OPERATON_NOT_INITIALIZED
+EVP,127,UNKNOWN_PUBLIC_KEY_TYPE
+EVP,128,UNSUPPORTED_ALGORITHM
+EVP,129,UNSUPPORTED_PUBLIC_KEY_TYPE
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/hkdf.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/hkdf.errordata
new file mode 100644
index 000000000..84866dee1
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/hkdf.errordata
@@ -0,0 +1 @@
+HKDF,100,OUTPUT_TOO_LARGE
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/obj.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/obj.errordata
new file mode 100644
index 000000000..c54435ea9
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/obj.errordata
@@ -0,0 +1 @@
+OBJ,100,UNKNOWN_NID
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/pem.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/pem.errordata
new file mode 100644
index 000000000..2a4b73af2
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/pem.errordata
@@ -0,0 +1,15 @@
+PEM,100,BAD_BASE64_DECODE
+PEM,101,BAD_DECRYPT
+PEM,102,BAD_END_LINE
+PEM,103,BAD_IV_CHARS
+PEM,104,BAD_PASSWORD_READ
+PEM,105,CIPHER_IS_NULL
+PEM,106,ERROR_CONVERTING_PRIVATE_KEY
+PEM,107,NOT_DEK_INFO
+PEM,108,NOT_ENCRYPTED
+PEM,109,NOT_PROC_TYPE
+PEM,110,NO_START_LINE
+PEM,111,READ_KEY
+PEM,112,SHORT_HEADER
+PEM,113,UNSUPPORTED_CIPHER
+PEM,114,UNSUPPORTED_ENCRYPTION
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/pkcs8.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/pkcs8.errordata
new file mode 100644
index 000000000..0eb5083bc
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/pkcs8.errordata
@@ -0,0 +1,25 @@
+PKCS8,100,BAD_PKCS12_DATA
+PKCS8,101,BAD_PKCS12_VERSION
+PKCS8,102,CIPHER_HAS_NO_OBJECT_IDENTIFIER
+PKCS8,103,CRYPT_ERROR
+PKCS8,104,DECODE_ERROR
+PKCS8,105,ENCODE_ERROR
+PKCS8,106,ENCRYPT_ERROR
+PKCS8,107,ERROR_SETTING_CIPHER_PARAMS
+PKCS8,108,INCORRECT_PASSWORD
+PKCS8,109,KEYGEN_FAILURE
+PKCS8,110,KEY_GEN_ERROR
+PKCS8,111,METHOD_NOT_SUPPORTED
+PKCS8,112,MISSING_MAC
+PKCS8,113,MULTIPLE_PRIVATE_KEYS_IN_PKCS12
+PKCS8,114,PKCS12_PUBLIC_KEY_INTEGRITY_NOT_SUPPORTED
+PKCS8,115,PKCS12_TOO_DEEPLY_NESTED
+PKCS8,116,PRIVATE_KEY_DECODE_ERROR
+PKCS8,117,PRIVATE_KEY_ENCODE_ERROR
+PKCS8,118,TOO_LONG
+PKCS8,119,UNKNOWN_ALGORITHM
+PKCS8,120,UNKNOWN_CIPHER
+PKCS8,121,UNKNOWN_CIPHER_ALGORITHM
+PKCS8,122,UNKNOWN_DIGEST
+PKCS8,123,UNKNOWN_HASH
+PKCS8,124,UNSUPPORTED_PRIVATE_KEY_ALGORITHM
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/rsa.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/rsa.errordata
new file mode 100644
index 000000000..62d286cc3
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/rsa.errordata
@@ -0,0 +1,46 @@
+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
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ssl.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ssl.errordata
new file mode 100644
index 000000000..7fddc983d
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/ssl.errordata
@@ -0,0 +1,208 @@
+SSL,100,APP_DATA_IN_HANDSHAKE
+SSL,101,ATTEMPT_TO_REUSE_SESSION_IN_DIFFERENT_CONTEXT
+SSL,102,BAD_ALERT
+SSL,103,BAD_CHANGE_CIPHER_SPEC
+SSL,104,BAD_DATA_RETURNED_BY_CALLBACK
+SSL,105,BAD_DH_P_LENGTH
+SSL,106,BAD_DIGEST_LENGTH
+SSL,107,BAD_ECC_CERT
+SSL,108,BAD_ECPOINT
+SSL,109,BAD_HANDSHAKE_RECORD
+SSL,110,BAD_HELLO_REQUEST
+SSL,111,BAD_LENGTH
+SSL,112,BAD_PACKET_LENGTH
+SSL,113,BAD_RSA_ENCRYPT
+SSL,114,BAD_SIGNATURE
+SSL,115,BAD_SRTP_MKI_VALUE
+SSL,116,BAD_SRTP_PROTECTION_PROFILE_LIST
+SSL,117,BAD_SSL_FILETYPE
+SSL,118,BAD_WRITE_RETRY
+SSL,119,BIO_NOT_SET
+SSL,261,BLOCK_CIPHER_PAD_IS_WRONG
+SSL,120,BN_LIB
+SSL,255,BUFFERED_MESSAGES_ON_CIPHER_CHANGE
+SSL,121,BUFFER_TOO_SMALL
+SSL,275,CANNOT_HAVE_BOTH_PRIVKEY_AND_METHOD
+SSL,272,CANNOT_PARSE_LEAF_CERT
+SSL,122,CA_DN_LENGTH_MISMATCH
+SSL,123,CA_DN_TOO_LONG
+SSL,124,CCS_RECEIVED_EARLY
+SSL,274,CERTIFICATE_AND_PRIVATE_KEY_MISMATCH
+SSL,125,CERTIFICATE_VERIFY_FAILED
+SSL,126,CERT_CB_ERROR
+SSL,127,CERT_LENGTH_MISMATCH
+SSL,128,CHANNEL_ID_NOT_P256
+SSL,129,CHANNEL_ID_SIGNATURE_INVALID
+SSL,130,CIPHER_OR_HASH_UNAVAILABLE
+SSL,131,CLIENTHELLO_PARSE_FAILED
+SSL,132,CLIENTHELLO_TLSEXT
+SSL,133,CONNECTION_REJECTED
+SSL,134,CONNECTION_TYPE_NOT_SET
+SSL,135,CUSTOM_EXTENSION_ERROR
+SSL,136,DATA_LENGTH_TOO_LONG
+SSL,137,DECODE_ERROR
+SSL,138,DECRYPTION_FAILED
+SSL,139,DECRYPTION_FAILED_OR_BAD_RECORD_MAC
+SSL,140,DH_PUBLIC_VALUE_LENGTH_IS_WRONG
+SSL,141,DH_P_TOO_LONG
+SSL,142,DIGEST_CHECK_FAILED
+SSL,254,DOWNGRADE_DETECTED
+SSL,143,DTLS_MESSAGE_TOO_BIG
+SSL,257,DUPLICATE_EXTENSION
+SSL,264,DUPLICATE_KEY_SHARE
+SSL,144,ECC_CERT_NOT_FOR_SIGNING
+SSL,145,EMS_STATE_INCONSISTENT
+SSL,146,ENCRYPTED_LENGTH_TOO_LONG
+SSL,147,ERROR_ADDING_EXTENSION
+SSL,148,ERROR_IN_RECEIVED_CIPHER_LIST
+SSL,149,ERROR_PARSING_EXTENSION
+SSL,150,EXCESSIVE_MESSAGE_SIZE
+SSL,151,EXTRA_DATA_IN_MESSAGE
+SSL,152,FRAGMENT_MISMATCH
+SSL,153,GOT_NEXT_PROTO_WITHOUT_EXTENSION
+SSL,154,HANDSHAKE_FAILURE_ON_CLIENT_HELLO
+SSL,155,HTTPS_PROXY_REQUEST
+SSL,156,HTTP_REQUEST
+SSL,157,INAPPROPRIATE_FALLBACK
+SSL,259,INVALID_ALPN_PROTOCOL
+SSL,158,INVALID_COMMAND
+SSL,256,INVALID_COMPRESSION_LIST
+SSL,159,INVALID_MESSAGE
+SSL,251,INVALID_OUTER_RECORD_TYPE
+SSL,269,INVALID_SCT_LIST
+SSL,160,INVALID_SSL_SESSION
+SSL,161,INVALID_TICKET_KEYS_LENGTH
+SSL,162,LENGTH_MISMATCH
+SSL,164,MISSING_EXTENSION
+SSL,258,MISSING_KEY_SHARE
+SSL,165,MISSING_RSA_CERTIFICATE
+SSL,166,MISSING_TMP_DH_KEY
+SSL,167,MISSING_TMP_ECDH_KEY
+SSL,168,MIXED_SPECIAL_OPERATOR_WITH_GROUPS
+SSL,169,MTU_TOO_SMALL
+SSL,170,NEGOTIATED_BOTH_NPN_AND_ALPN
+SSL,171,NESTED_GROUP
+SSL,172,NO_CERTIFICATES_RETURNED
+SSL,173,NO_CERTIFICATE_ASSIGNED
+SSL,174,NO_CERTIFICATE_SET
+SSL,175,NO_CIPHERS_AVAILABLE
+SSL,176,NO_CIPHERS_PASSED
+SSL,262,NO_CIPHERS_SPECIFIED
+SSL,177,NO_CIPHER_MATCH
+SSL,253,NO_COMMON_SIGNATURE_ALGORITHMS
+SSL,178,NO_COMPRESSION_SPECIFIED
+SSL,265,NO_GROUPS_SPECIFIED
+SSL,179,NO_METHOD_SPECIFIED
+SSL,180,NO_P256_SUPPORT
+SSL,181,NO_PRIVATE_KEY_ASSIGNED
+SSL,182,NO_RENEGOTIATION
+SSL,183,NO_REQUIRED_DIGEST
+SSL,184,NO_SHARED_CIPHER
+SSL,266,NO_SHARED_GROUP
+SSL,185,NULL_SSL_CTX
+SSL,186,NULL_SSL_METHOD_PASSED
+SSL,187,OLD_SESSION_CIPHER_NOT_RETURNED
+SSL,268,OLD_SESSION_PRF_HASH_MISMATCH
+SSL,188,OLD_SESSION_VERSION_NOT_RETURNED
+SSL,189,OUTPUT_ALIASES_INPUT
+SSL,190,PARSE_TLSEXT
+SSL,191,PATH_TOO_LONG
+SSL,192,PEER_DID_NOT_RETURN_A_CERTIFICATE
+SSL,193,PEER_ERROR_UNSUPPORTED_CERTIFICATE_TYPE
+SSL,267,PRE_SHARED_KEY_MUST_BE_LAST
+SSL,194,PROTOCOL_IS_SHUTDOWN
+SSL,271,PSK_IDENTITY_BINDER_COUNT_MISMATCH
+SSL,195,PSK_IDENTITY_NOT_FOUND
+SSL,196,PSK_NO_CLIENT_CB
+SSL,197,PSK_NO_SERVER_CB
+SSL,198,READ_TIMEOUT_EXPIRED
+SSL,199,RECORD_LENGTH_MISMATCH
+SSL,200,RECORD_TOO_LARGE
+SSL,263,RENEGOTIATION_EMS_MISMATCH
+SSL,201,RENEGOTIATION_ENCODING_ERR
+SSL,202,RENEGOTIATION_MISMATCH
+SSL,203,REQUIRED_CIPHER_MISSING
+SSL,204,RESUMED_EMS_SESSION_WITHOUT_EMS_EXTENSION
+SSL,205,RESUMED_NON_EMS_SESSION_WITH_EMS_EXTENSION
+SSL,206,SCSV_RECEIVED_WHEN_RENEGOTIATING
+SSL,207,SERVERHELLO_TLSEXT
+SSL,273,SERVER_CERT_CHANGED
+SSL,208,SESSION_ID_CONTEXT_UNINITIALIZED
+SSL,209,SESSION_MAY_NOT_BE_CREATED
+SSL,250,SHUTDOWN_WHILE_IN_INIT
+SSL,210,SIGNATURE_ALGORITHMS_EXTENSION_SENT_BY_SERVER
+SSL,211,SRTP_COULD_NOT_ALLOCATE_PROFILES
+SSL,212,SRTP_UNKNOWN_PROTECTION_PROFILE
+SSL,213,SSL3_EXT_INVALID_SERVERNAME
+SSL,1042,SSLV3_ALERT_BAD_CERTIFICATE
+SSL,1020,SSLV3_ALERT_BAD_RECORD_MAC
+SSL,1045,SSLV3_ALERT_CERTIFICATE_EXPIRED
+SSL,1044,SSLV3_ALERT_CERTIFICATE_REVOKED
+SSL,1046,SSLV3_ALERT_CERTIFICATE_UNKNOWN
+SSL,1000,SSLV3_ALERT_CLOSE_NOTIFY
+SSL,1030,SSLV3_ALERT_DECOMPRESSION_FAILURE
+SSL,1040,SSLV3_ALERT_HANDSHAKE_FAILURE
+SSL,1047,SSLV3_ALERT_ILLEGAL_PARAMETER
+SSL,1041,SSLV3_ALERT_NO_CERTIFICATE
+SSL,1010,SSLV3_ALERT_UNEXPECTED_MESSAGE
+SSL,1043,SSLV3_ALERT_UNSUPPORTED_CERTIFICATE
+SSL,214,SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION
+SSL,215,SSL_HANDSHAKE_FAILURE
+SSL,216,SSL_SESSION_ID_CONTEXT_TOO_LONG
+SSL,276,TICKET_ENCRYPTION_FAILED
+SSL,1049,TLSV1_ALERT_ACCESS_DENIED
+SSL,1050,TLSV1_ALERT_DECODE_ERROR
+SSL,1021,TLSV1_ALERT_DECRYPTION_FAILED
+SSL,1051,TLSV1_ALERT_DECRYPT_ERROR
+SSL,1060,TLSV1_ALERT_EXPORT_RESTRICTION
+SSL,1086,TLSV1_ALERT_INAPPROPRIATE_FALLBACK
+SSL,1071,TLSV1_ALERT_INSUFFICIENT_SECURITY
+SSL,1080,TLSV1_ALERT_INTERNAL_ERROR
+SSL,1100,TLSV1_ALERT_NO_RENEGOTIATION
+SSL,1070,TLSV1_ALERT_PROTOCOL_VERSION
+SSL,1022,TLSV1_ALERT_RECORD_OVERFLOW
+SSL,1048,TLSV1_ALERT_UNKNOWN_CA
+SSL,1090,TLSV1_ALERT_USER_CANCELLED
+SSL,1114,TLSV1_BAD_CERTIFICATE_HASH_VALUE
+SSL,1113,TLSV1_BAD_CERTIFICATE_STATUS_RESPONSE
+SSL,1116,TLSV1_CERTIFICATE_REQUIRED
+SSL,1111,TLSV1_CERTIFICATE_UNOBTAINABLE
+SSL,1115,TLSV1_UNKNOWN_PSK_IDENTITY
+SSL,1112,TLSV1_UNRECOGNIZED_NAME
+SSL,1110,TLSV1_UNSUPPORTED_EXTENSION
+SSL,217,TLS_PEER_DID_NOT_RESPOND_WITH_CERTIFICATE_LIST
+SSL,218,TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG
+SSL,219,TOO_MANY_EMPTY_FRAGMENTS
+SSL,260,TOO_MANY_KEY_UPDATES
+SSL,220,TOO_MANY_WARNING_ALERTS
+SSL,270,TOO_MUCH_SKIPPED_EARLY_DATA
+SSL,221,UNABLE_TO_FIND_ECDH_PARAMETERS
+SSL,222,UNEXPECTED_EXTENSION
+SSL,223,UNEXPECTED_MESSAGE
+SSL,224,UNEXPECTED_OPERATOR_IN_GROUP
+SSL,225,UNEXPECTED_RECORD
+SSL,226,UNINITIALIZED
+SSL,227,UNKNOWN_ALERT_TYPE
+SSL,228,UNKNOWN_CERTIFICATE_TYPE
+SSL,229,UNKNOWN_CIPHER_RETURNED
+SSL,230,UNKNOWN_CIPHER_TYPE
+SSL,231,UNKNOWN_DIGEST
+SSL,232,UNKNOWN_KEY_EXCHANGE_TYPE
+SSL,233,UNKNOWN_PROTOCOL
+SSL,234,UNKNOWN_SSL_VERSION
+SSL,235,UNKNOWN_STATE
+SSL,236,UNSAFE_LEGACY_RENEGOTIATION_DISABLED
+SSL,237,UNSUPPORTED_CIPHER
+SSL,238,UNSUPPORTED_COMPRESSION_ALGORITHM
+SSL,239,UNSUPPORTED_ELLIPTIC_CURVE
+SSL,240,UNSUPPORTED_PROTOCOL
+SSL,252,UNSUPPORTED_PROTOCOL_FOR_CUSTOM_KEY
+SSL,241,WRONG_CERTIFICATE_TYPE
+SSL,242,WRONG_CIPHER_RETURNED
+SSL,243,WRONG_CURVE
+SSL,244,WRONG_MESSAGE_TYPE
+SSL,245,WRONG_SIGNATURE_TYPE
+SSL,246,WRONG_SSL_VERSION
+SSL,247,WRONG_VERSION_NUMBER
+SSL,248,X509_LIB
+SSL,249,X509_VERIFICATION_SETUP_PROBLEMS
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/x509.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/x509.errordata
new file mode 100644
index 000000000..5687c30c9
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/x509.errordata
@@ -0,0 +1,36 @@
+X509,100,AKID_MISMATCH
+X509,101,BAD_PKCS7_VERSION
+X509,102,BAD_X509_FILETYPE
+X509,103,BASE64_DECODE_ERROR
+X509,104,CANT_CHECK_DH_KEY
+X509,105,CERT_ALREADY_IN_HASH_TABLE
+X509,106,CRL_ALREADY_DELTA
+X509,107,CRL_VERIFY_FAILURE
+X509,108,IDP_MISMATCH
+X509,109,INVALID_BIT_STRING_BITS_LEFT
+X509,110,INVALID_DIRECTORY
+X509,111,INVALID_FIELD_NAME
+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,135,NAME_TOO_LONG
+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
diff --git a/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/x509v3.errordata b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/x509v3.errordata
new file mode 100644
index 000000000..e53b7800a
--- /dev/null
+++ b/roms/edk2/CryptoPkg/Library/OpensslLib/openssl/boringssl/crypto/err/x509v3.errordata
@@ -0,0 +1,63 @@
+X509V3,100,BAD_IP_ADDRESS
+X509V3,101,BAD_OBJECT
+X509V3,102,BN_DEC2BN_ERROR
+X509V3,103,BN_TO_ASN1_INTEGER_ERROR
+X509V3,104,CANNOT_FIND_FREE_FUNCTION
+X509V3,105,DIRNAME_ERROR
+X509V3,106,DISTPOINT_ALREADY_SET
+X509V3,107,DUPLICATE_ZONE_ID
+X509V3,108,ERROR_CONVERTING_ZONE
+X509V3,109,ERROR_CREATING_EXTENSION
+X509V3,110,ERROR_IN_EXTENSION
+X509V3,111,EXPECTED_A_SECTION_NAME
+X509V3,112,EXTENSION_EXISTS
+X509V3,113,EXTENSION_NAME_ERROR
+X509V3,114,EXTENSION_NOT_FOUND
+X509V3,115,EXTENSION_SETTING_NOT_SUPPORTED
+X509V3,116,EXTENSION_VALUE_ERROR
+X509V3,117,ILLEGAL_EMPTY_EXTENSION
+X509V3,118,ILLEGAL_HEX_DIGIT
+X509V3,119,INCORRECT_POLICY_SYNTAX_TAG
+X509V3,120,INVALID_BOOLEAN_STRING
+X509V3,121,INVALID_EXTENSION_STRING
+X509V3,122,INVALID_MULTIPLE_RDNS
+X509V3,123,INVALID_NAME
+X509V3,124,INVALID_NULL_ARGUMENT
+X509V3,125,INVALID_NULL_NAME
+X509V3,126,INVALID_NULL_VALUE
+X509V3,127,INVALID_NUMBER
+X509V3,128,INVALID_NUMBERS
+X509V3,129,INVALID_OBJECT_IDENTIFIER
+X509V3,130,INVALID_OPTION
+X509V3,131,INVALID_POLICY_IDENTIFIER
+X509V3,132,INVALID_PROXY_POLICY_SETTING
+X509V3,133,INVALID_PURPOSE
+X509V3,134,INVALID_SECTION
+X509V3,135,INVALID_SYNTAX
+X509V3,136,ISSUER_DECODE_ERROR
+X509V3,137,MISSING_VALUE
+X509V3,138,NEED_ORGANIZATION_AND_NUMBERS
+X509V3,139,NO_CONFIG_DATABASE
+X509V3,140,NO_ISSUER_CERTIFICATE
+X509V3,141,NO_ISSUER_DETAILS
+X509V3,142,NO_POLICY_IDENTIFIER
+X509V3,143,NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED
+X509V3,144,NO_PUBLIC_KEY
+X509V3,145,NO_SUBJECT_DETAILS
+X509V3,146,ODD_NUMBER_OF_DIGITS
+X509V3,147,OPERATION_NOT_DEFINED
+X509V3,148,OTHERNAME_ERROR
+X509V3,149,POLICY_LANGUAGE_ALREADY_DEFINED
+X509V3,150,POLICY_PATH_LENGTH
+X509V3,151,POLICY_PATH_LENGTH_ALREADY_DEFINED
+X509V3,152,POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY
+X509V3,153,SECTION_NOT_FOUND
+X509V3,154,UNABLE_TO_GET_ISSUER_DETAILS
+X509V3,155,UNABLE_TO_GET_ISSUER_KEYID
+X509V3,156,UNKNOWN_BIT_STRING_ARGUMENT
+X509V3,157,UNKNOWN_EXTENSION
+X509V3,158,UNKNOWN_EXTENSION_NAME
+X509V3,159,UNKNOWN_OPTION
+X509V3,160,UNSUPPORTED_OPTION
+X509V3,161,UNSUPPORTED_TYPE
+X509V3,162,USER_TOO_LONG