[nrf528xx] update nrf security (#4773)

- enabled new functionalities in nrf_security module
- updated mbedtls config file for nrf52833 and nrf52840
This commit is contained in:
Piotr Koziar
2020-04-03 07:59:58 -07:00
committed by GitHub
parent 74ff650cf1
commit dd02c9faa4
13 changed files with 215 additions and 9 deletions
@@ -310,8 +310,8 @@
//#define MBEDTLS_BLOWFISH_ALT
//#define MBEDTLS_CAMELLIA_ALT
#define MBEDTLS_CCM_ALT
/* #undef MBEDTLS_CHACHA20_ALT */
/* #undef MBEDTLS_CHACHAPOLY_ALT */
#define MBEDTLS_CHACHA20_ALT
#define MBEDTLS_CHACHAPOLY_ALT
#define MBEDTLS_CMAC_ALT
//#define MBEDTLS_DES_ALT
#define MBEDTLS_DHM_ALT
@@ -321,11 +321,11 @@
//#define MBEDTLS_MD2_ALT
//#define MBEDTLS_MD4_ALT
//#define MBEDTLS_MD5_ALT
/* #undef MBEDTLS_POLY1305_ALT */
#define MBEDTLS_POLY1305_ALT
//#define MBEDTLS_RIPEMD160_ALT
#define MBEDTLS_ECP_ALT
/* #undef MBEDTLS_RSA_ALT */
/* #undef MBEDTLS_SHA1_ALT */
#define MBEDTLS_SHA1_ALT
#define MBEDTLS_SHA256_ALT
//#define MBEDTLS_SHA512_ALT
//#define MBEDTLS_XTEA_ALT
@@ -1987,7 +1987,7 @@
*
* Module: library/chacha20.c
*/
/* #undef MBEDTLS_CHACHA20_C */
#define MBEDTLS_CHACHA20_C
/**
* \def MBEDTLS_CHACHAPOLY_C
@@ -1998,7 +1998,7 @@
*
* This module requires: MBEDTLS_CHACHA20_C, MBEDTLS_POLY1305_C
*/
/* #undef MBEDTLS_CHACHAPOLY_C */
#define MBEDTLS_CHACHAPOLY_C
/**
* \def MBEDTLS_CIPHER_C
@@ -2563,7 +2563,7 @@
* Module: library/poly1305.c
* Caller: library/chachapoly.c
*/
/* #undef MBEDTLS_POLY1305_C */
#define MBEDTLS_POLY1305_C
/**
* \def MBEDTLS_RIPEMD160_C
@@ -2615,7 +2615,7 @@
* on it, and considering stronger message digests instead.
*
*/
/* #undef MBEDTLS_SHA1_C */
#define MBEDTLS_SHA1_C
/**
* \def MBEDTLS_SHA256_C
@@ -2647,7 +2647,7 @@
*
* This module adds support for SHA-384 and SHA-512.
*/
/* #undef MBEDTLS_SHA512_C */
#define MBEDTLS_SHA512_C
/**
* \def MBEDTLS_SSL_CACHE_C
@@ -3139,6 +3139,8 @@ it is (2^48 - 1), our restriction is : (int - 0xFFFF - 0xF).*/
#define CONFIG_CC310_MBEDTLS_AES_C
#define CONFIG_CC310_MBEDTLS_C
#define CONFIG_CC310_MBEDTLS_CCM_C
#define CONFIG_CC310_MBEDTLS_CHACHA20_C
#define CONFIG_CC310_MBEDTLS_CHACHAPOLY_C
#define CONFIG_CC310_MBEDTLS_CIPHER_MODE_C
#define CONFIG_CC310_MBEDTLS_CMAC_C
#define CONFIG_CC310_MBEDTLS_DHM_C
@@ -3146,6 +3148,8 @@ it is (2^48 - 1), our restriction is : (int - 0xFFFF - 0xF).*/
#define CONFIG_CC310_MBEDTLS_ECDSA_C
#define CONFIG_CC310_MBEDTLS_ECJPAKE_C
#define CONFIG_CC310_MBEDTLS_ECP_C
#define CONFIG_CC310_MBEDTLS_POLY1305_C
#define CONFIG_CC310_MBEDTLS_SHA1_C
#define CONFIG_CC310_MBEDTLS_SHA256_C
#define CONFIG_GLUE_MBEDTLS_AES_C
#define CONFIG_GLUE_MBEDTLS_C
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause OR Arms non-OSI source license
*/
#ifndef MBEDTLS_CHACHA20_ALT_H
#define MBEDTLS_CHACHA20_ALT_H
#if defined(MBEDTLS_CONFIG_FILE)
#include MBEDTLS_CONFIG_FILE
#endif
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
/************************ Defines ******************************/
/*! The size of the ChaCha user-context in words. */
#define MBEDTLS_CHACHA_USER_CTX_SIZE_IN_WORDS 17
/*! The size of the ChaCha block in Bytes. */
#define MBEDTLS_CHACHA_BLOCK_SIZE_BYTES 64
/*! The size of the ChaCha block in Bytes. As defined in rfc7539 */
#define MBEDTLS_CHACHA_NONCE_SIZE_BYTES 12
/*! The size of the ChaCha key in Bytes. */
#define MBEDTLS_CHACHA_KEY_SIZE_BYTES 32
/*! Internal type to identify 12 byte nonce */
#define MBEDTLS_CHACHA_NONCE_SIZE_12BYTE_TYPE 1
/*! The definition of the 12-Byte array of the nonce buffer. */
typedef uint8_t mbedtls_chacha_nonce[MBEDTLS_CHACHA_NONCE_SIZE_BYTES];
/*! The definition of the key buffer of the ChaCha engine. */
typedef uint8_t mbedtls_chacha_key[MBEDTLS_CHACHA_KEY_SIZE_BYTES];
#if defined(MBEDTLS_CHACHA20_ALT)
typedef struct
{
uint32_t buf[MBEDTLS_CHACHA_USER_CTX_SIZE_IN_WORDS];
}
mbedtls_chacha20_context;
#endif
#ifdef __cplusplus
}
#endif
#endif /* MBEDTLS_CHACHA20_ALT_H */
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause OR Arms non-OSI source license
*/
#ifndef MBEDTLS_CHACHAPOLY_ALT_H
#define MBEDTLS_CHACHAPOLY_ALT_H
#if defined(MBEDTLS_CONFIG_FILE)
#include MBEDTLS_CONFIG_FILE
#endif
#ifdef __cplusplus
extern "C"
{
#endif
/************************ Defines ******************************/
#if defined(MBEDTLS_CHACHAPOLY_ALT)
#define MBEDTLS_CHACHAPOLY_KEY_SIZE_BYTES 32
typedef struct mbedtls_chachapoly_context
{
unsigned char key[MBEDTLS_CHACHAPOLY_KEY_SIZE_BYTES];
}
mbedtls_chachapoly_context;
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif /* MBEDTLS_CHACHAPOLY_ALT_H */
@@ -0,0 +1,59 @@
/*
* Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause OR Arms non-OSI source license
*/
#ifndef MBEDTLS_POLY1305_ALT_H
#define MBEDTLS_POLY1305_ALT_H
#if defined(MBEDTLS_CONFIG_FILE)
#include MBEDTLS_CONFIG_FILE
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#if defined(MBEDTLS_POLY1305_ALT)
/************************ defines ****************************/
/*! The size of the POLY key in words. */
#define MBEDTLS_POLY_KEY_SIZE_WORDS 8
/*! The size of the POLY key in bytes. */
#define MBEDTLS_POLY_KEY_SIZE_BYTES 32
/*! The size of the POLY MAC in words. */
#define MBEDTLS_POLY_MAC_SIZE_WORDS 4
/*! The size of the POLY MAC in bytes. */
#define MBEDTLS_POLY_MAC_SIZE_BYTES 16
/************************ Typedefs ****************************/
/*! The definition of the ChaCha-MAC buffer. */
typedef uint32_t mbedtls_poly_mac[MBEDTLS_POLY_MAC_SIZE_WORDS];
/*! The definition of the ChaCha-key buffer. */
typedef uint32_t mbedtls_poly_key[MBEDTLS_POLY_KEY_SIZE_WORDS];
typedef struct mbedtls_poly1305_context
{
uint32_t r[4]; /** The value for 'r' (low 128 bits of the key). */
uint32_t s[4]; /** The value for 's' (high 128 bits of the key). */
uint32_t acc[5]; /** The accumulator number. */
uint8_t queue[16]; /** The current partial block of data. */
size_t queue_len; /** The number of bytes stored in 'queue'. */
}
mbedtls_poly1305_context;
#endif
#ifdef __cplusplus
}
#endif
#endif /* MBEDTLS_POLY1305_ALT_H */
@@ -0,0 +1,40 @@
/*
* Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause OR Arms non-OSI source license
*/
#ifndef MBEDTLS_SHA1_ALT_H
#define MBEDTLS_SHA1_ALT_H
#include <stddef.h>
#include <stdint.h>
#if defined (MBEDTLS_CONFIG_FILE)
#include MBEDTLS_CONFIG_FILE
#endif
#if defined (MBEDTLS_SHA1_ALT)
#define CC_HASH_USER_CTX_SIZE_IN_WORDS 60
#define MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED -0x0035 /**< SHA-1 hardware accelerator failed */
#ifdef __cplusplus
extern "C" {
#endif
/**
* \brief SHA-1 context structure
*/
typedef struct mbedtls_sha1_context {
/*! Internal buffer */
uint32_t buff[CC_HASH_USER_CTX_SIZE_IN_WORDS]; // defined in cc_hash_defs_proj.h
} mbedtls_sha1_context;
#ifdef __cplusplus
}
#endif
#endif /* MBEDTLS_SHA1_ALT */
#endif /* MBEDTLS_SHA1_ALT_H */