Haystack and Obfuscated OEMCrypto Level 3

This CL contains working versions of the haystack tools and the
OEMCrypto Level 3 library for android ARM, MIPS and x86.

The version number of the level 3 library is:
android/level3/arm/libwvlevel3.a  Level3 Library Nov  4 2013 18:39:06
android/level3/mips/libwvlevel3.a Level3 Library Nov  4 2013 18:42:29
android/level3/x86/libwvlevel3.a  Level3 Library Nov  4 2013 18:41:07

bug: 9374954 MediaDrm haystack based L3 code hardening implementation.
Change-Id: Ifef13900a11e83e4257723d3c6fc7107550882a8
This commit is contained in:
Fred Gylys-Colwell
2013-10-30 11:55:30 -07:00
parent 49e593d127
commit becb1bf0be
10 changed files with 51 additions and 33 deletions

View File

@@ -36,7 +36,7 @@ void ctr128_inc(uint8_t* counter) {
uint32_t n = 16;
do {
if (++counter[--n] != 0) return;
} while (n);
} while (n>8);
}
void dump_openssl_error() {
while (unsigned long err = ERR_get_error()) {

View File

@@ -240,7 +240,7 @@ OEMCryptoResult OEMCrypto_GenerateSignature(
}
return OEMCrypto_SUCCESS;
}
return OEMCrypto_ERROR_UNKNOWN_FAILURE;;
return OEMCrypto_ERROR_UNKNOWN_FAILURE;
}
bool RangeCheck(const uint8_t* message,

View File

@@ -6,11 +6,12 @@
* Compte CRC32 Checksum. Needed for verification of WV Keybox.
*********************************************************************/
#include <arpa/inet.h>
#include "wvcrc32.h"
#define INIT_CRC32 0xffffffff
uint32_t wvrunningcrc32(uint8_t* p_begin, int i_count, uint32_t i_crc) {
uint32_t wvrunningcrc32(const uint8_t* p_begin, int i_count, uint32_t i_crc) {
static uint32_t CRC32[256] = {
0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9,
0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005,
@@ -88,6 +89,10 @@ uint32_t wvrunningcrc32(uint8_t* p_begin, int i_count, uint32_t i_crc) {
return(i_crc);
}
uint32_t wvcrc32(uint8_t* p_begin, int i_count) {
uint32_t wvcrc32(const uint8_t* p_begin, int i_count) {
return(wvrunningcrc32(p_begin, i_count, INIT_CRC32));
}
uint32_t wvcrc32n(const uint8_t* p_begin, int i_count) {
return htonl(wvrunningcrc32(p_begin, i_count, INIT_CRC32));
}

View File

@@ -11,6 +11,8 @@
#include <stdint.h>
uint32_t wvcrc32(uint8_t* p_begin, int i_count);
uint32_t wvcrc32(const uint8_t* p_begin, int i_count);
uint32_t wvcrc32n(const uint8_t* p_begin, int i_count); // Convert to network byte
// order.
#endif // WV_CRC_32_H_