Level 3: Throw out keybox with wrong system id *DO NOT MERGE*

This CL modifies the haystack code to throw out the keybox if the
system id is wrong.  This should help prevent b/33344450 from
persisting.

Part of this code change was to backport some updates to the haystack
tools on master.

arm/libwvlevel3.a  Level3 Library 4445 Dec  6 2016 16:58:47
x86/libwvlevel3.a  Level3 Library 4464 Dec  6 2016 17:06:21
mips/libwvlevel3.a  Level3 Library 4465 Dec  7 2016 13:36:32

b/33556871

Change-Id: I8dadf4bc7981af6afb970533df61d34b80d133a7
This commit is contained in:
Fred Gylys-Colwell
2016-12-08 20:59:58 -08:00
parent dab8aab4a8
commit 7e7ef2bb58
4 changed files with 3 additions and 2 deletions

View File

@@ -245,7 +245,7 @@ struct FunctionPointers {
// The Cache Flush function is very processor dependent, but is needed by the
// haystack code. The haystack code is delivered as a static prebuilt library.
// For that reason, we pass a function pointer for cache_flush into the
// haystack. The function is combiled outside of the haystack and may use
// haystack. The function is compiled outside of the haystack and may use
// target (processor) specific compiler flags.
void clear_cache_function(void *page, size_t len) {
@@ -309,7 +309,7 @@ struct LevelSession {
level1_.Name = (L1_##Name##_t)dlsym(level1_library_, QUOTE(Function)); \
if (!level1_.Name) { \
LOGW("Could not load L1 %s. Falling Back to L3.", \
QUOTE(OEMCrypto_##Name)); \
QUOTE(Function)); \
return false; \
}
@@ -350,6 +350,7 @@ class Adapter {
if (LoadLevel1()) {
LOGD("OEMCrypto_Initialize Level 1 success. I will use level 1.");
} else {
level1_ = FunctionPointers(); // revert to all null pointers.
dlclose(level1_library_);
level1_library_ = NULL;
level1_valid_ = false;