Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add all headers in mbtedtls support include directory #200

Merged
merged 3 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions platform/security/sl_component/sl_mbedtls_support/inc/aes_alt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*******************************************************************************
* @file
* @brief Accelerated mbed TLS AES block cipher
*******************************************************************************
* # License
* <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
*******************************************************************************
*
* SPDX-License-Identifier: Zlib
*
* The licensor of this software is Silicon Laboratories Inc.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
******************************************************************************/
#ifndef AES_ALT_H
#define AES_ALT_H

/*******************************************************************************
* \addtogroup sl_crypto
* \{
******************************************************************************/

/*******************************************************************************
* \addtogroup sl_crypto_aes Accelerated AES Block Cipher
* \brief Accelerated AES block cipher for the mbed TLS API using the AES,
*CRYPTO, CRYPTOACC or SE peripheral
*
* \{
******************************************************************************/

#if defined(MBEDTLS_AES_ALT)
#ifdef __cplusplus
extern "C" {
#endif

/**
* \brief AES context structure
*/
typedef struct {
unsigned int keybits; /*!< size of key */
unsigned char key[32]; /*!< AES key 128, 192 or 256 bits */
} mbedtls_aes_context;

#if defined(MBEDTLS_CIPHER_MODE_XTS)
/**
* \brief The AES XTS context-type definition.
*/
typedef struct mbedtls_aes_xts_context {
mbedtls_aes_context crypt; /*!< The AES context to use for AES block
encryption or decryption. */
mbedtls_aes_context tweak; /*!< The AES context used for tweak
computation. */
} mbedtls_aes_xts_context;
#endif /* MBEDTLS_CIPHER_MODE_XTS */

#ifdef __cplusplus
}
#endif

#endif /* MBEDTLS_AES_ALT */

/** \} (end addtogroup sl_crypto_aes) */
/** \} (end addtogroup sl_crypto) */

#endif /* AES_ALT_H */
69 changes: 69 additions & 0 deletions platform/security/sl_component/sl_mbedtls_support/inc/ccm_alt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*******************************************************************************
* @file
* @brief Accelerated mbed TLS AES-CCM AEAD cipher
*******************************************************************************
* # License
* <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
*******************************************************************************
*
* SPDX-License-Identifier: Zlib
*
* The licensor of this software is Silicon Laboratories Inc.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
******************************************************************************/
#ifndef CCM_ALT_H
#define CCM_ALT_H

/*******************************************************************************
* \addtogroup sl_crypto
* \{
******************************************************************************/

/*******************************************************************************
* \addtogroup sl_crypto_ccm Accelerated AES-CCM AEAD Cipher
* \brief Accelerated AES-CCM AEAD cipher for the mbed TLS API using the
*CRYPTOACC or SE peripheral
*
* \{
******************************************************************************/
#if defined(MBEDTLS_CCM_ALT)

#ifdef __cplusplus
extern "C" {
#endif

/**
* \brief The CCM context-type definition. The CCM context is passed
* to the APIs called.
*/
typedef struct {
unsigned char key[32]; /*!< The key in use. */
unsigned int keybits;
} mbedtls_ccm_context;

#ifdef __cplusplus
}
#endif

#endif /* MBEDTLS_CCM_ALT */

/** \} (end addtogroup sl_crypto_ccm) */
/** \} (end addtogroup sl_crypto) */

#endif /* CCM_ALT_H */
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*******************************************************************************
* @file
* @brief Accelerated mbed TLS AES-CMAC cipher
*******************************************************************************
* # License
* <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
*******************************************************************************
*
* SPDX-License-Identifier: Zlib
*
* The licensor of this software is Silicon Laboratories Inc.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
******************************************************************************/
#ifndef CMAC_ALT_H
#define CMAC_ALT_H

/*******************************************************************************
* \addtogroup sl_crypto
* \{
******************************************************************************/

/*******************************************************************************
* \addtogroup sl_crypto_cmac Accelerated AES-CMAC Cipher
* \brief Accelerated AES-CMAC cipher for the mbed TLS API using the CRYPTOACC
*or SE peripheral. This implementation builds on the PSA Crypto drivers
* (\ref sl_psa_drivers).
*
* \{
******************************************************************************/
#if defined(MBEDTLS_CMAC_ALT)

#ifdef __cplusplus
extern "C" {
#endif

#include "em_device.h"

#if defined(SEMAILBOX_PRESENT)
#include "sli_se_transparent_types.h"
#define SL_MAC_OPERATION_CTX_TYPE sli_se_transparent_mac_operation_t
#elif defined(CRYPTO_PRESENT)
#include "sli_crypto_transparent_types.h"
#define SL_MAC_OPERATION_CTX_TYPE sli_crypto_transparent_mac_operation_t
#elif defined(CRYPTOACC_PRESENT)
#include "sli_cryptoacc_transparent_types.h"
#define SL_MAC_OPERATION_CTX_TYPE sli_cryptoacc_transparent_mac_operation_t
#endif

struct mbedtls_cmac_context_t {
SL_MAC_OPERATION_CTX_TYPE ctx;
};

#ifdef __cplusplus
}
#endif

#endif /* MBEDTLS_CMAC_ALT */

/** \} (end addtogroup sl_crypto_cmac) */
/** \} (end addtogroup sl_crypto) */

#endif /* CMAC_ALT_H */
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*******************************************************************************
* @file
* @brief Accelerated mbed TLS Elliptic Curve J-PAKE
*******************************************************************************
* # License
* <b>Copyright 2020 Silicon Laboratories Inc. www.silabs.com</b>
*******************************************************************************
*
* SPDX-License-Identifier: Zlib
*
* The licensor of this software is Silicon Laboratories Inc.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*
******************************************************************************/
#ifndef ECJPAKE_ALT_H
#define ECJPAKE_ALT_H

/*******************************************************************************
* \addtogroup sl_crypto
* \{
******************************************************************************/

/*******************************************************************************
* \addtogroup sl_crypto_jpake Accelerated Elliptic Curve J-PAKE
* \brief Accelerated Elliptic Curve J-PAKE for the mbed TLS API using the SE
* peripheral
*
* \{
******************************************************************************/

#if defined(MBEDTLS_ECJPAKE_ALT)

#ifdef __cplusplus
extern "C" {
#endif

/**
* EC J-PAKE context structure.
*
* J-PAKE is a symmetric protocol, except for the identifiers used in
* Zero-Knowledge Proofs, and the serialization of the second message
* (KeyExchange) as defined by the Thread spec.
*
* In order to benefit from this symmetry, we choose a different naming
* convetion from the Thread v1.0 spec. Correspondance is indicated in the
* description as a pair C: client name, S: server name
*/
typedef struct {
uint32_t curve_flags; /**< Curve flags to use */
mbedtls_ecjpake_role role; /**< Are we client or server? */
int point_format; /**< Format for point export */

char pwd[33]; /**< J-PAKE password */
size_t pwd_len; /**< J-PAKE password length */

uint8_t r[32]; /**< Random scalar for exchange */
uint8_t Xm1[64]; /**< Our point 1 (round 1) */
uint8_t Xm2[64]; /**< Our point 2 (round 1) */
uint8_t Xp1[64]; /**< Their point 1 (round 1) */
uint8_t Xp2[64]; /**< Their point 2 (round 1) */
uint8_t Xp[64]; /**< Their point (round 2) */
} mbedtls_ecjpake_context;

#ifdef __cplusplus
}
#endif

#endif /* MBEDTLS_ECJPAKE_ALT */

/** \} (end addtogroup sl_crypto_jpake) */
/** \} (end addtogroup sl_crypto) */

#endif /* ECJPAKE_ALT_H */
Loading
Loading