ssl_test_lib.[hc]: new source file for common SSL test code
Create a new source file for code that is shared between ssl_client2.c and ssl_server2.c. This commit only creates the file; subsequent commits will populate it. Add it to the official build systems (make, cmake, VS). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
d20a210bbd
commit
a3ed34fed6
7 changed files with 59 additions and 4 deletions
|
@ -267,9 +267,13 @@ ssl/ssl_client1$(EXEXT): ssl/ssl_client1.c $(DEP)
|
|||
echo " CC ssl/ssl_client1.c"
|
||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client1.c $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
SSL_TEST_OBJECTS = test/query_config.o
|
||||
SSL_TEST_OBJECTS = test/query_config.o ssl/ssl_test_lib.o
|
||||
|
||||
ssl/ssl_client2$(EXEXT): ssl/ssl_client2.c $(SSL_TEST_OBJECTS) $(DEP)
|
||||
ssl/ssl_test_lib.o: ssl/ssl_test_lib.c ssl/ssl_test_lib.h $(DEP)
|
||||
echo " CC ssl/ssl_test_lib.c"
|
||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) -c ssl/ssl_test_lib.c -o $@
|
||||
|
||||
ssl/ssl_client2$(EXEXT): ssl/ssl_client2.c $(SSL_TEST_OBJECTS) ssl/ssl_test_lib.h $(DEP)
|
||||
echo " CC ssl/ssl_client2.c"
|
||||
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) ssl/ssl_client2.c $(SSL_TEST_OBJECTS) $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
|
|
|
@ -32,8 +32,10 @@ foreach(exe IN LISTS executables)
|
|||
target_include_directories(${exe} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../tests/include)
|
||||
endforeach()
|
||||
|
||||
set_property(TARGET ssl_client2 APPEND PROPERTY SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c)
|
||||
set_property(TARGET ssl_server2 APPEND PROPERTY SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c)
|
||||
set_property(TARGET ssl_client2 APPEND PROPERTY SOURCES
|
||||
ssl_test_lib.c ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c)
|
||||
set_property(TARGET ssl_server2 APPEND PROPERTY SOURCES
|
||||
ssl_test_lib.c ${CMAKE_CURRENT_SOURCE_DIR}/../test/query_config.c)
|
||||
|
||||
if(THREADS_FOUND)
|
||||
add_executable(ssl_pthread_server ssl_pthread_server.c $<TARGET_OBJECTS:mbedtls_test>)
|
||||
|
|
21
programs/ssl/ssl_test_lib.c
Normal file
21
programs/ssl/ssl_test_lib.c
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Common code for SSL test programs
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ssl_test_lib.h"
|
||||
|
23
programs/ssl/ssl_test_lib.h
Normal file
23
programs/ssl/ssl_test_lib.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Common code for SSL test programs
|
||||
*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef MBEDTLS_PROGRAMS_SSL_SSL_TEST_LIB_H
|
||||
#define MBEDTLS_PROGRAMS_SSL_SSL_TEST_LIB_H
|
||||
|
||||
#endif /* MBEDTLS_PROGRAMS_SSL_SSL_TEST_LIB_H */
|
|
@ -161,6 +161,9 @@ sub gen_app {
|
|||
$appname eq "query_compile_time_config" ) {
|
||||
$srcs .= "\r\n <ClCompile Include=\"..\\..\\programs\\test\\query_config.c\" \/>";
|
||||
}
|
||||
if( $appname eq "ssl_client2" or $appname eq "ssl_server2" ) {
|
||||
$srcs .= "\r\n <ClCompile Include=\"..\\..\\programs\\ssl\\ssl_test_lib.c\" \/>";
|
||||
}
|
||||
|
||||
my $content = $template;
|
||||
$content =~ s/<SOURCES>/$srcs/g;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<ItemGroup>
|
||||
<ClCompile Include="..\..\programs\ssl\ssl_client2.c" />
|
||||
<ClCompile Include="..\..\programs\test\query_config.c" />
|
||||
<ClCompile Include="..\..\programs\ssl\ssl_test_lib.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="mbedTLS.vcxproj">
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<ItemGroup>
|
||||
<ClCompile Include="..\..\programs\ssl\ssl_server2.c" />
|
||||
<ClCompile Include="..\..\programs\test\query_config.c" />
|
||||
<ClCompile Include="..\..\programs\ssl\ssl_test_lib.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="mbedTLS.vcxproj">
|
||||
|
|
Loading…
Reference in a new issue