Update to support OEMCrypto v16 with ODK
This commit is contained in:
@@ -27,7 +27,7 @@ cc_library(
|
||||
name = "proto_status",
|
||||
hdrs = ["proto_status.h"],
|
||||
deps = [
|
||||
"@protobuf_repo//:protobuf",
|
||||
"@com_google_protobuf//:protobuf",
|
||||
"//util:error_space",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -17,3 +17,13 @@ cc_library(
|
||||
"endian.h",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "endian_test",
|
||||
srcs = ["endian_test.cc"],
|
||||
deps = [
|
||||
":endian",
|
||||
"//testing:gunit_main",
|
||||
"@abseil_repo//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#define UTIL_ENDIAN_ENDIAN_H_
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
@@ -19,7 +20,8 @@ namespace widevine {
|
||||
// order and big-endian byte order (same as network byte order)
|
||||
class BigEndian {
|
||||
public:
|
||||
static uint32_t Load32(const char* data) {
|
||||
static uint32_t Load32(const char* indata) {
|
||||
const uint8_t* data = reinterpret_cast<const uint8_t*>(indata);
|
||||
return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3];
|
||||
}
|
||||
|
||||
|
||||
21
util/endian/endian_test.cc
Normal file
21
util/endian/endian_test.cc
Normal file
@@ -0,0 +1,21 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright 2020 Google LLC.
|
||||
//
|
||||
// This software is licensed under the terms defined in the Widevine Master
|
||||
// License Agreement. For a copy of this agreement, please contact
|
||||
// widevine-licensing@google.com.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include "util/endian/endian.h"
|
||||
|
||||
#include "testing/gmock.h"
|
||||
#include "testing/gunit.h"
|
||||
#include "absl/strings/escaping.h"
|
||||
|
||||
TEST(BigEndian, Load32) {
|
||||
const char value[] = "000000c8";
|
||||
EXPECT_EQ(static_cast<uint32_t>(0xC8),
|
||||
widevine::BigEndian::Load32(
|
||||
absl::HexStringToBytes(std::string(value)).data()));
|
||||
}
|
||||
|
||||
namespace widevine {} // namespace widevine
|
||||
@@ -17,7 +17,9 @@ namespace util {
|
||||
class ErrorSpace {
|
||||
public:
|
||||
std::string SpaceName() const { return space_name_func_(this); }
|
||||
std::string String(int code) const { return code_to_string_func_(this, code); }
|
||||
std::string String(int code) const {
|
||||
return code_to_string_func_(this, code);
|
||||
}
|
||||
|
||||
protected:
|
||||
// typedef instead of using statements for SWIG compatibility.
|
||||
|
||||
Reference in New Issue
Block a user