Skip to content

add support for STM32L443RC & WISE-1510 #5904

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

Merged
merged 1 commit into from
Jan 30, 2018
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* mbedtls_device.h
*******************************************************************************
* Copyright (c) 2017, STMicroelectronics
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef MBEDTLS_DEVICE_H
#define MBEDTLS_DEVICE_H

#define MBEDTLS_AES_ALT

#endif /* MBEDTLS_DEVICE_H */
12 changes: 6 additions & 6 deletions features/mbedtls/targets/TARGET_STM/aes_alt.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#if defined(MBEDTLS_AES_ALT)

#if defined(TARGET_STM32L486xG)
#if defined(TARGET_STM32L486xG) || defined (TARGET_STM32L443xC)
//the following defines are provided to maintain compatibility between STM32 families
#define __HAL_RCC_CRYP_CLK_ENABLE __HAL_RCC_AES_CLK_ENABLE
#define __HAL_RCC_CRYP_FORCE_RESET __HAL_RCC_AES_FORCE_RESET
Expand All @@ -39,7 +39,7 @@ static int aes_set_key( mbedtls_aes_context *ctx, const unsigned char *key, unsi
memcpy(ctx->aes_key, key, 16);
break;
case 192:
#if defined (TARGET_STM32L486xG)
#if defined (TARGET_STM32L486xG) || defined (TARGET_STM32L443xC)
return(MBEDTLS_ERR_AES_INVALID_KEY_LENGTH);
#else
ctx->hcryp_aes.Init.KeySize = CRYP_KEYSIZE_192B;
Expand All @@ -64,7 +64,7 @@ static int aes_set_key( mbedtls_aes_context *ctx, const unsigned char *key, unsi
__HAL_RCC_CRYP_CLK_ENABLE();

ctx->hcryp_aes.Init.pKey = ctx->aes_key;
#if defined (TARGET_STM32L486xG)
#if defined (TARGET_STM32L486xG) || defined (TARGET_STM32L443xC)
ctx->hcryp_aes.Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
#endif
if (HAL_CRYP_Init(&ctx->hcryp_aes) == HAL_ERROR)
Expand Down Expand Up @@ -149,7 +149,7 @@ int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
}

#if defined(MBEDTLS_CIPHER_MODE_CBC)
#if defined (TARGET_STM32L486xG)
#if defined (TARGET_STM32L486xG) || defined (TARGET_STM32L443xC)
static int st_cbc_restore_context(mbedtls_aes_context *ctx){
uint32_t tickstart;
tickstart = HAL_GetTick();
Expand Down Expand Up @@ -194,7 +194,7 @@ static int st_cbc_restore_context(mbedtls_aes_context *ctx){
return 0;
}

#endif /* TARGET_STM32L486xG */
#endif /* TARGET_STM32L486xG || TARGET_STM32L443xC */

int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
int mode,
Expand All @@ -211,7 +211,7 @@ int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
if (st_cbc_restore_context(ctx) != 0)
return (ST_ERR_AES_BUSY);

#if defined (TARGET_STM32L486xG)
#if defined (TARGET_STM32L486xG) || defined (TARGET_STM32L443xC)

if( mode == MBEDTLS_AES_DECRYPT ) {
if (st_hal_cryp_cbc(ctx, CRYP_ALGOMODE_KEYDERIVATION_DECRYPT, length, iv, (uint8_t *)input, (uint8_t *)output) != 0)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/* mbed Microcontroller Library
*******************************************************************************
* Copyright (c) 2015, STMicroelectronics
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************
*/
#ifndef MBED_PERIPHERALNAMES_H
#define MBED_PERIPHERALNAMES_H

#include "cmsis.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
ADC_1 = (int)ADC1_BASE,
} ADCName;

typedef enum {
DAC_1 = (int)DAC_BASE
} DACName;

typedef enum {
UART_1 = (int)USART1_BASE,
UART_2 = (int)USART2_BASE,
UART_3 = (int)USART3_BASE,
LPUART_1 = (int)LPUART1_BASE
} UARTName;

typedef enum {
SPI_1 = (int)SPI1_BASE,
SPI_2 = (int)SPI2_BASE,
SPI_3 = (int)SPI3_BASE
} SPIName;

typedef enum {
I2C_1 = (int)I2C1_BASE,
I2C_2 = (int)I2C2_BASE,
I2C_3 = (int)I2C3_BASE
} I2CName;

typedef enum {
PWM_1 = (int)TIM1_BASE,
PWM_2 = (int)TIM2_BASE,
PWM_6 = (int)TIM6_BASE,
PWM_7 = (int)TIM7_BASE,
PWM_15 = (int)TIM15_BASE,
PWM_16 = (int)TIM16_BASE,
} PWMName;

typedef enum {
CAN_1 = (int)CAN1_BASE
} CANName;

#ifdef __cplusplus
}
#endif

#endif
Loading