mirror of
https://github.com/ARMmbed/mbedtls.git
synced 2025-06-25 22:56:35 +08: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
|
# 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
|
# 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
|
# 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 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
|
# the aforementioned libraries and that there is as of today no portable way of
|
||||||
# handling such dependencies (only toolchain specific solutions).
|
# 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 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
|
### 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
|
If prompted, set `MbedTLS_DIR` to `${YOUR_MBEDTLS_INSTALL_DIR}/cmake`. This
|
||||||
creates the following targets:
|
creates the following targets:
|
||||||
|
|
||||||
- `MbedTLS::mbedcrypto` (Crypto library)
|
- `MbedTLS::tfpsacrypto` (Crypto library)
|
||||||
- `MbedTLS::mbedtls` (TLS library)
|
- `MbedTLS::mbedtls` (TLS library)
|
||||||
- `MbedTLS::mbedx509` (X509 library)
|
- `MbedTLS::mbedx509` (X509 library)
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ You can then use these directly through `target_link_libraries()`:
|
|||||||
|
|
||||||
target_link_libraries(xyz
|
target_link_libraries(xyz
|
||||||
PUBLIC MbedTLS::mbedtls
|
PUBLIC MbedTLS::mbedtls
|
||||||
MbedTLS::mbedcrypto
|
MbedTLS::tfpsacrypto
|
||||||
MbedTLS::mbedx509)
|
MbedTLS::mbedx509)
|
||||||
|
|
||||||
This will link the Mbed TLS libraries to your library or application, and add
|
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@
|
URL: @PKGCONFIG_PROJECT_HOMEPAGE_URL@
|
||||||
Version: @PROJECT_VERSION@
|
Version: @PROJECT_VERSION@
|
||||||
Cflags: -I"${includedir}"
|
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"
|
#define SO_SUFFIX ".so"
|
||||||
#endif
|
#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 X509_SO_FILENAME "libmbedx509" SO_SUFFIX
|
||||||
#define TLS_SO_FILENAME "libmbedtls" SO_SUFFIX
|
#define TLS_SO_FILENAME "libmbedtls" SO_SUFFIX
|
||||||
|
|
||||||
@ -73,8 +74,16 @@ int main(void)
|
|||||||
#endif /* MBEDTLS_X509_CRT_PARSE_C */
|
#endif /* MBEDTLS_X509_CRT_PARSE_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_MD_C)
|
#if defined(MBEDTLS_MD_C)
|
||||||
void *crypto_so = dlopen(CRYPTO_SO_FILENAME, RTLD_NOW);
|
const char *crypto_so_filename = NULL;
|
||||||
CHECK_DLERROR("dlopen", CRYPTO_SO_FILENAME);
|
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) =
|
const int *(*md_list)(void) =
|
||||||
dlsym(crypto_so, "mbedtls_md_list");
|
dlsym(crypto_so, "mbedtls_md_list");
|
||||||
CHECK_DLERROR("dlsym", "mbedtls_md_list");
|
CHECK_DLERROR("dlsym", "mbedtls_md_list");
|
||||||
@ -83,9 +92,9 @@ int main(void)
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
mbedtls_printf("dlopen(%s): %u hashes\n",
|
mbedtls_printf("dlopen(%s): %u hashes\n",
|
||||||
CRYPTO_SO_FILENAME, n);
|
crypto_so_filename, n);
|
||||||
dlclose(crypto_so);
|
dlclose(crypto_so);
|
||||||
CHECK_DLERROR("dlclose", CRYPTO_SO_FILENAME);
|
CHECK_DLERROR("dlclose", crypto_so_filename);
|
||||||
#endif /* MBEDTLS_MD_C */
|
#endif /* MBEDTLS_MD_C */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -20,7 +20,7 @@ component_test_cmake_shared () {
|
|||||||
msg "build/test: cmake shared" # ~ 2min
|
msg "build/test: cmake shared" # ~ 2min
|
||||||
cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On .
|
cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On .
|
||||||
make
|
make
|
||||||
ldd programs/util/strerror | grep libmbedcrypto
|
ldd programs/util/strerror | grep libtfpsacrypto
|
||||||
make test
|
make test
|
||||||
programs/test/dlopen_demo.sh
|
programs/test/dlopen_demo.sh
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ if(USE_STATIC_TF_PSA_CRYPTO_LIBRARY)
|
|||||||
add_library(${tfpsacrypto_static_target} STATIC ${src_crypto})
|
add_library(${tfpsacrypto_static_target} STATIC ${src_crypto})
|
||||||
set_base_compile_options(${tfpsacrypto_static_target})
|
set_base_compile_options(${tfpsacrypto_static_target})
|
||||||
target_compile_options(${tfpsacrypto_static_target} PRIVATE ${LIBS_C_FLAGS})
|
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 ${libs})
|
||||||
|
|
||||||
target_link_libraries(${tfpsacrypto_static_target} PUBLIC ${builtin_static_target})
|
target_link_libraries(${tfpsacrypto_static_target} PUBLIC ${builtin_static_target})
|
||||||
|
@ -7,4 +7,4 @@ Description: @PKGCONFIG_PROJECT_DESCRIPTION@
|
|||||||
URL: @PKGCONFIG_PROJECT_HOMEPAGE_URL@
|
URL: @PKGCONFIG_PROJECT_HOMEPAGE_URL@
|
||||||
Version: @PROJECT_VERSION@
|
Version: @PROJECT_VERSION@
|
||||||
Cflags: -I"${includedir}"
|
Cflags: -I"${includedir}"
|
||||||
Libs: -L"${libdir}" -lmbedcrypto -lbuiltin -leverest -lp256m
|
Libs: -L"${libdir}" -ltfpsacrypto -lbuiltin -leverest -lp256m
|
||||||
|
Loading…
x
Reference in New Issue
Block a user