This change updates the copyright notice to make it more clear that the code is distribued under the Widevine Master License Agreement. It also updates the unit tests and sample code to correct the useage of AES 256. AES 256 is used to decrypt entitled content keys, but it is not used to decrypt key control blocks.
68 lines
2.3 KiB
C++
68 lines
2.3 KiB
C++
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine Master
|
|
// License Agreement.
|
|
|
|
#ifndef WVOEC_OEMCRYPTO_LOGGING_H_
|
|
#define WVOEC_OEMCRYPTO_LOGGING_H_
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
#include "OEMCryptoCENC.h"
|
|
#include "log.h"
|
|
|
|
namespace wvoec_mock {
|
|
|
|
// The constants below represent integers with a single "on" bit that
|
|
// represents categories of logging This allows users to specify with
|
|
// more precision what they want to log. LogCategoryEnabled(category)
|
|
// is used to see if the category passed in the parameters is to
|
|
// be logged based on the current settings. Categories can be combines
|
|
// using the | (or) bitwise operator. For example
|
|
// LogCategoryEnabled(category1 | category2) will return true if
|
|
// category1 and/or category2 are set to logging.
|
|
|
|
const int kLoggingTraceOEMCryptoCalls = 0x01; // All except decrypt calls.
|
|
const int kLoggingDumpContentKeys = 0x02;
|
|
const int kLoggingDumpKeyControlBlocks = 0x04;
|
|
const int kLoggingDumpDerivedKeys = 0x08;
|
|
const int kLoggingTraceNonce = 0x10;
|
|
const int kLoggingTraceDecryption = 0x20;
|
|
const int kLoggingTraceUsageTable = 0x40;
|
|
const int kLoggingTraceDecryptCalls = 0x80;
|
|
const int kLoggingDumpTraceAll = 0xFF;
|
|
|
|
void SetLoggingSettings(int level, int categories);
|
|
|
|
// set level of logging
|
|
void SetLoggingLevel(int level);
|
|
|
|
void TurnOffLoggingForAllCategories();
|
|
|
|
// Returns true if the category passed is set to logging.
|
|
// Returns false otherwise. The category constant declared
|
|
// above are passed.
|
|
bool LogCategoryEnabled(int category);
|
|
|
|
// Turn on logging for the categories passed.
|
|
void AddLoggingForCategories(int categories);
|
|
|
|
// Turn off logging for the categories passed.
|
|
void RemoveLoggingForCategories(int categories);
|
|
|
|
void dump_hex_helper(std::string& buffer, std::string name,
|
|
const uint8_t* vector, size_t length);
|
|
|
|
void dump_hex(std::string name, const uint8_t* vector, size_t length);
|
|
|
|
void dump_array_part_helper(std::string& buffer, std::string array,
|
|
size_t index, std::string name,
|
|
const uint8_t* vector, size_t length);
|
|
|
|
void dump_array_part(std::string array, size_t index, std::string name,
|
|
const uint8_t* vector, size_t length);
|
|
|
|
} // namespace wvoec_mock
|
|
|
|
#endif
|