Merge changes I37d6d7aa,I9e8624dd,I96c2015a,I0b755962
* changes: Replace scoped_ptr With std::unique_ptr Replace shared_ptr With std::shared_ptr Replace UniquePtr with std::unique_ptr override, Don't OVERRIDE
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#define OEMCRYPTO_AUTH_REF_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <openssl/rsa.h>
|
||||
@@ -17,7 +18,6 @@
|
||||
#include "oemcrypto_key_ref.h"
|
||||
#include "oemcrypto_keybox_ref.h"
|
||||
#include "oemcrypto_rsa_key_shared.h"
|
||||
#include "oemcrypto_scoped_ptr.h"
|
||||
#include "oemcrypto_types.h"
|
||||
|
||||
namespace wvoec_ref {
|
||||
|
||||
@@ -7,11 +7,13 @@
|
||||
|
||||
#include "oemcrypto_engine_ref.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace wvoec_ref {
|
||||
|
||||
CryptoEngine* CryptoEngine::MakeCryptoEngine(
|
||||
scoped_ptr<wvcdm::FileSystem> file_system) {
|
||||
return new CryptoEngine(file_system);
|
||||
std::unique_ptr<wvcdm::FileSystem>&& file_system) {
|
||||
return new CryptoEngine(std::move(file_system));
|
||||
}
|
||||
|
||||
} // namespace wvoec_ref
|
||||
|
||||
@@ -8,12 +8,14 @@
|
||||
// level 1 device.
|
||||
#include "oemcrypto_engine_ref.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace wvoec_ref {
|
||||
|
||||
class L1CryptoEngine : public CryptoEngine {
|
||||
public:
|
||||
explicit L1CryptoEngine(scoped_ptr<wvcdm::FileSystem> file_system)
|
||||
: CryptoEngine(file_system) {}
|
||||
explicit L1CryptoEngine(std::unique_ptr<wvcdm::FileSystem>&& file_system)
|
||||
: CryptoEngine(std::move(file_system)) {}
|
||||
|
||||
bool config_local_display_only() { return true; }
|
||||
|
||||
@@ -31,8 +33,8 @@ class L1CryptoEngine : public CryptoEngine {
|
||||
};
|
||||
|
||||
CryptoEngine* CryptoEngine::MakeCryptoEngine(
|
||||
scoped_ptr<wvcdm::FileSystem> file_system) {
|
||||
return new L1CryptoEngine(file_system);
|
||||
std::unique_ptr<wvcdm::FileSystem>&& file_system) {
|
||||
return new L1CryptoEngine(std::move(file_system));
|
||||
}
|
||||
|
||||
} // namespace wvoec_ref
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace wvoec_ref {
|
||||
|
||||
class CertOnlyCryptoEngine : public CryptoEngine {
|
||||
public:
|
||||
explicit CertOnlyCryptoEngine(scoped_ptr<wvcdm::FileSystem> file_system)
|
||||
explicit CertOnlyCryptoEngine(std::unique_ptr<wvcdm::FileSystem> file_system)
|
||||
: CryptoEngine(file_system) {}
|
||||
|
||||
bool config_local_display_only() { return true; }
|
||||
@@ -30,7 +30,7 @@ class CertOnlyCryptoEngine : public CryptoEngine {
|
||||
};
|
||||
|
||||
CryptoEngine* CryptoEngine::MakeCryptoEngine(
|
||||
scoped_ptr<wvcdm::FileSystem> file_system) {
|
||||
std::unique_ptr<wvcdm::FileSystem> file_system) {
|
||||
return new CertOnlyCryptoEngine(file_system);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "log.h"
|
||||
#include "oem_cert.h"
|
||||
|
||||
@@ -19,8 +21,8 @@ namespace wvoec_ref {
|
||||
|
||||
class Prov30CryptoEngine : public CryptoEngine {
|
||||
public:
|
||||
explicit Prov30CryptoEngine(scoped_ptr<wvcdm::FileSystem> file_system)
|
||||
: CryptoEngine(file_system) {}
|
||||
explicit Prov30CryptoEngine(std::unique_ptr<wvcdm::FileSystem>&& file_system)
|
||||
: CryptoEngine(std::move(file_system)) {}
|
||||
|
||||
bool config_local_display_only() { return true; }
|
||||
|
||||
@@ -77,8 +79,8 @@ class Prov30CryptoEngine : public CryptoEngine {
|
||||
};
|
||||
|
||||
CryptoEngine* CryptoEngine::MakeCryptoEngine(
|
||||
scoped_ptr<wvcdm::FileSystem> file_system) {
|
||||
return new Prov30CryptoEngine(file_system);
|
||||
std::unique_ptr<wvcdm::FileSystem>&& file_system) {
|
||||
return new Prov30CryptoEngine(std::move(file_system));
|
||||
}
|
||||
|
||||
} // namespace wvoec_ref
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <openssl/err.h>
|
||||
@@ -27,10 +28,10 @@ namespace wvoec_ref {
|
||||
// all configurations. See the files oemcrypto_engine_device_properties*.cpp
|
||||
// for methods that are configured for specific configurations.
|
||||
|
||||
CryptoEngine::CryptoEngine(scoped_ptr<wvcdm::FileSystem> file_system)
|
||||
CryptoEngine::CryptoEngine(std::unique_ptr<wvcdm::FileSystem>&& file_system)
|
||||
: root_of_trust_(config_provisioning_method()),
|
||||
file_system_(file_system),
|
||||
usage_table_(NULL) {
|
||||
file_system_(std::move(file_system)),
|
||||
usage_table_() {
|
||||
ERR_load_crypto_strings();
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "oemcrypto_auth_ref.h"
|
||||
#include "oemcrypto_key_ref.h"
|
||||
#include "oemcrypto_rsa_key_shared.h"
|
||||
#include "oemcrypto_scoped_ptr.h"
|
||||
#include "oemcrypto_session.h"
|
||||
#include "oemcrypto_usage_table_ref.h"
|
||||
#include "oemcrypto_types.h"
|
||||
@@ -38,7 +37,7 @@ class CryptoEngine {
|
||||
// NOTE: The caller must instantiate a FileSystem object - ownership
|
||||
// will be transferred to the new CryptoEngine object.
|
||||
static CryptoEngine* MakeCryptoEngine(
|
||||
scoped_ptr<wvcdm::FileSystem> file_system);
|
||||
std::unique_ptr<wvcdm::FileSystem>&& file_system);
|
||||
|
||||
virtual ~CryptoEngine();
|
||||
|
||||
@@ -189,15 +188,15 @@ class CryptoEngine {
|
||||
}
|
||||
|
||||
protected:
|
||||
explicit CryptoEngine(scoped_ptr<wvcdm::FileSystem> file_system);
|
||||
explicit CryptoEngine(std::unique_ptr<wvcdm::FileSystem>&& file_system);
|
||||
virtual SessionContext* MakeSession(SessionId sid);
|
||||
virtual UsageTable* MakeUsageTable();
|
||||
uint8_t* destination_;
|
||||
ActiveSessions sessions_;
|
||||
AuthenticationRoot root_of_trust_;
|
||||
wvcdm::Lock session_table_lock_;
|
||||
scoped_ptr<wvcdm::FileSystem> file_system_;
|
||||
scoped_ptr<UsageTable> usage_table_;
|
||||
std::unique_ptr<wvcdm::FileSystem> file_system_;
|
||||
std::unique_ptr<UsageTable> usage_table_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(CryptoEngine);
|
||||
};
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <time.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "file_store.h"
|
||||
#include "log.h"
|
||||
@@ -64,8 +65,8 @@ extern "C" OEMCryptoResult OEMCrypto_Initialize(void) {
|
||||
}
|
||||
// NOTE: This requires a compatible Filesystem implementation.
|
||||
// NOTE: Ownership of the FileSystem object is transferred to CryptoEngine
|
||||
scoped_ptr<wvcdm::FileSystem> fs(new wvcdm::FileSystem());
|
||||
crypto_engine = CryptoEngine::MakeCryptoEngine(fs);
|
||||
std::unique_ptr<wvcdm::FileSystem> fs(new wvcdm::FileSystem());
|
||||
crypto_engine = CryptoEngine::MakeCryptoEngine(std::move(fs));
|
||||
|
||||
if (!crypto_engine || !crypto_engine->Initialize()) {
|
||||
LOGE("[OEMCrypto_Initialize(): failed]");
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
// 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 OEMCRYPTO_SCOPED_PTR_H_
|
||||
#define OEMCRYPTO_SCOPED_PTR_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <memory>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
namespace wvoec_ref {
|
||||
|
||||
// TODO(fredgc, jfore): scoped_ptr may not be the best name for this smart
|
||||
// pointer type. It basically works like auto_ptr which is deprecated.
|
||||
#if __cplusplus < 201103L
|
||||
|
||||
template <typename T>
|
||||
class scoped_ptr {
|
||||
public:
|
||||
explicit scoped_ptr(T* p = NULL) : ptr_(p) {}
|
||||
T* get() const { return ptr_.get(); }
|
||||
void reset(T* p = NULL) { ptr_.reset(p); }
|
||||
|
||||
private:
|
||||
std::auto_ptr<T> ptr_;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template <typename T>
|
||||
class scoped_ptr {
|
||||
public:
|
||||
explicit scoped_ptr(T* p = nullptr) : ptr_(p) {}
|
||||
scoped_ptr(scoped_ptr& r) { ptr_ = std::move(r.ptr_); }
|
||||
T& operator*() const { return *ptr_; }
|
||||
T* operator->() const { return ptr_.get(); }
|
||||
T* get() const { return ptr_.get(); }
|
||||
void reset(T* p = NULL) { ptr_.reset(p); }
|
||||
|
||||
private:
|
||||
std::unique_ptr<T> ptr_;
|
||||
};
|
||||
#endif
|
||||
|
||||
} // namespace wvoec_ref
|
||||
|
||||
#endif // OEMCRYPTO_SCOPED_PTR_H_
|
||||
Reference in New Issue
Block a user