Commit 506d49cf authored by Yann Garcia's avatar Yann Garcia

Bug fixed in lib_its_security

parent bd92233e
......@@ -22,7 +22,6 @@
<preprocessorIncludes>
<listItem>./bin</listItem>
<listItem>./src/bin</listItem>
<listItem>./src/bin/asn1</listItem>
<listItem>C:\ProgramFiles\OpenSSL-Win64\include</listItem>
<listItem>C:\npcap-sdk-0.1\Include</listItem>
<listItem>/Users/yann/Documents/wireshark/cygwin64/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++</listItem>
......@@ -30,8 +29,8 @@
<disableJSON>true</disableJSON>
<includeSourceInfo>true</includeSourceInfo>
<addSourceLineInfo>true</addSourceLineInfo>
<enableLegacyEncoding>true</enableLegacyEncoding>
<activateDebugger>true</activateDebugger>
<enableLegacyEncoding>true</enableLegacyEncoding>
<otherOptimizationFlags>-std=c++11</otherOptimizationFlags>
<additionalObjects>
<listItem>./src/bin/asn1/libItsAsn.so</listItem>
......
......@@ -395,13 +395,13 @@ LIBITSSECURITY_API int32_t decrypt_with_ecies_brainpoolp256r1_with_sha256(
* \param[out] p_cipher_message_length The ciphered message length
* \return 0 on success, -1 otherwise
*/
LIBITSSECURITY_API int32_t encrypt_( // Conflict with unistd.h
lib_its_security_context_t* p_lib_its_security_context,
const uint8_t* p_plain_text_message,
const size_t p_plain_text_message_length,
uint8_t** p_cipher_message,
size_t* p_cipher_message_length
);
LIBITSSECURITY_API int32_t encrypt_( // Conflict with unistd.h
lib_its_security_context_t* p_lib_its_security_context,
const uint8_t* p_plain_text_message,
const size_t p_plain_text_message_length,
uint8_t** p_cipher_message,
size_t* p_cipher_message_length
);
/**
* \fn int32_t decrypt(lib_its_security_context_t* p_lib_its_security_context, const uint8_t* p_cipher_message, const size_t p_cipher_message_length, uint8_t** p_plain_text_message, size_t* p_plain_text_message_length);
......
......@@ -88,10 +88,10 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;LIBITSSECURITY_EXPORTS;_WINDOWS;_USRDLL;_Win64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_Win64;_DEBUG;LIBITSSECURITY_EXPORTS;_WINDOWS;_USRDLL;_Win64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>C:\Program Files\OpenSSL-Win64\include</AdditionalIncludeDirectories>
......@@ -159,6 +159,9 @@
<AdditionalLibraryDirectories>C:\Program Files\OpenSSL-Win64\lib\VC</AdditionalLibraryDirectories>
<AdditionalDependencies>libcrypto64MDd.lib;libssl64MDd.lib;Ws2_32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>cp "$(TargetPath)" "$(MSBuildProjectDirectory)\..\..\..\tt3plugins\TT_TestSystem\itssecurity\win32\x86_64"</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="lib_its_security.h" />
......
......@@ -65,7 +65,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_Win64;X64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
......@@ -77,7 +77,7 @@
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<AdditionalLibraryDirectories>C:\Users\yanng\source\repos\TestOpenSSL\x64\Debug;C:\Program Files\OpenSSL-Win64\lib\VC</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>$(ProjectDir)..\x64\Debug;C:\Program Files\OpenSSL-Win64\lib\VC</AdditionalLibraryDirectories>
<AdditionalDependencies>lib_its_security.lib;libcrypto64MDd.lib;libssl64MDd.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
</Link>
......
......@@ -640,6 +640,34 @@ TEST(lib_its_security_test_suite, sign_with_ecdsa_brainpoolp256r1_with_sha256_4)
EXPECT_TRUE(lib_its_security_context == NULL);
}
TEST(lib_its_security_test_suite, sign_with_ecdsa_brainpoolp256r1_with_sha256_5) {
// Preamble
lib_its_security_context_t* lib_its_security_context = NULL;
size_t l;
uint8_t* public_key_compressed = hex_to_bin((const int8_t*)"45dc4fbf42910e1843bc33ed5752e3781fa84432af6d77c3f35bc105e8493842", &l);
ecc_compressed_mode_t public_key_compressed_mode = compressed_y_0;
EXPECT_TRUE(initialize_with_public_key(brainpool_p_256_r1, public_key_compressed, public_key_compressed_mode, &lib_its_security_context) == 0);
// Test body
size_t data_length;
uint8_t* data = hex_to_bin((const int8_t*)"40038081CD018140B35BB1620425E515B0AE24C8183B64FF008003008062C042D452D16EBA70812431356433396237342D653232372D346431322D383039622D36313033373631623235393000000000001E80314F8400788301028000FA80017C0001018002026F81030201C080808369D872E470EC6CFB9483834DAF3BA42430ED455308382F8893C94195F31125528180256EF768A3101619D9D67071B20CE3339EFEA006FBD11CEDE0406BE63E0F947B54D4BDE21CB10580CB8D3119F6152FD0C48E07A95CB26A72746EE3B62600B27F4002026F0001D16790C0B1BD", &data_length);
uint8_t* issuer = hex_to_bin((const int8_t*)"89bab7dea15bdaf3ff0357d952760a25735dd9816941bf6562c042d452d16eba", &l);
uint8_t* sig = hex_to_bin((const int8_t*)"03F5D9B6C73AE57FE2372F0F9580349A474AF3CE30CE986E7DFDEF8E87BA309B45677D03B713594E0C731B3C680A87631A9E23993678B2268E1715B8EB5E07CF", &l);
EXPECT_TRUE(verify_with_ecdsa_brainpoolp256r1_with_sha256(lib_its_security_context, data, data_length, issuer, sig, public_key_compressed, public_key_compressed_mode) == 0);
free(data);
data = hex_to_bin((const int8_t*)"018140917e149bda9bb458c5ae3d48757c41b3008003008062c042d452d16eba70812436393761346436332d366666342d343234642d613664342d38333738653034306234316200000000001e8113df8400788301028000fa80017c0001018002026f81030201c08080839f4d40e1aa679757aad00885fdf365b4b9764d51e5f4cbba38765813fddc6f8d8180934615ee798ccc3786dc0a8b305ddc04cc7641acf1c52fce051ebf7a5266e9fb490f723920145aa9a014231948b01ba5227f8adda0e5c912376930330a09c1944002026f0001d17511c52f26", &data_length);
EXPECT_TRUE(verify_with_ecdsa_brainpoolp256r1_with_sha256(lib_its_security_context, data, data_length, issuer, sig, public_key_compressed, public_key_compressed_mode) == -1);
// Postamble
free(data);
free(issuer);
free(sig);
free(public_key_compressed);
EXPECT_TRUE(lib_its_security_context->ec_key != NULL);
EXPECT_TRUE(uninitialize(&lib_its_security_context) == 0);
EXPECT_TRUE(lib_its_security_context == NULL);
}
TEST(lib_its_security_test_suite, sign_with_ecdsa_brainpoolp384r1_with_sha384_1) {
// Preamble
lib_its_security_context_t* lib_its_security_context = NULL;
......
......@@ -302,6 +302,7 @@ module ItsGenCert_Functions {
p_certificate_details_list[v_counter].public_key_compressed,
p_certificate_details_list[v_counter].public_key_compressed_mode,
p_certificate_details_list[v_counter].hash,
p_certificate_details_list[v_counter].hash_256,
p_certificate_details_list[v_counter].hashid8,
p_certificate_details_list[v_counter].issuer,
p_certificate_details_list[v_counter].private_enc_key,
......@@ -319,6 +320,7 @@ module ItsGenCert_Functions {
p_certificate_details_list[v_counter].public_key_compressed,
p_certificate_details_list[v_counter].public_key_compressed_mode,
p_certificate_details_list[v_counter].hash,
p_certificate_details_list[v_counter].hash_256,
p_certificate_details_list[v_counter].hashid8,
p_certificate_details_list[v_counter].issuer,
omit,
......
Subproject commit 956ea968e8a7b3701c6fbb1386c3aac2e98c4d46
Subproject commit 3f7c134dc24afb3a4b8ae71dd04b75b116b8fda7
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