For context, see cl/578224540
This CL is produced via
- Do the removal
- `$ /google/src/head/depot/google3/devtools/scripts/csearch_apply --includefile 'video/widevine/export/common/oemcrypto_core_message/' --search='Copyright \d{4} Google LLC. All rights reserved.' --apply='s,\ All rights reserved\.,,g'`
- Manually deleted a few periods. I.e., for cases where the comment is ONLY "Copyright <year> Google LLC.", I removed the period at the end.
PiperOrigin-RevId: 580020267
Change-Id: I4b2f647d6e3bbb34868e1822591bc953a94cca42
34 lines
819 B
C
34 lines
819 B
C
// Copyright 2019 Google LLC. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine
|
|
// 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 = (const uint8_t*)in_a;
|
|
const uint8_t* b = (const uint8_t*)in_b;
|
|
uint8_t x = 0;
|
|
|
|
for (size_t i = 0; i < len; i++) {
|
|
x |= a[i] ^ b[i];
|
|
}
|
|
return x;
|
|
}
|
|
|
|
bool ODK_NonceValuesEqualExcludingVersion(const ODK_NonceValues* a,
|
|
const ODK_NonceValues* b) {
|
|
if (a == NULL || b == NULL) {
|
|
return (a == b);
|
|
}
|
|
return (a->nonce == b->nonce && a->session_id == b->session_id);
|
|
}
|