Skip to content

Commit

Permalink
Add AES GCM support to libtomcrypt
Browse files Browse the repository at this point in the history
Signed-off-by: Jukka Laitinen <[email protected]>
  • Loading branch information
jlaitine committed Nov 23, 2023
1 parent fa97520 commit da8ea69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/lib/crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ px4_add_library(libtommath

file(GLOB_RECURSE PK_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "libtomcrypt/src/pk/*.c")
file(GLOB_RECURSE MATH_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "libtomcrypt/src/math/*.c")
file(GLOB_RECURSE GCM_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "libtomcrypt/src/encauth/gcm/*.c")
file(GLOB_RECURSE CRYPT_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "libtomcrypt/src/misc/crypt/*.c")

px4_add_library(libtomcrypt
libtomcrypt_wrappers.c
Expand All @@ -68,10 +70,11 @@ libtomcrypt_wrappers.c
libtomcrypt/src/hashes/sha2/sha256.c
libtomcrypt/src/hashes/helper/hash_memory.c
libtomcrypt/src/prngs/sprng.c
libtomcrypt/src/misc/crypt/crypt_ltc_mp_descriptor.c
libtomcrypt/src/misc/crypt/crypt_hash_is_valid.c
libtomcrypt/src/misc/crypt/crypt_prng_is_valid.c
${CRYPT_SRC}
${GCM_SRC}
libtomcrypt/src/misc/zeromem.c
libtomcrypt/src/misc/mem_neq.c
libtomcrypt/src/ciphers/aes/aes.c
)

target_include_directories(libtomcrypt
Expand All @@ -86,7 +89,7 @@ target_include_directories(libtomcrypt

# libtomcrypt defines:
# ARGTYPE=3: No argument checking
add_definitions(-DARGTYPE=3 -DLTC_EASY -DLTC_NO_TEST -DLTM_DESC -DMP_LOW_MEM)
add_definitions(-DARGTYPE=3 -DLTC_EASY -DLTC_NO_TEST -DLTM_DESC -DMP_LOW_MEM -DLTC_GCM_MODE)

# link to libtommath and os provided random library
target_link_libraries(libtomcrypt
Expand Down
1 change: 1 addition & 0 deletions src/lib/crypto/libtomcrypt_wrappers.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ unsigned long rng_get_bytes(unsigned char *out,
void libtomcrypt_init(void)
{
ltc_mp = ltm_desc;
register_cipher(&aes_desc);
}

0 comments on commit da8ea69

Please sign in to comment.