Skip to content

Commit

Permalink
[review] core: move crypto_authenc_*() from LTC
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
  • Loading branch information
jenswi-linaro committed Nov 13, 2017
1 parent 54322f6 commit cabda6d
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions core/lib/libtomcrypt/src/tee_ltc_provider.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,21 @@
*/

#include <assert.h>
#include <crypto/crypto.h>
#include <crypto/aes-gcm.h>
#include <crypto/aes-ccm.h>
#include <tee/tee_cryp_utl.h>

#include <tomcrypt.h>
#include <crypto/aes-gcm.h>
#include <crypto/crypto.h>
#include <kernel/panic.h>
#include <mpalib.h>
#include <stdlib.h>
#include <string_ext.h>
#include <string.h>
#include <utee_defines.h>
#include <trace.h>
#include <tee_api_types.h>
#include <string_ext.h>
#include <util.h>
#include <kernel/panic.h>
#include <tee/tee_cryp_utl.h>
#include <tomcrypt.h>
#include "tomcrypt_mpa.h"
#include <trace.h>
#include <utee_defines.h>
#include <util.h>

#if defined(CFG_WITH_VFP)
#include <tomcrypt_arm_neon.h>
Expand Down Expand Up @@ -2525,7 +2524,6 @@ TEE_Result crypto_mac_final(void *ctx, uint32_t algo, uint8_t *digest,
#define TEE_CCM_NONCE_MAX_LENGTH 13
#define TEE_CCM_TAG_MAX_LENGTH 16
#define TEE_GCM_TAG_MAX_LENGTH 16
#define TEE_xCM_TAG_MAX_LENGTH 16

#if defined(CFG_CRYPTO_CCM)
struct tee_ccm_state {
Expand Down Expand Up @@ -2657,12 +2655,12 @@ TEE_Result crypto_aes_ccm_dec_final(void *ctx, const uint8_t *src_data,
TEE_Result res = TEE_ERROR_BAD_STATE;
struct tee_ccm_state *ccm = ctx;
int ltc_res;
uint8_t dst_tag[TEE_xCM_TAG_MAX_LENGTH];
uint8_t dst_tag[TEE_CCM_TAG_MAX_LENGTH];
unsigned long ltc_tag_len = tag_len;

if (tag_len == 0)
return TEE_ERROR_SHORT_BUFFER;
if (tag_len > TEE_xCM_TAG_MAX_LENGTH)
if (tag_len > TEE_CCM_TAG_MAX_LENGTH)
return TEE_ERROR_BAD_STATE;

/* Process the last buffer, if any */
Expand Down Expand Up @@ -2815,12 +2813,12 @@ TEE_Result crypto_aes_gcm_dec_final(void *ctx, const uint8_t *src_data,
TEE_Result res = TEE_ERROR_BAD_STATE;
struct tee_gcm_state *gcm = ctx;
int ltc_res;
uint8_t dst_tag[TEE_xCM_TAG_MAX_LENGTH];
uint8_t dst_tag[TEE_GCM_TAG_MAX_LENGTH];
unsigned long ltc_tag_len = tag_len;

if (tag_len == 0)
return TEE_ERROR_SHORT_BUFFER;
if (tag_len > TEE_xCM_TAG_MAX_LENGTH)
if (tag_len > TEE_GCM_TAG_MAX_LENGTH)
return TEE_ERROR_BAD_STATE;

/* Process the last buffer, if any */
Expand Down

0 comments on commit cabda6d

Please sign in to comment.