You've already forked linux-packaging-mono
Imported Upstream version 4.8.0.309
Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
parent
ee1447783b
commit
94b2861243
52
external/boringssl/crypto/err/CMakeLists.txt
vendored
Normal file
52
external/boringssl/crypto/err/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
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
|
||||
)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_executable(
|
||||
err_test
|
||||
|
||||
err_test.cc
|
||||
|
||||
$<TARGET_OBJECTS:test_support>
|
||||
)
|
||||
|
||||
target_link_libraries(err_test crypto)
|
||||
add_dependencies(all_tests err_test)
|
||||
endif()
|
||||
92
external/boringssl/crypto/err/asn1.errordata
vendored
Normal file
92
external/boringssl/crypto/err/asn1.errordata
vendored
Normal file
@@ -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
|
||||
17
external/boringssl/crypto/err/bio.errordata
vendored
Normal file
17
external/boringssl/crypto/err/bio.errordata
vendored
Normal file
@@ -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
|
||||
19
external/boringssl/crypto/err/bn.errordata
vendored
Normal file
19
external/boringssl/crypto/err/bn.errordata
vendored
Normal file
@@ -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
|
||||
25
external/boringssl/crypto/err/cipher.errordata
vendored
Normal file
25
external/boringssl/crypto/err/cipher.errordata
vendored
Normal file
@@ -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
|
||||
6
external/boringssl/crypto/err/conf.errordata
vendored
Normal file
6
external/boringssl/crypto/err/conf.errordata
vendored
Normal file
@@ -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
|
||||
6
external/boringssl/crypto/err/dh.errordata
vendored
Normal file
6
external/boringssl/crypto/err/dh.errordata
vendored
Normal file
@@ -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
|
||||
1
external/boringssl/crypto/err/digest.errordata
vendored
Normal file
1
external/boringssl/crypto/err/digest.errordata
vendored
Normal file
@@ -0,0 +1 @@
|
||||
DIGEST,100,INPUT_NOT_INITIALIZED
|
||||
7
external/boringssl/crypto/err/dsa.errordata
vendored
Normal file
7
external/boringssl/crypto/err/dsa.errordata
vendored
Normal file
@@ -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
|
||||
31
external/boringssl/crypto/err/ec.errordata
vendored
Normal file
31
external/boringssl/crypto/err/ec.errordata
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
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,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
|
||||
3
external/boringssl/crypto/err/ecdh.errordata
vendored
Normal file
3
external/boringssl/crypto/err/ecdh.errordata
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
ECDH,100,KDF_FAILED
|
||||
ECDH,101,NO_PRIVATE_VALUE
|
||||
ECDH,102,POINT_ARITHMETIC_FAILURE
|
||||
6
external/boringssl/crypto/err/ecdsa.errordata
vendored
Normal file
6
external/boringssl/crypto/err/ecdsa.errordata
vendored
Normal file
@@ -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
|
||||
1
external/boringssl/crypto/err/engine.errordata
vendored
Normal file
1
external/boringssl/crypto/err/engine.errordata
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ENGINE,100,OPERATION_NOT_SUPPORTED
|
||||
756
external/boringssl/crypto/err/err.c
vendored
Normal file
756
external/boringssl/crypto/err/err.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1258
external/boringssl/crypto/err/err_data.c
vendored
Normal file
1258
external/boringssl/crypto/err/err_data.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
284
external/boringssl/crypto/err/err_data_generate.go
vendored
Normal file
284
external/boringssl/crypto/err/err_data_generate.go
vendored
Normal file
@@ -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")
|
||||
}
|
||||
162
external/boringssl/crypto/err/err_test.cc
vendored
Normal file
162
external/boringssl/crypto/err/err_test.cc
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
/* 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 <openssl/crypto.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/mem.h>
|
||||
|
||||
|
||||
static bool TestOverflow() {
|
||||
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++) {
|
||||
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. */
|
||||
if (err == 0 || ((unsigned)ERR_GET_REASON(err)) != i + ERR_NUM_ERRORS + 2) {
|
||||
fprintf(stderr, "ERR_get_error failed at %u\n", i);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (ERR_get_error() != 0) {
|
||||
fprintf(stderr, "ERR_get_error more than the expected number of values.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool TestPutError() {
|
||||
if (ERR_get_error() != 0) {
|
||||
fprintf(stderr, "ERR_get_error returned value before an error was added.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (peeked_packed_error != packed_error ||
|
||||
peeked_file != file ||
|
||||
peeked_data != data ||
|
||||
peeked_flags != flags) {
|
||||
fprintf(stderr, "Bad peeked error data returned.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strcmp(file, "test") != 0 ||
|
||||
line != 4 ||
|
||||
(flags & ERR_FLAG_STRING) == 0 ||
|
||||
ERR_GET_LIB(packed_error) != 1 ||
|
||||
ERR_GET_REASON(packed_error) != 2 ||
|
||||
strcmp(data, "testing") != 0) {
|
||||
fprintf(stderr, "Bad error data returned.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool TestClearError() {
|
||||
if (ERR_get_error() != 0) {
|
||||
fprintf(stderr, "ERR_get_error returned value before an error was added.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
ERR_put_error(1, 0 /* unused */, 2, "test", 4);
|
||||
ERR_clear_error();
|
||||
|
||||
if (ERR_get_error() != 0) {
|
||||
fprintf(stderr, "Error remained after clearing.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool TestPrint() {
|
||||
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);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool TestRelease() {
|
||||
ERR_put_error(1, 0 /* unused */, 2, "test", 4);
|
||||
ERR_remove_thread_state(NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
static bool TestPutMacro() {
|
||||
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);
|
||||
|
||||
if (!HasSuffix(file, "err_test.cc") ||
|
||||
line != expected_line ||
|
||||
ERR_GET_LIB(error) != ERR_LIB_USER ||
|
||||
ERR_GET_REASON(error) != ERR_R_INTERNAL_ERROR) {
|
||||
fprintf(stderr, "Bad error data returned.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main() {
|
||||
CRYPTO_library_init();
|
||||
|
||||
if (!TestOverflow() ||
|
||||
!TestPutError() ||
|
||||
!TestClearError() ||
|
||||
!TestPrint() ||
|
||||
!TestRelease() ||
|
||||
!TestPutMacro()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("PASS\n");
|
||||
return 0;
|
||||
}
|
||||
30
external/boringssl/crypto/err/evp.errordata
vendored
Normal file
30
external/boringssl/crypto/err/evp.errordata
vendored
Normal file
@@ -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
|
||||
1
external/boringssl/crypto/err/hkdf.errordata
vendored
Normal file
1
external/boringssl/crypto/err/hkdf.errordata
vendored
Normal file
@@ -0,0 +1 @@
|
||||
HKDF,100,OUTPUT_TOO_LARGE
|
||||
1
external/boringssl/crypto/err/obj.errordata
vendored
Normal file
1
external/boringssl/crypto/err/obj.errordata
vendored
Normal file
@@ -0,0 +1 @@
|
||||
OBJ,100,UNKNOWN_NID
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user