Add some platform abstractions.

(This is a merge of http://go/wvgerrit/70303)

This adds a platform.h file to abstract some of the differences
between Windows and POSIX platforms.  This includes ntohl, setenv,
and ssize_t.

Bug: 122953649
Test: Android Unit Tests
Change-Id: I3235f3f284b53d24d7365ff3f4a06dcd9b403697
This commit is contained in:
John W. Bruce
2019-01-15 16:53:22 -08:00
parent 1cd093795e
commit 777abaef01
21 changed files with 74 additions and 20 deletions

View File

@@ -6,7 +6,6 @@
//
#include "oemcrypto_engine_ref.h"
#include <arpa/inet.h>
#include <assert.h>
#include <chrono>
#include <string.h>

View File

@@ -6,13 +6,14 @@
//
#include "oemcrypto_keybox_ref.h"
#include <arpa/inet.h> // needed for ntoh()
#include <string.h>
#include <sys/types.h>
#include <cstdint>
#include <string>
#include "log.h"
#include "oemcrypto_types.h"
#include "platform.h"
#include "wvcrc32.h"
namespace wvoec_ref {

View File

@@ -6,7 +6,6 @@
//
#include "oemcrypto_session.h"
#include <arpa/inet.h>
#include <assert.h>
#include <string.h>
#include <algorithm>
@@ -30,6 +29,7 @@
#include "oemcrypto_key_ref.h"
#include "oemcrypto_rsa_key_shared.h"
#include "oemcrypto_types.h"
#include "platform.h"
#include "disallow_copy_and_assign.h"
#include "string_conversions.h"
#include "wvcrc32.h"

View File

@@ -4,7 +4,7 @@
//
// Compute CRC32 Checksum. Needed for verification of WV Keybox.
//
#include <arpa/inet.h>
#include "platform.h"
#include "wvcrc32.h"
namespace wvoec_ref {

View File

@@ -7,7 +7,6 @@
#include "oec_session_util.h"
#include <arpa/inet.h> // needed for ntoh()
#include <openssl/aes.h>
#include <openssl/bio.h>
#include <openssl/cmac.h>
@@ -32,6 +31,7 @@
#include "oec_device_features.h"
#include "oec_test_data.h"
#include "oemcrypto_types.h"
#include "platform.h"
#include "string_conversions.h"
using namespace std;

View File

@@ -4,9 +4,7 @@
//
// OEMCrypto unit tests
//
#include <arpa/inet.h> // needed for ntoh()
#include <ctype.h>
#include <getopt.h>
#include <openssl/aes.h>
#include <openssl/err.h>
#include <openssl/hmac.h>
@@ -35,6 +33,7 @@
#include "oec_test_data.h"
#include "oemcrypto_session_tests_helper.h"
#include "oemcrypto_types.h"
#include "platform.h"
#include "string_conversions.h"
#include "wvcrc32.h"

View File

@@ -4,7 +4,7 @@
//
// Compute CRC32 Checksum. Needed for verification of WV Keybox.
//
#include <arpa/inet.h>
#include "platform.h"
#include "wvcrc32.h"
namespace wvoec {