OEMCrypto v11 Refrence Code and Unit Tests

This CL is a merge from the widevine repo of
http://go/wvgerrit/16553 Prebuilt Level 3 OEMCrypto for Android
http://go/wvgerrit/16238 Require OEMCrypto v11 for Android N Unit Tests
http://go/wvgerrit/16484 Shared License Tests (OEMCrypto v11)
http://go/wvgerrit/16448 Pattern Decrypt Unit Tests and Reference Implementation
http://go/wvgerrit/16489 Enforce UNUSED Variables
http://go/wvgerrit/16479 Pattern Decrypt for Level 3 OEMCrypto
http://go/wvgerrit/16280 Correctly handle bad RSA key
http://go/wvgerrit/16315 Security Patch Level - haystack version
http://go/wvgerrit/16282 Correctly handle null pointer in GetKeyData
http://go/wvgerrit/16294 Initialize data for generation number

It contains the Level 3 implementation, as well.
mips/libwvlevel3.a  Level3 Library Jan 22 2016 14:30:27
arm/libwvlevel3.a  Level3 Library Jan 22 2016 15:03:55
x86/libwvlevel3.a  Level3 Library Jan 22 2016 13:52:29

b/26692954 [DRM] OEMCrypto v11 needed for Nexus devices

Change-Id: Ibb1384959620f63a1be1e82ce2952ec9f48f0d3e
This commit is contained in:
Fred Gylys-Colwell
2016-01-22 15:30:42 -08:00
parent 2c39fce2c8
commit e6aa70410b
13 changed files with 779 additions and 489 deletions

View File

@@ -4,19 +4,19 @@
//
#include "OEMCryptoCENC.h"
#include <stddef.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include <iostream>
#include <string>
#include <vector>
#include <openssl/cmac.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/rand.h>
#include <openssl/sha.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <iostream>
#include <string>
#include <vector>
#include "log.h"
#include "oemcrypto_engine_mock.h"
#include "oemcrypto_logging.h"
@@ -382,12 +382,7 @@ OEMCryptoResult OEMCrypto_LoadKeys(OEMCrypto_SESSION session,
LOGE("[OEMCrypto_LoadKeys(): OEMCrypto_ERROR_INVALID_CONTEXT -range check %d]", i);
return OEMCrypto_ERROR_INVALID_CONTEXT;
}
if (key_array[i].cipher_mode != OEMCrypto_CipherMode_CTR) {
LOGE("[OEMCrypto_LoadKeys(): CBC Mode not yet implemented]");
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
}
}
return session_ctx->LoadKeys(message, message_length, signature,
signature_length, enc_mac_key_iv, enc_mac_keys,
num_keys, key_array, pst, pst_length);
@@ -643,9 +638,10 @@ OEMCryptoResult OEMCrypto_DecryptCENC(OEMCrypto_SESSION session,
return OEMCrypto_ERROR_INVALID_SESSION;
}
return session_ctx->DecryptCTR(iv, block_offset, data_addr, data_length,
is_encrypted, destination,
out_buffer->type);
return session_ctx->DecryptCENC(iv, block_offset, pattern,
data_addr, data_length,
is_encrypted, destination,
out_buffer->type);
}
extern "C"