diff options
author | Kenny Root <kroot@google.com> | 2015-09-25 00:26:37 +0000 |
---|---|---|
committer | Kenny Root <kroot@google.com> | 2015-09-25 00:26:37 +0000 |
commit | a04d78d392463df4e69a64360c952ffa5abd22f7 (patch) | |
tree | dc62c249d595198e0d99e43890019d21e901fbec /src/crypto/err/err_data_generate.go | |
parent | 1e4884f615b20946411a74e41eb9c6aa65e2d5f3 (diff) | |
download | external_boringssl-a04d78d392463df4e69a64360c952ffa5abd22f7.zip external_boringssl-a04d78d392463df4e69a64360c952ffa5abd22f7.tar.gz external_boringssl-a04d78d392463df4e69a64360c952ffa5abd22f7.tar.bz2 |
Revert "external/boringssl: sync with upstream."
This reverts commit 1e4884f615b20946411a74e41eb9c6aa65e2d5f3.
This breaks some x86 builds.
Change-Id: I4d4310663ce52bc0a130e6b9dbc22b868ff4fb25
Diffstat (limited to 'src/crypto/err/err_data_generate.go')
-rw-r--r-- | src/crypto/err/err_data_generate.go | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/crypto/err/err_data_generate.go b/src/crypto/err/err_data_generate.go index 24e0d66..a5b4cb5 100644 --- a/src/crypto/err/err_data_generate.go +++ b/src/crypto/err/err_data_generate.go @@ -59,8 +59,8 @@ var libraryNames = []string{ "HMAC", "DIGEST", "CIPHER", - "HKDF", "USER", + "HKDF", } // stringList is a map from uint32 -> string which can output data for a sorted @@ -69,7 +69,7 @@ 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 + 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|. @@ -146,7 +146,7 @@ func (st *stringList) WriteTo(out stringWriter, name string) { 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") + out.WriteString("const size_t " + values + "Len = sizeof(" + values + ") / sizeof(" + values + "[0]);\n\n"); stringData := "kOpenSSL" + name + "StringData" out.WriteString("const char " + stringData + "[] =\n \"") @@ -161,8 +161,8 @@ func (st *stringList) WriteTo(out stringWriter, name string) { } type errorData struct { - reasons *stringList - libraryMap map[string]uint32 + functions, reasons *stringList + libraryMap map[string]uint32 } func (e *errorData) readErrorDataFile(filename string) error { @@ -184,8 +184,8 @@ func (e *errorData) readErrorDataFile(filename string) error { 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)) + if len(parts) != 4 { + return fmt.Errorf("bad line %d in %s: found %d values but want 4", lineNo, filename, len(parts)) } libNum, ok := e.libraryMap[string(parts[0])] if !ok { @@ -194,18 +194,26 @@ func (e *errorData) readErrorDataFile(filename string) error { 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 */) + key, err := strconv.ParseUint(string(parts[2]), 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]) + value := string(parts[3]) listKey := libNum<<26 | uint32(key)<<15 - err = e.reasons.Add(listKey, value) + switch string(parts[1]) { + case "function": + err = e.functions.Add(listKey, value) + case "reason": + err = e.reasons.Add(listKey, value) + default: + return fmt.Errorf("bad line %d in %s: bad value type", lineNo, filename) + } + if err != nil { return err } @@ -216,6 +224,7 @@ func (e *errorData) readErrorDataFile(filename string) error { func main() { e := &errorData{ + functions: newStringList(), reasons: newStringList(), libraryMap: make(map[string]uint32), } @@ -270,8 +279,9 @@ func main() { 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) + fmt.Fprintf(out, "OPENSSL_COMPILE_ASSERT(ERR_NUM_LIBS == %d, library_values_changed_num);\n", len(libraryNames) + 1) out.WriteString("\n") + e.functions.WriteTo(out, "Function") e.reasons.WriteTo(out, "Reason") } |