OEMCrypto v16.2
Merge from Widevine repo of http://go/wvgerrit/93404 This is the unit tests, reference code, and documentation for OEMCrypto v16.2. Backwards compatibility should work for a v15 OEMCrypto. Some review comments will be addressed in future CLs. Bug: 141247171 Test: Unit tests Test: Media GTS tests on bonito Change-Id: I9d427c07580e180c0a4cfdc4a68f538d351c0ddd
This commit is contained in:
25
libwvdrmengine/oemcrypto/odk/src/odk_util.c
Normal file
25
libwvdrmengine/oemcrypto/odk/src/odk_util.c
Normal file
@@ -0,0 +1,25 @@
|
||||
/* Copyright 2019 Google LLC. All rights reserved. This file and proprietary */
|
||||
/* source code may only be used and distributed under the Widevine Master */
|
||||
/* License Agreement. */
|
||||
|
||||
#include "odk_util.h"
|
||||
|
||||
int crypto_memcmp(const void* in_a, const void* in_b, size_t len) {
|
||||
if (len == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Only valid pointers are allowed. */
|
||||
if (in_a == NULL || in_b == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
const uint8_t* a = in_a;
|
||||
const uint8_t* b = in_b;
|
||||
uint8_t x = 0;
|
||||
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
x |= a[i] ^ b[i];
|
||||
}
|
||||
return x;
|
||||
}
|
||||
Reference in New Issue
Block a user