mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2024-11-24 08:17:19 +00:00
cmake: Rename mbedcrypto library to tfpsacrypto
Do not do the same in the make build system yet, cmake build system only scope for this PR. Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
b7d0e52e16
commit
8126a686d9
@ -384,7 +384,7 @@ add_subdirectory(pkgconfig)
|
||||
# and programs. This shared test code is compiled and linked to test suites and
|
||||
# programs objects as a set of compiled objects. The compiled objects are NOT
|
||||
# built into a library that the test suite and program objects would link
|
||||
# against as they link against the mbedcrypto, mbedx509 and mbedtls libraries.
|
||||
# against as they link against the tfpsacrypto, mbedx509 and mbedtls libraries.
|
||||
# The reason is that such library is expected to have mutual dependencies with
|
||||
# the aforementioned libraries and that there is as of today no portable way of
|
||||
# handling such dependencies (only toolchain specific solutions).
|
||||
|
@ -40,7 +40,7 @@ There are currently three active build systems used within Mbed TLS releases:
|
||||
|
||||
The main systems used for development are CMake and GNU Make. Those systems are always complete and up-to-date. The others should reflect all changes present in the CMake and Make build system, although features may not be ported there automatically.
|
||||
|
||||
The Make and CMake build systems create three libraries: libmbedcrypto, libmbedx509, and libmbedtls. Note that libmbedtls depends on libmbedx509 and libmbedcrypto, and libmbedx509 depends on libmbedcrypto. As a result, some linkers will expect flags to be in a specific order, for example the GNU linker wants `-lmbedtls -lmbedx509 -lmbedcrypto`.
|
||||
The Make and CMake build systems create three libraries: libmbedcrypto/libtfpsacrypto, libmbedx509, and libmbedtls. Note that libmbedtls depends on libmbedx509 and libmbedcrypto/libtfpsacrypto, and libmbedx509 depends on libmbedcrypto/libtfpsacrypto. As a result, some linkers will expect flags to be in a specific order, for example the GNU linker wants `-lmbedtls -lmbedx509 -lmbedcrypto`.
|
||||
|
||||
### Tool versions
|
||||
|
||||
@ -200,7 +200,7 @@ CMake projects. You can include Mbed TLS's CMake targets yourself with:
|
||||
If prompted, set `MbedTLS_DIR` to `${YOUR_MBEDTLS_INSTALL_DIR}/cmake`. This
|
||||
creates the following targets:
|
||||
|
||||
- `MbedTLS::mbedcrypto` (Crypto library)
|
||||
- `MbedTLS::tfpsacrypto` (Crypto library)
|
||||
- `MbedTLS::mbedtls` (TLS library)
|
||||
- `MbedTLS::mbedx509` (X509 library)
|
||||
|
||||
@ -210,7 +210,7 @@ You can then use these directly through `target_link_libraries()`:
|
||||
|
||||
target_link_libraries(xyz
|
||||
PUBLIC MbedTLS::mbedtls
|
||||
MbedTLS::mbedcrypto
|
||||
MbedTLS::tfpsacrypto
|
||||
MbedTLS::mbedx509)
|
||||
|
||||
This will link the Mbed TLS libraries to your library or application, and add
|
||||
|
@ -7,4 +7,4 @@ Description: @PKGCONFIG_PROJECT_DESCRIPTION@
|
||||
URL: @PKGCONFIG_PROJECT_HOMEPAGE_URL@
|
||||
Version: @PROJECT_VERSION@
|
||||
Cflags: -I"${includedir}"
|
||||
Libs: -L"${libdir}" -lmbedcrypto -lbuiltin -leverest -lp256m
|
||||
Libs: -L"${libdir}" -ltfpsacrypto -lbuiltin -leverest -lp256m
|
||||
|
@ -19,7 +19,8 @@
|
||||
#define SO_SUFFIX ".so"
|
||||
#endif
|
||||
|
||||
#define CRYPTO_SO_FILENAME "libmbedcrypto" SO_SUFFIX
|
||||
#define MBEDCRYPTO_SO_FILENAME "libmbedcrypto" SO_SUFFIX
|
||||
#define TFPSACRYPTO_SO_FILENAME "libtfpsacrypto" SO_SUFFIX
|
||||
#define X509_SO_FILENAME "libmbedx509" SO_SUFFIX
|
||||
#define TLS_SO_FILENAME "libmbedtls" SO_SUFFIX
|
||||
|
||||
@ -73,8 +74,16 @@ int main(void)
|
||||
#endif /* MBEDTLS_X509_CRT_PARSE_C */
|
||||
|
||||
#if defined(MBEDTLS_MD_C)
|
||||
void *crypto_so = dlopen(CRYPTO_SO_FILENAME, RTLD_NOW);
|
||||
CHECK_DLERROR("dlopen", CRYPTO_SO_FILENAME);
|
||||
const char *crypto_so_filename = NULL;
|
||||
void *crypto_so = dlopen(MBEDCRYPTO_SO_FILENAME, RTLD_NOW);
|
||||
if (dlerror() == NULL) {
|
||||
crypto_so_filename = MBEDCRYPTO_SO_FILENAME;
|
||||
} else {
|
||||
crypto_so = dlopen(TFPSACRYPTO_SO_FILENAME, RTLD_NOW);
|
||||
CHECK_DLERROR("dlopen", TFPSACRYPTO_SO_FILENAME);
|
||||
crypto_so_filename = TFPSACRYPTO_SO_FILENAME;
|
||||
}
|
||||
|
||||
const int *(*md_list)(void) =
|
||||
dlsym(crypto_so, "mbedtls_md_list");
|
||||
CHECK_DLERROR("dlsym", "mbedtls_md_list");
|
||||
@ -83,9 +92,9 @@ int main(void)
|
||||
;
|
||||
}
|
||||
mbedtls_printf("dlopen(%s): %u hashes\n",
|
||||
CRYPTO_SO_FILENAME, n);
|
||||
crypto_so_filename, n);
|
||||
dlclose(crypto_so);
|
||||
CHECK_DLERROR("dlclose", CRYPTO_SO_FILENAME);
|
||||
CHECK_DLERROR("dlclose", crypto_so_filename);
|
||||
#endif /* MBEDTLS_MD_C */
|
||||
|
||||
return 0;
|
||||
|
@ -20,7 +20,7 @@ component_test_cmake_shared () {
|
||||
msg "build/test: cmake shared" # ~ 2min
|
||||
cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On .
|
||||
make
|
||||
ldd programs/util/strerror | grep libmbedcrypto
|
||||
ldd programs/util/strerror | grep libtfpsacrypto
|
||||
make test
|
||||
programs/test/dlopen_demo.sh
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ if(USE_STATIC_TF_PSA_CRYPTO_LIBRARY)
|
||||
add_library(${tfpsacrypto_static_target} STATIC ${src_crypto})
|
||||
set_base_compile_options(${tfpsacrypto_static_target})
|
||||
target_compile_options(${tfpsacrypto_static_target} PRIVATE ${LIBS_C_FLAGS})
|
||||
set_target_properties(${tfpsacrypto_static_target} PROPERTIES OUTPUT_NAME mbedcrypto)
|
||||
set_target_properties(${tfpsacrypto_static_target} PROPERTIES OUTPUT_NAME tfpsacrypto)
|
||||
target_link_libraries(${tfpsacrypto_static_target} PUBLIC ${libs})
|
||||
|
||||
target_link_libraries(${tfpsacrypto_static_target} PUBLIC ${builtin_static_target})
|
||||
|
@ -7,4 +7,4 @@ Description: @PKGCONFIG_PROJECT_DESCRIPTION@
|
||||
URL: @PKGCONFIG_PROJECT_HOMEPAGE_URL@
|
||||
Version: @PROJECT_VERSION@
|
||||
Cflags: -I"${includedir}"
|
||||
Libs: -L"${libdir}" -lmbedcrypto -lbuiltin -leverest -lp256m
|
||||
Libs: -L"${libdir}" -ltfpsacrypto -lbuiltin -leverest -lp256m
|
||||
|
Loading…
Reference in New Issue
Block a user