Skip to content

Commit

Permalink
core: ltc: Fix building with mbedtls
Browse files Browse the repository at this point in the history
Fix building OP-TEE with:

make PLATFORM=vexpress \
     PLATFORM_FLAVOR=juno \
     CFG_CRYPTOLIB_NAME=mbedtls \
     CFG_CRYPTOLIB_DIR=lib/libmbedtls
...
core/lib/libtomcrypt/aes_accel.c: In function ‘aes_ctr_encrypt_nblocks’:
core/lib/libtomcrypt/aes_accel.c:182:21: error: ‘CTR_COUNTER_LITTLE_ENDIAN’ undeclared (first use in this function)
  182 |         if (mode == CTR_COUNTER_LITTLE_ENDIAN) {

Signed-off-by: Jacob Kroon <jacobkr@axis.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
  • Loading branch information
Jacob Kroon authored and jforissier committed May 30, 2024
1 parent 5b6f4be commit f6be0e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/lib/libtomcrypt/aes_accel.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ static int aes_cbc_decrypt_nblocks(const unsigned char *ct, unsigned char *pt,
return CRYPT_OK;
}

#ifdef LTC_CTR_MODE
static int aes_ctr_encrypt_nblocks(const unsigned char *pt, unsigned char *ct,
unsigned long blocks, unsigned char *IV,
int mode, symmetric_key *skey)
Expand All @@ -189,6 +190,7 @@ static int aes_ctr_encrypt_nblocks(const unsigned char *pt, unsigned char *ct,

return CRYPT_OK;
}
#endif

static int aes_xts_encrypt_nblocks(const unsigned char *pt, unsigned char *ct,
unsigned long blocks, unsigned char *tweak,
Expand Down Expand Up @@ -245,7 +247,9 @@ const struct ltc_cipher_descriptor aes_desc = {
.accel_ecb_decrypt = aes_ecb_decrypt_nblocks,
.accel_cbc_encrypt = aes_cbc_encrypt_nblocks,
.accel_cbc_decrypt = aes_cbc_decrypt_nblocks,
#ifdef LTC_CTR_MODE
.accel_ctr_encrypt = aes_ctr_encrypt_nblocks,
#endif
.accel_xts_encrypt = aes_xts_encrypt_nblocks,
.accel_xts_decrypt = aes_xts_decrypt_nblocks,
};

0 comments on commit f6be0e1

Please sign in to comment.