Merge of http://go/wvgerrit/93404 This CL updates the Widevine CDM to support OEMCrypto v16.1 Test: Tested in 16.2 CL Bug: 141247171 Change-Id: I69bd993500f6fb63bf6010c8b0250dc7acc3d71b
37 lines
690 B
C
37 lines
690 B
C
/* 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 <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
int odk_sub_overflow_u64(uint64_t a, uint64_t b, uint64_t* c) {
|
|
if (a >= b) {
|
|
if (c) {
|
|
*c = a - b;
|
|
}
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
int odk_add_overflow_u64(uint64_t a, uint64_t b, uint64_t* c) {
|
|
if (UINT64_MAX - a >= b) {
|
|
if (c) {
|
|
*c = a + b;
|
|
}
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
int odk_add_overflow_ux(size_t a, size_t b, size_t* c) {
|
|
if (SIZE_MAX - a >= b) {
|
|
if (c) {
|
|
*c = a + b;
|
|
}
|
|
return 0;
|
|
}
|
|
return 1;
|
|
}
|