Skip to content

Commit b87e98c

Browse files
authored
Merge pull request #5904 from ithinuel/add-wise-1510
add support for STM32L443RC & WISE-1510
2 parents fff6c75 + e6b19d8 commit b87e98c

File tree

23 files changed

+19417
-6
lines changed

23 files changed

+19417
-6
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* mbedtls_device.h
3+
*******************************************************************************
4+
* Copyright (c) 2017, STMicroelectronics
5+
* SPDX-License-Identifier: Apache-2.0
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
8+
* not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*
19+
*/
20+
#ifndef MBEDTLS_DEVICE_H
21+
#define MBEDTLS_DEVICE_H
22+
23+
#define MBEDTLS_AES_ALT
24+
25+
#endif /* MBEDTLS_DEVICE_H */

features/mbedtls/targets/TARGET_STM/aes_alt.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#if defined(MBEDTLS_AES_ALT)
2525

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

6666
ctx->hcryp_aes.Init.pKey = ctx->aes_key;
67-
#if defined (TARGET_STM32L486xG)
67+
#if defined (TARGET_STM32L486xG) || defined (TARGET_STM32L443xC)
6868
ctx->hcryp_aes.Init.KeyWriteFlag = CRYP_KEY_WRITE_ENABLE;
6969
#endif
7070
if (HAL_CRYP_Init(&ctx->hcryp_aes) == HAL_ERROR)
@@ -149,7 +149,7 @@ int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
149149
}
150150

151151
#if defined(MBEDTLS_CIPHER_MODE_CBC)
152-
#if defined (TARGET_STM32L486xG)
152+
#if defined (TARGET_STM32L486xG) || defined (TARGET_STM32L443xC)
153153
static int st_cbc_restore_context(mbedtls_aes_context *ctx){
154154
uint32_t tickstart;
155155
tickstart = HAL_GetTick();
@@ -194,7 +194,7 @@ static int st_cbc_restore_context(mbedtls_aes_context *ctx){
194194
return 0;
195195
}
196196

197-
#endif /* TARGET_STM32L486xG */
197+
#endif /* TARGET_STM32L486xG || TARGET_STM32L443xC */
198198

199199
int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
200200
int mode,
@@ -211,7 +211,7 @@ int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
211211
if (st_cbc_restore_context(ctx) != 0)
212212
return (ST_ERR_AES_BUSY);
213213

214-
#if defined (TARGET_STM32L486xG)
214+
#if defined (TARGET_STM32L486xG) || defined (TARGET_STM32L443xC)
215215

216216
if( mode == MBEDTLS_AES_DECRYPT ) {
217217
if (st_hal_cryp_cbc(ctx, CRYP_ALGOMODE_KEYDERIVATION_DECRYPT, length, iv, (uint8_t *)input, (uint8_t *)output) != 0)
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2015, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
#ifndef MBED_PERIPHERALNAMES_H
31+
#define MBED_PERIPHERALNAMES_H
32+
33+
#include "cmsis.h"
34+
35+
#ifdef __cplusplus
36+
extern "C" {
37+
#endif
38+
39+
typedef enum {
40+
ADC_1 = (int)ADC1_BASE,
41+
} ADCName;
42+
43+
typedef enum {
44+
DAC_1 = (int)DAC_BASE
45+
} DACName;
46+
47+
typedef enum {
48+
UART_1 = (int)USART1_BASE,
49+
UART_2 = (int)USART2_BASE,
50+
UART_3 = (int)USART3_BASE,
51+
LPUART_1 = (int)LPUART1_BASE
52+
} UARTName;
53+
54+
typedef enum {
55+
SPI_1 = (int)SPI1_BASE,
56+
SPI_2 = (int)SPI2_BASE,
57+
SPI_3 = (int)SPI3_BASE
58+
} SPIName;
59+
60+
typedef enum {
61+
I2C_1 = (int)I2C1_BASE,
62+
I2C_2 = (int)I2C2_BASE,
63+
I2C_3 = (int)I2C3_BASE
64+
} I2CName;
65+
66+
typedef enum {
67+
PWM_1 = (int)TIM1_BASE,
68+
PWM_2 = (int)TIM2_BASE,
69+
PWM_6 = (int)TIM6_BASE,
70+
PWM_7 = (int)TIM7_BASE,
71+
PWM_15 = (int)TIM15_BASE,
72+
PWM_16 = (int)TIM16_BASE,
73+
} PWMName;
74+
75+
typedef enum {
76+
CAN_1 = (int)CAN1_BASE
77+
} CANName;
78+
79+
#ifdef __cplusplus
80+
}
81+
#endif
82+
83+
#endif

0 commit comments

Comments
 (0)