Detect any reference to OPENSSL_ia32cap_P.

Some assembly code references “OPENSSL_ia32cap_P+4(%rip)” etc, which
slipped by the previous check.

Change-Id: I22c3fbf9883aea695e8584857bf9c0e3113f9a77
Reviewed-on: https://boringssl-review.googlesource.com/15024
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
Adam Langley 2017-04-13 11:06:14 -07:00 committed by CQ bot account: commit-bot@chromium.org
parent b15143fece
commit d7bc3353f0

View File

@ -114,6 +114,16 @@ func definedSymbols(lines []string) map[string]bool {
return symbols
}
func referencesIA32CapDirectly(line string) bool {
const symbol = "OPENSSL_ia32cap_P"
i := strings.Index(line, symbol)
if i < 0 {
return false
}
i += len(symbol)
return i == len(line) || line[i] == '+' || line[i] == '('
}
// transform performs a number of transformations on the given assembly code.
// See FIPS.md in the current directory for an overview.
func transform(lines []string, symbols map[string]bool) (ret []string) {
@ -138,7 +148,7 @@ func transform(lines []string, symbols map[string]bool) (ret []string) {
var bssAccessorsNeeded []string
for lineNo, line := range lines {
if strings.Contains(line, "OPENSSL_ia32cap_P(%rip)") {
if referencesIA32CapDirectly(line) {
panic("reference to OPENSSL_ia32cap_P needs to be changed to indirect via OPENSSL_ia32cap_addr")
}