Update to support OEMCrypto v16 with ODK

This commit is contained in:
KongQun Yang
2020-09-21 15:54:04 -07:00
parent 93265ab9d1
commit 69d813f0f1
203 changed files with 16337 additions and 2290 deletions

View File

@@ -13,13 +13,13 @@
#define COMMON_X509_CERT_H_
#include <stddef.h>
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/thread_annotations.h"
#include "absl/base/thread_annotations.h"
#include "absl/synchronization/mutex.h"
#include "openssl/pem.h"
#include "openssl/x509.h"
@@ -39,6 +39,10 @@ class X509Cert {
static std::unique_ptr<X509Cert> FromOpenSslCert(ScopedX509 openssl_cert_);
X509Cert();
X509Cert(const X509Cert&) = delete;
X509Cert& operator=(const X509Cert&) = delete;
virtual ~X509Cert();
// Load an X.509 certificate. Takes a single parameter, |pem_cert|, which is
@@ -98,14 +102,15 @@ class X509Cert {
std::string subject_name_;
friend class X509CertChain;
DISALLOW_COPY_AND_ASSIGN(X509Cert);
};
// Class which holds a chain of X.509 certificates.
class X509CertChain {
public:
X509CertChain() {}
X509CertChain() = default;
X509CertChain(const X509CertChain&) = delete;
X509CertChain& operator=(const X509CertChain&) = delete;
virtual ~X509CertChain();
// Loads a chain of PEM-encoded X.509 certificates. Takes a single parameter,
@@ -135,8 +140,6 @@ class X509CertChain {
void Reset();
std::vector<X509Cert*> cert_chain_;
DISALLOW_COPY_AND_ASSIGN(X509CertChain);
};
// CA class which holds the root CA cert, and verifies certificate chains.
@@ -144,6 +147,10 @@ class X509CA {
public:
// New object assumes ownership of |ca_cert|.
explicit X509CA(X509Cert* ca_cert);
X509CA(const X509CA&) = delete;
X509CA& operator=(const X509CA&) = delete;
virtual ~X509CA();
// Does X.509 PKI validation of |cert| against the root CA certificate
@@ -166,9 +173,7 @@ class X509CA {
std::unique_ptr<X509Cert> ca_cert_;
absl::Mutex openssl_store_mutex_;
X509_STORE* openssl_store_ GUARDED_BY(openssl_store_mutex_);
DISALLOW_IMPLICIT_CONSTRUCTORS(X509CA);
X509_STORE* openssl_store_ ABSL_GUARDED_BY(openssl_store_mutex_);
};
} // namespace widevine