Misc Windows fixes.

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

- Add build settings for Windows.
- Conditionally add pthread.
- Add dummy DLLMain method.
- Fix #if checks for Windows.
- Remove designated initializers which aren't supported in MSVC.
- Remove variable length array.

Test: Android Unit Tests
Bug: 122953649
Change-Id: I14f16e7ce4b3ff17ee0139ea6c2f7243ae999aa1
This commit is contained in:
Jacob Trimble
2019-01-25 15:05:00 -08:00
committed by John W. Bruce
parent 85e2c6a026
commit b3dd9c3711
6 changed files with 90 additions and 64 deletions

View File

@@ -8,6 +8,7 @@
// OEMCrypto unit tests
//
#include <openssl/rsa.h>
#include <time.h>
#include <string>
#include <vector>

View File

@@ -1688,12 +1688,13 @@ TEST_P(SessionTestRefreshKeyTest, RefreshWithNoSelectKey) {
num_keys_, wvoec::kControlNonceEnabled, s.get_nonce()));
s.ServerSignBuffer(reinterpret_cast<const uint8_t*>(&s.encrypted_license()),
s.message_size(), &s.signature());
OEMCrypto_KeyRefreshObject key_array[num_keys_];
s.FillRefreshArray(key_array, num_keys_);
std::vector<OEMCrypto_KeyRefreshObject> key_array(num_keys_);
s.FillRefreshArray(key_array.data(), num_keys_);
ASSERT_EQ(OEMCrypto_SUCCESS,
OEMCrypto_RefreshKeys(s.session_id(), s.message_ptr(),
s.message_size(), s.signature().data(),
s.signature().size(), num_keys_, key_array));
s.signature().size(), num_keys_,
key_array.data()));
ASSERT_NO_FATAL_FAILURE(s.TestDecryptCTR(false));
// This should still be valid key, even if the refresh failed, because this
// is before the original license duration.