Commit 62165440 authored by YannGarcia's avatar YannGarcia

Build lib_its_security on Windows

parent f58d1de6
This source diff could not be displayed because it is too large. You can view the blob instead.
#ifdef _Win64
#include "pch.h"
#else
#include <gtest/gtest.h>
#endif
#include "gtest/gtest.h"
extern "C" {
#include "lib_its_security.h"
int8_t* bin_to_hex(const uint8_t* p_buffer, const size_t p_buffer_length);
#ifndef _Win64
uint8_t* hex_to_bin(const int8_t* p_buffer, size_t* p_buffer_length);
#endif
}
#ifdef _Win64
uint8_t* hex_to_bin(const int8_t* p_buffer, size_t* p_buffer_length) {
int8_t a;
size_t i, len;
uint8_t* retval = NULL;
// Sanity check
if (p_buffer == NULL) {
return NULL;
}
if ((len = strlen((const char*)p_buffer)) & 1) {
return NULL;
}
retval = (uint8_t*)malloc(len >> 1);
for (i = 0; i < len; i++) {
a = toupper(*(p_buffer + i));
if (!isxdigit(a)) {
break;
}
if (isdigit(a)) {
a -= '0';
}
else {
a = a - 'A' + 0x0A;
}
if (i & 1) {
retval[i >> 1] |= a;
}
else {
retval[i >> 1] = a << 4;
}
} // End of 'for' statement
if (i < len) {
free(retval);
retval = NULL;
}
*p_buffer_length = len >> 1;
return retval;
}
#endif
#ifndef _Win64
/**
* @class lib_its_security unit tests suite implementation
*/
class lib_its_security_test_suite : public ::testing::Test {
protected:
virtual void SetUp() { };
virtual void TearDown() { };
virtual void SetUp() { };
virtual void TearDown() { };
};
#endif
TEST(lib_its_security_test_suite, Init1) {
EXPECT_TRUE(initialize(nist_p_256, NULL) == -1);
......@@ -1222,5 +1263,3 @@ int main(int argc, char **argv) {
return RUN_ALL_TESTS();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment