This is the initial code drop of the reference implementation and test cases for the Widevine Whitebox API. In this drop, the full reference implementation for the AEAD white-box is provided and all test cases verifying the top-level behave have are enabled. Since the implementations can vary so much the testing is mostly left to verifying the return codes for specific parameter conditions. A full reference implementation for the license white-box is provided, however not all tests are implemented or enabled. A number of tests have been disabled as they required a loaded license and test licenses are still being worked on. The two license white-box API functions that are the further from competition are ProcessLicenseResponse() and MaskedDecryt(). ProcessLicenseResponse() is still being worked on and MaskedDecrypt() is waiting on Decrypt() to be fully functional. Most tests focus on verifying return code for specific parameter conditions, but as test licenses are created, tests looking to test the internal behaviour of license management will be added to ProcessLicenseResponse(), Decrypt(), and MaskedDecrypt().
56 lines
1.6 KiB
C
56 lines
1.6 KiB
C
// Copyright 2020 Google LLC. All Rights Reserved.
|
|
|
|
#ifndef WHITEBOX_API_RESULT_H_
|
|
#define WHITEBOX_API_RESULT_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// Error codes returned by all the white-box API functions. See the function
|
|
// returning the result for additional details.
|
|
typedef enum {
|
|
// The operation completed successfully.
|
|
WB_RESULT_OK = 0,
|
|
|
|
// The operation failed because memory could not be allocated.
|
|
WB_RESULT_OUT_OF_MEMORY = 1,
|
|
|
|
// The state of white-box does not allow execution of this operation. For
|
|
// example, another API function may need to be called first.
|
|
WB_RESULT_INVALID_STATE = 2,
|
|
|
|
// The output buffer length is too small to contain the operation's output.
|
|
WB_RESULT_BUFFER_TOO_SMALL = 3,
|
|
|
|
// There is an issue with one or more parameters.
|
|
WB_RESULT_INVALID_PARAMETER = 4,
|
|
|
|
// The message and signature did not pass signature verification.
|
|
WB_RESULT_INVALID_SIGNATURE = 5,
|
|
|
|
// A key was requested that had not been loaded into the white-box.
|
|
WB_RESULT_NO_SUCH_KEY = 6,
|
|
|
|
// A key was requested that was found in the white-box, but is being used
|
|
// improperly.
|
|
WB_RESULT_WRONG_KEY_TYPE = 7,
|
|
|
|
// The requested key's security level is not sufficient for the operation.
|
|
WB_RESULT_INSUFFICIENT_SECURITY_LEVEL = 8,
|
|
|
|
// The input data failed to be verified. This may happen if the data was
|
|
// corrupted or tampered.
|
|
WB_RESULT_DATA_VERIFICATION_ERROR = 9,
|
|
|
|
// The padding at the end of the decrypted data does not match the
|
|
// specification.
|
|
WB_RESULT_INVALID_PADDING = 10,
|
|
} WB_Result;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // WHITEBOX_API_WB_RESULT_H_
|