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().
33 lines
846 B
C++
33 lines
846 B
C++
// Copyright 2020 Google LLC. All Rights Reserved.
|
|
|
|
#ifndef WHITEBOX_CRYPTO_UTILS_AES_CBC_ENCRYPTOR_H_
|
|
#define WHITEBOX_CRYPTO_UTILS_AES_CBC_ENCRYPTOR_H_
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
|
|
#include "third_party/boringssl/src/include/openssl/aes.h"
|
|
|
|
namespace widevine {
|
|
|
|
class AesCbcEncryptor {
|
|
public:
|
|
// Prepares the encryptor with the key.
|
|
virtual bool SetKey(const uint8_t* key, size_t key_size);
|
|
|
|
// Puts the encrypted result of |input_data| into |output_data|.
|
|
virtual bool Encrypt(const uint8_t* iv,
|
|
size_t iv_size,
|
|
const uint8_t* input_data,
|
|
size_t input_data_size,
|
|
uint8_t* output_data);
|
|
|
|
private:
|
|
AES_KEY aes_key_;
|
|
size_t aes_key_size_ = 0;
|
|
};
|
|
|
|
} // namespace widevine
|
|
|
|
#endif // WHITEBOX_CRYPTO_UTILS_AES_CBC_ENCRYPTOR_H_
|