Skip to content

pico_mbedtls doesn't compile block_cipher.c #2882

@kripton

Description

@kripton

I tried using AES-256-GCM using pico_mbedtls. However, linking always failed with this error message:

/usr/x86_64-pc-linux-gnu/arm-none-eabi/binutils-bin/2.46.0/ld: CMakeFiles/PROJECT/opt/raspberrypi/pico-sdk/lib/mbedtls/library/gcm.c.o: in function `gcm_mask':
/opt/raspberrypi/pico-sdk/lib/mbedtls/library/gcm.c:543:(.text.gcm_mask+0x16): undefined reference to `mbedtls_block_cipher_encrypt'
/usr/x86_64-pc-linux-gnu/arm-none-eabi/binutils-bin/2.46.0/ld: (mbedtls_block_cipher_encrypt): Unknown destination type (ARM/Thumb) in CMakeFiles/PROJECT/opt/raspberrypi/pico-sdk/lib/mbedtls/library/gcm.c.o

My mbedtls_config file looks like this:

#ifndef _MBEDTLS_CONFIG_H
#define _MBEDTLS_CONFIG_H

#if LIB_PICO_SHA256
// Enable hardware acceleration
#define MBEDTLS_SHA256_ALT
#define MBEDTLS_MD_CAN_SHA256
#else
#define MBEDTLS_SHA256_C
#endif

// KDF
#define MBEDTLS_MD_C
#define MBEDTLS_HKDF_C

// AES GCM
#define MBEDTLS_AES_C
#define MBEDTLS_GCM_C

#endif

I added #define MBEDTLS_MD_CAN_SHA256 since otherwise, some header check told me that preconditions were not met.

Adding this line to my own CMakeLists.txt file fixed it:

add_executable(${CMAKE_PROJECT_NAME}
    ${PICO_SDK_PATH}/lib/mbedtls/library/block_cipher.c
   .... other sources

Thus, I assume the file is not referenced in pico_mbedtls by accident

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions