mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 20:54:41 +02:00
Fixes to include path for NXP ksdk_port. Fixes for time USER/OVERRIDES so their #ifdef's are checked first. Fix to initialize LTC via new "ksdk_port_init" function. Cleanup of the ksdk_port.c for formatting, macros, statics and line length. Cleanup of the AES code for key size. Cleanup of the wolfCrypt sha.c for readability. Added support for the KSDK bare metal drivers to the IDE Rowley CrossWorks example. Updated the settings.h to allow for overrides in Freescale section. Updated README with info for using LTC.
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
<!DOCTYPE Board_Memory_Definition_File>
|
||||
<Root name="Kinetis">
|
||||
<MemorySegment size="0x80000" access="ReadOnly" start="0x00000000" name="FLASH" />
|
||||
<MemorySegment size="0x80000/2" access="Read/Write" start="0x00000000" name="FLASH_L" />
|
||||
<MemorySegment size="0x80000/2" access="Read/Write" start="0x00000000+0x80000/2" name="FLASH_H" />
|
||||
<MemorySegment size="0x20000" access="Read/Write" start="0x1fff0000" name="SRAM" />
|
||||
<MemorySegment size="0x10000" access="Read/Write" start="0x1fff0000" name="SRAM_L" />
|
||||
<MemorySegment size="0x10000" access="Read/Write" start="0x20000000" name="SRAM_H" />
|
||||
<MemorySegment size="0x100000" access="Read/Write" start="0x40000000" name="PERIPHERALS" />
|
||||
<MemorySegment size="0x100000" access="Read/Write" start="0xE0000000" name="PPB" />
|
||||
</Root>
|
@@ -34,6 +34,14 @@ To enable Freescale MMCAU:
|
||||
3. Enable the `FREESCALE_MMCAU` define in `user_settings.h` and make sure its value is `1`.
|
||||
4. Add the `lib_mmcau.a` file to `Source Files` in the application project.
|
||||
|
||||
To enable the NXP LTC:
|
||||
|
||||
1. [Download the NXP KSDK 2.0](https://nxp.flexnetoperations.com/control/frse/download?agree=Accept&element=7353807)
|
||||
2. Copy the following folders into IDE/ROWLEY-CROSSWORKS-ARM: drivers, mmcau_2.0.0 and CMSIS.
|
||||
3. Copy the following files into IDE/ROWLEY-CROSSWORKS-ARM: clock_config.c, clock_config.h, fsl_debug_console.c, fsl_debug_console.h, fsl_device_registers.h, system_MK82F25615.c, system_MK82F25615.h, MK82F25615.h and MK82F25615_features.h.
|
||||
4. Open the wolfssl_ltc.hzp CrossWorks project
|
||||
5. Build and run
|
||||
|
||||
# Project Files
|
||||
|
||||
* `arm_startup.c`: Handles startup from `reset_handler`. Disabled watchdog, initializes sections, initializes heap, starts harware and starts main.
|
||||
|
@@ -84,6 +84,8 @@ void reset_handler(void)
|
||||
// Vector Exception/Interrupt Handlers
|
||||
static void Default_Handler(void)
|
||||
{
|
||||
/* If we get here then need to implement real IRQ handler */
|
||||
while(1);
|
||||
}
|
||||
|
||||
void HardFault_HandlerC( uint32_t *hardfault_args )
|
||||
@@ -195,5 +197,114 @@ const vector_entry vectors[] __attribute__ ((section(".vectors"),used)) =
|
||||
Default_Handler, // 0x0000_0038 14 - ARM core Pendable request for system service (PendableSrvReq)
|
||||
Default_Handler, // 0x0000_003C 15 - ARM core System tick timer (SysTick)
|
||||
|
||||
#ifdef CPU_MK82FN256VLL15
|
||||
// Add specific driver interrupt handlers below
|
||||
Default_Handler, /* DMA0_DMA16_IRQn = 0, /**< DMA channel 0,16 transfer complete */
|
||||
Default_Handler, /* DMA1_DMA17_IRQn = 1, /**< DMA channel 1,17 transfer complete */
|
||||
Default_Handler, /* DMA2_DMA18_IRQn = 2, /**< DMA channel 2,18 transfer complete */
|
||||
Default_Handler, /* DMA3_DMA19_IRQn = 3, /**< DMA channel 3,19 transfer complete */
|
||||
Default_Handler, /* DMA4_DMA20_IRQn = 4, /**< DMA channel 4,20 transfer complete */
|
||||
Default_Handler, /* DMA5_DMA21_IRQn = 5, /**< DMA channel 5,21 transfer complete */
|
||||
Default_Handler, /* DMA6_DMA22_IRQn = 6, /**< DMA channel 6,22 transfer complete */
|
||||
Default_Handler, /* DMA7_DMA23_IRQn = 7, /**< DMA channel 7,23 transfer complete */
|
||||
Default_Handler, /* DMA8_DMA24_IRQn = 8, /**< DMA channel 8,24 transfer complete */
|
||||
Default_Handler, /* DMA9_DMA25_IRQn = 9, /**< DMA channel 9,25 transfer complete */
|
||||
Default_Handler, /* DMA10_DMA26_IRQn = 10, /**< DMA channel 10,26 transfer complete */
|
||||
Default_Handler, /* DMA11_DMA27_IRQn = 11, /**< DMA channel 11,27 transfer complete */
|
||||
Default_Handler, /* DMA12_DMA28_IRQn = 12, /**< DMA channel 12,28 transfer complete */
|
||||
Default_Handler, /* DMA13_DMA29_IRQn = 13, /**< DMA channel 13,29 transfer complete */
|
||||
Default_Handler, /* DMA14_DMA30_IRQn = 14, /**< DMA channel 14,30 transfer complete */
|
||||
Default_Handler, /* DMA15_DMA31_IRQn = 15, /**< DMA channel 15,31 transfer complete */
|
||||
Default_Handler, /* DMA_Error_IRQn = 16, /**< DMA channel 0 - 31 error */
|
||||
Default_Handler, /* MCM_IRQn = 17, /**< MCM normal interrupt */
|
||||
Default_Handler, /* FTFA_IRQn = 18, /**< FTFA command complete */
|
||||
Default_Handler, /* Read_Collision_IRQn = 19, /**< FTFA read collision */
|
||||
Default_Handler, /* LVD_LVW_IRQn = 20, /**< PMC controller low-voltage detect, low-voltage warning */
|
||||
Default_Handler, /* LLWU_IRQn = 21, /**< Low leakage wakeup unit */
|
||||
Default_Handler, /* WDOG_EWM_IRQn = 22, /**< Single interrupt vector for WDOG and EWM */
|
||||
Default_Handler, /* TRNG0_IRQn = 23, /**< True randon number generator */
|
||||
Default_Handler, /* I2C0_IRQn = 24, /**< Inter-integrated circuit 0 */
|
||||
Default_Handler, /* I2C1_IRQn = 25, /**< Inter-integrated circuit 1 */
|
||||
Default_Handler, /* SPI0_IRQn = 26, /**< Serial peripheral Interface 0 */
|
||||
Default_Handler, /* SPI1_IRQn = 27, /**< Serial peripheral Interface 1 */
|
||||
Default_Handler, /* I2S0_Tx_IRQn = 28, /**< Integrated interchip sound 0 transmit interrupt */
|
||||
Default_Handler, /* I2S0_Rx_IRQn = 29, /**< Integrated interchip sound 0 receive interrupt */
|
||||
Default_Handler, /* LPUART0_IRQn = 30, /**< LPUART0 receive/transmit/error interrupt */
|
||||
Default_Handler, /* LPUART1_IRQn = 31, /**< LPUART1 receive/transmit/error interrupt */
|
||||
Default_Handler, /* LPUART2_IRQn = 32, /**< LPUART2 receive/transmit/error interrupt */
|
||||
Default_Handler, /* LPUART3_IRQn = 33, /**< LPUART3 receive/transmit/error interrupt */
|
||||
Default_Handler, /* LPUART4_IRQn = 34, /**< LPUART4 receive/transmit/error interrupt */
|
||||
Default_Handler, /* Reserved51_IRQn = 35, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved52_IRQn = 36, /**< Reserved interrupt */
|
||||
Default_Handler, /* EMVSIM0_IRQn = 37, /**< EMVSIM0 common interrupt */
|
||||
Default_Handler, /* EMVSIM1_IRQn = 38, /**< EMVSIM1 common interrupt */
|
||||
Default_Handler, /* ADC0_IRQn = 39, /**< Analog-to-digital converter 0 */
|
||||
Default_Handler, /* CMP0_IRQn = 40, /**< Comparator 0 */
|
||||
Default_Handler, /* CMP1_IRQn = 41, /**< Comparator 1 */
|
||||
Default_Handler, /* FTM0_IRQn = 42, /**< FlexTimer module 0 fault, overflow and channels interrupt */
|
||||
Default_Handler, /* FTM1_IRQn = 43, /**< FlexTimer module 1 fault, overflow and channels interrupt */
|
||||
Default_Handler, /* FTM2_IRQn = 44, /**< FlexTimer module 2 fault, overflow and channels interrupt */
|
||||
Default_Handler, /* CMT_IRQn = 45, /**< Carrier modulator transmitter */
|
||||
Default_Handler, /* RTC_IRQn = 46, /**< Real time clock */
|
||||
Default_Handler, /* RTC_Seconds_IRQn = 47, /**< Real time clock seconds */
|
||||
Default_Handler, /* PIT0CH0_IRQn = 48, /**< Periodic interrupt timer 0 channel 0 */
|
||||
Default_Handler, /* PIT0CH1_IRQn = 49, /**< Periodic interrupt timer 0 channel 1 */
|
||||
Default_Handler, /* PIT0CH2_IRQn = 50, /**< Periodic interrupt timer 0 channel 2 */
|
||||
Default_Handler, /* PIT0CH3_IRQn = 51, /**< Periodic interrupt timer 0 channel 3 */
|
||||
Default_Handler, /* PDB0_IRQn = 52, /**< Programmable delay block */
|
||||
Default_Handler, /* USB0_IRQn = 53, /**< USB OTG interrupt */
|
||||
Default_Handler, /* USBDCD_IRQn = 54, /**< USB charger detect */
|
||||
Default_Handler, /* Reserved71_IRQn = 55, /**< Reserved interrupt */
|
||||
Default_Handler, /* DAC0_IRQn = 56, /**< Digital-to-analog converter 0 */
|
||||
Default_Handler, /* MCG_IRQn = 57, /**< Multipurpose clock generator */
|
||||
Default_Handler, /* LPTMR0_LPTMR1_IRQn = 58, /**< Single interrupt vector for Low Power Timer 0 and 1 */
|
||||
Default_Handler, /* PORTA_IRQn = 59, /**< Port A pin detect interrupt */
|
||||
Default_Handler, /* PORTB_IRQn = 60, /**< Port B pin detect interrupt */
|
||||
Default_Handler, /* PORTC_IRQn = 61, /**< Port C pin detect interrupt */
|
||||
Default_Handler, /* PORTD_IRQn = 62, /**< Port D pin detect interrupt */
|
||||
Default_Handler, /* PORTE_IRQn = 63, /**< Port E pin detect interrupt */
|
||||
Default_Handler, /* SWI_IRQn = 64, /**< Software interrupt */
|
||||
Default_Handler, /* SPI2_IRQn = 65, /**< Serial peripheral Interface 2 */
|
||||
Default_Handler, /* Reserved82_IRQn = 66, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved83_IRQn = 67, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved84_IRQn = 68, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved85_IRQn = 69, /**< Reserved interrupt */
|
||||
Default_Handler, /* FLEXIO0_IRQn = 70, /**< FLEXIO0 */
|
||||
Default_Handler, /* FTM3_IRQn = 71, /**< FlexTimer module 3 fault, overflow and channels interrupt */
|
||||
Default_Handler, /* Reserved88_IRQn = 72, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved89_IRQn = 73, /**< Reserved interrupt */
|
||||
Default_Handler, /* I2C2_IRQn = 74, /**< Inter-integrated circuit 2 */
|
||||
Default_Handler, /* Reserved91_IRQn = 75, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved92_IRQn = 76, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved93_IRQn = 77, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved94_IRQn = 78, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved95_IRQn = 79, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved96_IRQn = 80, /**< Reserved interrupt */
|
||||
Default_Handler, /* SDHC_IRQn = 81, /**< Secured digital host controller */
|
||||
Default_Handler, /* Reserved98_IRQn = 82, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved99_IRQn = 83, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved100_IRQn = 84, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved101_IRQn = 85, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved102_IRQn = 86, /**< Reserved interrupt */
|
||||
Default_Handler, /* TSI0_IRQn = 87, /**< Touch Sensing Input */
|
||||
Default_Handler, /* TPM1_IRQn = 88, /**< TPM1 single interrupt vector for all sources */
|
||||
Default_Handler, /* TPM2_IRQn = 89, /**< TPM2 single interrupt vector for all sources */
|
||||
Default_Handler, /* Reserved106_IRQn = 90, /**< Reserved interrupt */
|
||||
Default_Handler, /* I2C3_IRQn = 91, /**< Inter-integrated circuit 3 */
|
||||
Default_Handler, /* Reserved108_IRQn = 92, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved109_IRQn = 93, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved110_IRQn = 94, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved111_IRQn = 95, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved112_IRQn = 96, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved113_IRQn = 97, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved114_IRQn = 98, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved115_IRQn = 99, /**< Reserved interrupt */
|
||||
Default_Handler, /* QuadSPI0_IRQn = 100, /**< qspi */
|
||||
Default_Handler, /* Reserved117_IRQn = 101, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved118_IRQn = 102, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved119_IRQn = 103, /**< Reserved interrupt */
|
||||
Default_Handler, /* LTC0_IRQn = 104, /**< LP Trusted Cryptography */
|
||||
Default_Handler, /* Reserved121_IRQn = 105, /**< Reserved interrupt */
|
||||
Default_Handler, /* Reserved122_IRQn = 106 /**< Reserved interrupt */
|
||||
#endif /* CPU_MK82FN256VLL15 */
|
||||
};
|
||||
|
@@ -6,10 +6,10 @@ EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c
|
||||
EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c
|
||||
EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/hw.h
|
||||
EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c
|
||||
EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_MemoryMap.xml
|
||||
EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_FlashPlacement.xml
|
||||
EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/README.md
|
||||
EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/test_main.c
|
||||
EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/retarget.c
|
||||
EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/user_settings.h
|
||||
EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp
|
||||
EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/wolfssl_ltc.hzp
|
||||
|
@@ -21,10 +21,10 @@
|
||||
|
||||
|
||||
#include "hw.h"
|
||||
#include "user_settings.h"
|
||||
|
||||
#if defined(FREESCALE) && defined(K_SERIES)
|
||||
|
||||
|
||||
/**********************************************
|
||||
* NOTE: Customize for actual hardware
|
||||
**********************************************/
|
||||
@@ -33,27 +33,53 @@
|
||||
// $(TargetsDir) location:
|
||||
// On Mac OS/X: Users/USERNAME/Library/Rowley Associates Limited/CrossWorks for ARM/packages/targets/
|
||||
// On Windows: C:/Users/USERNAME/Application Data/Local/Rowley Associates Limited/CrossWorks for ARM/packages/targets/
|
||||
#include <MK64F12.h> // Located in $(TargetsDir)/Kinetis/CMSIS/
|
||||
|
||||
// Located in $(TargetsDir)/Kinetis/CMSIS/
|
||||
#ifdef FREESCALE_KSDK_BM
|
||||
#include "fsl_common.h"
|
||||
#include "fsl_debug_console.h"
|
||||
#include "fsl_rtc.h"
|
||||
#include "fsl_trng.h"
|
||||
#include "fsl_lpuart.h"
|
||||
#include "fsl_port.h"
|
||||
#include "clock_config.h"
|
||||
#else
|
||||
#include <MK64F12.h> // Located in $(TargetsDir)/Kinetis/CMSIS/
|
||||
#endif
|
||||
|
||||
|
||||
// System clock
|
||||
#define SYS_CLK_KHZ 96000ul /* Core system clock in KHz */
|
||||
#define SYS_CLK_DRS MCG_C4_DRST_DRS(0x03) /* DRS 0=24MHz, 1=48MHz, 2=72MHz, 3=96MHz */
|
||||
#define SYS_CLK_DMX MCG_C4_DMX32_MASK /* 0=Disable DMX32 (lower actual speed), MCG_C4_DMX32_MASK=Enable DMX32 */
|
||||
#define SYS_CLK_DIV 1 /* System clock divisor */
|
||||
#define BUS_CLK_DIV 2 /* Bus clock divisor */
|
||||
#define BUS_CLK_KHZ (SYS_CLK_KHZ/BUS_CLK_DIV) /* Helper to calculate bus speed for UART */
|
||||
#define FLASH_CLK_DIV 4 /* Flash clock divisor */
|
||||
#ifdef FREESCALE_KSDK_BM
|
||||
#define SYS_CLK_HZ SystemCoreClock
|
||||
#else
|
||||
#define SYS_CLK_HZ 96000000ul /* Core system clock in Hz */
|
||||
#define SYS_CLK_DRS MCG_C4_DRST_DRS(0x03) /* DRS 0=24MHz, 1=48MHz, 2=72MHz, 3=96MHz */
|
||||
#define SYS_CLK_DMX MCG_C4_DMX32_MASK /* 0=Disable DMX32 (lower actual speed), MCG_C4_DMX32_MASK=Enable DMX32 */
|
||||
#define SYS_CLK_DIV 1 /* System clock divisor */
|
||||
#define BUS_CLK_DIV 2 /* Bus clock divisor */
|
||||
#define BUS_CLK_KHZ (SYS_CLK_HZ/BUS_CLK_DIV) /* Helper to calculate bus speed for UART */
|
||||
#define FLASH_CLK_DIV 4 /* Flash clock divisor */
|
||||
#endif
|
||||
|
||||
// UART TX Port, Pin, Mux and Baud
|
||||
#define UART_PORT UART4 /* UART Port */
|
||||
#define UART_TX_PORT PORTE /* UART TX Port */
|
||||
#define UART_TX_PIN 24 /* UART TX Pin */
|
||||
#define UART_TX_MUX 0x3 /* Kinetis UART pin mux */
|
||||
#ifdef FREESCALE_KSDK_BM
|
||||
#define UART_PORT LPUART0 /* UART Port */
|
||||
#define UART_TX_PORT PORTA /* UART TX Port */
|
||||
#define UART_TX_PIN 2U /* UART TX Pin */
|
||||
#define UART_TX_MUX kPORT_MuxAlt2 /* Kinetis UART pin mux */
|
||||
#else
|
||||
#define UART_PORT UART4 /* UART Port */
|
||||
#define UART_TX_PORT PORTE /* UART TX Port */
|
||||
#define UART_TX_PIN 24U /* UART TX Pin */
|
||||
#define UART_TX_MUX 0x3 /* Kinetis UART pin mux */
|
||||
#endif
|
||||
#define UART_BAUD 115200 /* UART Baud Rate */
|
||||
|
||||
/* Note: You will also need to update the UART clock gate in hw_uart_init (SIM_SCGC1_UART5_MASK) */
|
||||
/* Note: TWR-K60 is UART3, PTC17 */
|
||||
/* Note: FRDM-K64 is UART4, PTE24 */
|
||||
/* Note: TWR-K64 is UART5, PTE8 */
|
||||
/* Note: FRDM-K82F is LPUART0 A2, LPUART4 PTC15 */
|
||||
|
||||
/***********************************************/
|
||||
|
||||
@@ -70,6 +96,9 @@ static void delay_nop(uint32_t count)
|
||||
|
||||
static void hw_mcg_init(void)
|
||||
{
|
||||
#ifdef FREESCALE_KSDK_BM
|
||||
BOARD_BootClockHSRUN();
|
||||
#else
|
||||
/* Adjust clock dividers (core/system=div/1, bus=div/2, flex bus=div/2, flash=div/4) */
|
||||
SIM->CLKDIV1 = SIM_CLKDIV1_OUTDIV1(SYS_CLK_DIV-1) | SIM_CLKDIV1_OUTDIV2(BUS_CLK_DIV-1) |
|
||||
SIM_CLKDIV1_OUTDIV3(BUS_CLK_DIV-1) | SIM_CLKDIV1_OUTDIV4(FLASH_CLK_DIV-1);
|
||||
@@ -77,10 +106,18 @@ static void hw_mcg_init(void)
|
||||
/* Configure FEI internal clock speed */
|
||||
MCG->C4 = (SYS_CLK_DMX | SYS_CLK_DRS);
|
||||
while((MCG->C4 & (MCG_C4_DRST_DRS_MASK | MCG_C4_DMX32_MASK)) != (SYS_CLK_DMX | SYS_CLK_DRS));
|
||||
#endif
|
||||
}
|
||||
|
||||
static void hw_gpio_init(void)
|
||||
{
|
||||
#ifdef FREESCALE_KSDK_BM
|
||||
CLOCK_EnableClock(kCLOCK_PortA);
|
||||
CLOCK_EnableClock(kCLOCK_PortB);
|
||||
CLOCK_EnableClock(kCLOCK_PortC);
|
||||
CLOCK_EnableClock(kCLOCK_PortD);
|
||||
CLOCK_EnableClock(kCLOCK_PortE);
|
||||
#else
|
||||
/* Enable clocks to all GPIO ports */
|
||||
SIM->SCGC5 |= (SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK
|
||||
#ifdef SIM_SCGC5_PORTC_MASK
|
||||
@@ -93,6 +130,7 @@ static void hw_gpio_init(void)
|
||||
| SIM_SCGC5_PORTE_MASK
|
||||
#endif
|
||||
);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void hw_uart_init(void)
|
||||
@@ -100,7 +138,13 @@ static void hw_uart_init(void)
|
||||
register uint16_t sbr, brfa;
|
||||
uint8_t temp;
|
||||
|
||||
#ifdef FREESCALE_KSDK_BM
|
||||
PORT_SetPinMux(UART_TX_PORT, UART_TX_PIN, UART_TX_MUX);
|
||||
CLOCK_SetLpuartClock(1); /* MCGPLLCLK */
|
||||
DbgConsole_Init((uint32_t)UART_PORT, UART_BAUD, DEBUG_CONSOLE_DEVICE_TYPE_LPUART, SYS_CLK_HZ);
|
||||
#else
|
||||
/* Enable UART core clock */
|
||||
/* Note: Remember to update me if UART_PORT changes */
|
||||
SIM->SCGC1 |= SIM_SCGC1_UART4_MASK;
|
||||
|
||||
/* Configure UART TX pin */
|
||||
@@ -125,12 +169,13 @@ static void hw_uart_init(void)
|
||||
|
||||
/* Enable receiver and transmitter */
|
||||
UART_PORT->C2 |= (UART_C2_TE_MASK | UART_C2_RE_MASK);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void hw_rtc_init(void)
|
||||
{
|
||||
/* Init nop delay */
|
||||
mDelayCyclesPerUs = (SYS_CLK_KHZ / 1000 / NOP_FOR_LOOP_INSTRUCTION_COUNT);
|
||||
mDelayCyclesPerUs = (SYS_CLK_HZ / 1000000 / NOP_FOR_LOOP_INSTRUCTION_COUNT);
|
||||
|
||||
/* Enable RTC clock and oscillator */
|
||||
SIM->SCGC6 |= SIM_SCGC6_RTC_MASK;
|
||||
@@ -145,7 +190,7 @@ static void hw_rtc_init(void)
|
||||
}
|
||||
|
||||
/* Disable RTC Interrupts */
|
||||
RTC_IER = 0;
|
||||
RTC->IER = 0;
|
||||
|
||||
/* Enable OSC */
|
||||
if ((RTC->CR & RTC_CR_OSCE_MASK) == 0) {
|
||||
@@ -164,6 +209,14 @@ static void hw_rtc_init(void)
|
||||
|
||||
static void hw_rand_init(void)
|
||||
{
|
||||
#ifdef FREESCALE_KSDK_BM
|
||||
trng_config_t trngConfig;
|
||||
TRNG_GetDefaultConfig(&trngConfig);
|
||||
/* Set sample mode of the TRNG ring oscillator to Von Neumann, for better random data.*/
|
||||
trngConfig.sampleMode = kTRNG_SampleModeVonNeumann;
|
||||
/* Initialize TRNG */
|
||||
TRNG_Init(TRNG0, &trngConfig);
|
||||
#else
|
||||
/* Enable RNG clocks */
|
||||
SIM->SCGC6 |= SIM_SCGC6_RNGA_MASK;
|
||||
SIM->SCGC3 |= SIM_SCGC3_RNGA_MASK;
|
||||
@@ -176,6 +229,7 @@ static void hw_rand_init(void)
|
||||
|
||||
/* Enable RNG generation to RANDOUT FIFO */
|
||||
RNG->CR |= RNG_CR_GO_MASK;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -204,14 +258,24 @@ uint32_t hw_get_time_msec(void)
|
||||
|
||||
void hw_uart_printchar(int c)
|
||||
{
|
||||
#ifdef FREESCALE_KSDK_BM
|
||||
LPUART_WriteBlocking(UART_PORT, (const uint8_t*)&c, 1); /* Send the character */
|
||||
#else
|
||||
while(!(UART_PORT->S1 & UART_S1_TDRE_MASK)); /* Wait until space is available in the FIFO */
|
||||
UART_PORT->D = (uint8_t)c; /* Send the character */
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t hw_rand(void)
|
||||
{
|
||||
uint32_t rng;
|
||||
#ifdef FREESCALE_KSDK_BM
|
||||
TRNG_GetRandomData(TRNG0, &rng, sizeof(rng));
|
||||
#else
|
||||
while((RNG->SR & RNG_SR_OREG_LVL(0xF)) == 0) {}; /* Wait until FIFO has a value available */
|
||||
return RNG->OR; /* Return next value in FIFO output register */
|
||||
rng = RNG->OR; /* Return next value in FIFO output register */
|
||||
#endif
|
||||
return rng;
|
||||
}
|
||||
|
||||
void delay_us(uint32_t microseconds)
|
||||
|
@@ -22,6 +22,17 @@
|
||||
|
||||
#include "hw.h"
|
||||
#include "user_settings.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void __assert(const char *__expression, const char *__filename, int __line)
|
||||
{
|
||||
printf("Assert: %s, File %s (%d)\n", __expression, __filename, __line);
|
||||
}
|
||||
|
||||
unsigned int LowResTimer(void)
|
||||
{
|
||||
return hw_get_time_sec();
|
||||
}
|
||||
|
||||
double current_time(int reset)
|
||||
{
|
||||
|
@@ -140,7 +140,7 @@ extern "C" {
|
||||
/* Ed25519 / Curve25519 */
|
||||
#undef HAVE_CURVE25519
|
||||
#undef HAVE_ED25519
|
||||
#if 0
|
||||
#if 1
|
||||
#define HAVE_CURVE25519
|
||||
#define HAVE_ED25519
|
||||
|
||||
@@ -196,7 +196,18 @@ extern "C" {
|
||||
/* HW Crypto Acceleration */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
// See README.md for instructions
|
||||
//#define FREESCALE_MMCAU 1
|
||||
#if 0
|
||||
#define FREESCALE_MMCAU 1
|
||||
#endif
|
||||
|
||||
/* NXP LTC Support (See README.md for instructions) */
|
||||
#if 0
|
||||
#define FSL_HW_CRYPTO_MANUAL_SELECTION
|
||||
#define FREESCALE_USE_MMCAU
|
||||
#define FREESCALE_USE_LTC
|
||||
#define LTC_MAX_ECC_BITS (512)
|
||||
#define LTC_MAX_INT_BYTES (256)
|
||||
#endif
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -243,6 +254,7 @@ extern "C" {
|
||||
/* Override Current Time */
|
||||
/* Allows custom "custom_time()" function to be used for benchmark */
|
||||
#define WOLFSSL_USER_CURRTIME
|
||||
#define USER_TICKS
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
@@ -83,6 +83,9 @@
|
||||
<file file_name="../../wolfcrypt/src/memory.c" />
|
||||
<file file_name="../../wolfcrypt/src/misc.c">
|
||||
<configuration Name="ARM_Debug" build_exclude_from_build="Yes" />
|
||||
<configuration
|
||||
Name="ARM_Release"
|
||||
build_exclude_from_build="Yes" />
|
||||
</file>
|
||||
<file file_name="../../wolfcrypt/src/pkcs7.c" />
|
||||
<file file_name="../../wolfcrypt/src/poly1305.c" />
|
||||
@@ -140,6 +143,8 @@
|
||||
arm_target_loader_default_loader="Flash"
|
||||
c_preprocessor_definitions="WOLFSSL_ROWLEY_ARM;WOLFSSL_USER_SETTINGS"
|
||||
c_user_include_directories=".;../;../../;$(TargetsDir);$(TargetsDir)/Kinetis;$(TargetsDir)/Kinetis/CMSIS;$(TargetsDir)/Kinetis/CMSIS/include;$(TargetsDir)/CMSIS_3/CMSIS/include"
|
||||
debug_register_definition_file="$(TargetsDir)/Kinetis/MK64F12_Peripherals.xml"
|
||||
linker_memory_map_file="$(TargetsDir)/Kinetis/MK64FN1M0xxx12_MemoryMap.xml"
|
||||
linker_memory_map_macros="FLASHSIZE=0x80000;SRAMSIZE=0x20000"
|
||||
linker_output_format="bin"
|
||||
project_dependencies="libwolfssl"
|
||||
@@ -161,7 +166,6 @@
|
||||
</folder>
|
||||
<folder Name="System Files">
|
||||
<file file_name="Kinetis_FlashPlacement.xml" />
|
||||
<file file_name="Kinetis_MemoryMap.xml" />
|
||||
</folder>
|
||||
</project>
|
||||
<project Name="benchmark">
|
||||
@@ -169,16 +173,21 @@
|
||||
Name="Common"
|
||||
Placement="Flash"
|
||||
Target="MK64FN1M0xxx12"
|
||||
arm_architecture="v7EM"
|
||||
arm_core_type="Cortex-M4"
|
||||
arm_fpu_type="FPv4-SP-D16"
|
||||
arm_linker_fiq_stack_size="0"
|
||||
arm_linker_heap_size="91136"
|
||||
arm_linker_irq_stack_size="0"
|
||||
arm_linker_stack_size="30720"
|
||||
arm_simulator_memory_simulation_filename="$(TargetsDir)/Kinetis/KinetisSimulatorMemory.dll"
|
||||
arm_simulator_memory_simulation_parameter="MK64FN1M0xxx12;0x100000;0x0;0x0;0x40000"
|
||||
arm_simulator_memory_simulation_parameter="MK64FN1M0xxx12;0x100000;0x0;0x0;0x40000;4"
|
||||
arm_target_loader_applicable_loaders="Flash"
|
||||
arm_target_loader_default_loader="Flash"
|
||||
c_preprocessor_definitions="WOLFSSL_ROWLEY_ARM;WOLFSSL_USER_SETTINGS"
|
||||
c_user_include_directories=".;../;../../;$(TargetsDir);$(TargetsDir)/Kinetis;$(TargetsDir)/Kinetis/CMSIS;$(TargetsDir)/Kinetis/CMSIS/include;$(TargetsDir)/CMSIS_3/CMSIS/include"
|
||||
debug_register_definition_file="$(TargetsDir)/Kinetis/MK64F12_Peripherals.xml"
|
||||
linker_memory_map_file="$(TargetsDir)/Kinetis/MK64FN1M0xxx12_MemoryMap.xml"
|
||||
linker_memory_map_macros="FLASHSIZE=0x80000;SRAMSIZE=0x20000"
|
||||
linker_output_format="bin"
|
||||
project_dependencies="libwolfssl"
|
||||
@@ -200,8 +209,11 @@
|
||||
</folder>
|
||||
<folder Name="System Files">
|
||||
<file file_name="Kinetis_FlashPlacement.xml" />
|
||||
<file file_name="Kinetis_MemoryMap.xml" />
|
||||
</folder>
|
||||
<configuration
|
||||
Name="Flash"
|
||||
arm_target_flash_loader_file_path="$(TargetsDir)/Kinetis/Release/Loader.elf"
|
||||
arm_target_loader_parameter="4" />
|
||||
</project>
|
||||
<configuration
|
||||
Name="ARM"
|
||||
@@ -278,11 +290,10 @@
|
||||
c_preprocessor_definitions="__RAM_BUILD"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="Kineits"
|
||||
Name="Kinetis"
|
||||
arm_target_debug_interface_type="ADIv5"
|
||||
c_preprocessor_definitions="FREESCALE;K_SERIES"
|
||||
hidden="Yes"
|
||||
linker_memory_map_file="$(ProjectDir)/Kinetis_MemoryMap.xml"
|
||||
linker_section_placement_file="$(ProjectDir)/Kinetis_FlashPlacement.xml" />
|
||||
<configuration
|
||||
Name="V4"
|
||||
@@ -400,11 +411,11 @@
|
||||
<configuration
|
||||
Name="ARM_Debug"
|
||||
batch_build_configurations="V7EM THUMB * Debug"
|
||||
inherited_configurations="ARM;V7EM;Debug;Kineits;THUMB;Flash" />
|
||||
inherited_configurations="ARM;V7EM;Debug;Kinetis;THUMB;Flash" />
|
||||
<configuration
|
||||
Name="ARM_Release"
|
||||
batch_build_configurations="V7EM THUMB * Release"
|
||||
inherited_configurations="ARM;V7EM;Release;Kineits;Flash;THUMB" />
|
||||
inherited_configurations="ARM;V7EM;Release;Kinetis;Flash;THUMB" />
|
||||
<configuration
|
||||
Name="Common"
|
||||
build_intermediate_directory="$(ProjectName)_$(Configuration)"
|
||||
|
626
IDE/ROWLEY-CROSSWORKS-ARM/wolfssl_ltc.hzp
Normal file
626
IDE/ROWLEY-CROSSWORKS-ARM/wolfssl_ltc.hzp
Normal file
@@ -0,0 +1,626 @@
|
||||
<!DOCTYPE CrossStudio_Project_File>
|
||||
<solution Name="wolfssl_ltc" target="8" version="2">
|
||||
<project Name="libwolfssl_ltc">
|
||||
<configuration
|
||||
Name="Common"
|
||||
build_output_file_name="$(OutDir)/$(ProjectName)$(LibExt)$(LIB)"
|
||||
c_preprocessor_definitions="WOLFSSL_ROWLEY_ARM;WOLFSSL_USER_SETTINGS"
|
||||
c_user_include_directories=".;../;../../;./drivers;./mmcau_2.0.0;./CMSIS/Include"
|
||||
project_directory=""
|
||||
project_type="Library" />
|
||||
<folder Name="Source Files">
|
||||
<configuration Name="Common" filter="c;cpp;cxx;cc;h;s;inc" />
|
||||
<folder Name="wolfcrypt">
|
||||
<folder Name="benchmark">
|
||||
<file file_name="../../wolfcrypt/benchmark/benchmark.c" />
|
||||
<file file_name="../../wolfcrypt/benchmark/benchmark.h" />
|
||||
<file file_name="../../wolfcrypt/benchmark/include.am" />
|
||||
</folder>
|
||||
<folder Name="src">
|
||||
<file file_name="../../wolfcrypt/src/aes.c" />
|
||||
<file file_name="../../wolfcrypt/src/arc4.c" />
|
||||
<file file_name="../../wolfcrypt/src/asm.c">
|
||||
<configuration Name="ARM_Debug" build_exclude_from_build="Yes" />
|
||||
</file>
|
||||
<file file_name="../../wolfcrypt/src/asn.c" />
|
||||
<file file_name="../../wolfcrypt/src/blake2b.c" />
|
||||
<file file_name="../../wolfcrypt/src/camellia.c" />
|
||||
<file file_name="../../wolfcrypt/src/chacha.c" />
|
||||
<file file_name="../../wolfcrypt/src/chacha20_poly1305.c" />
|
||||
<file file_name="../../wolfcrypt/src/coding.c" />
|
||||
<file file_name="../../wolfcrypt/src/compress.c" />
|
||||
<file file_name="../../wolfcrypt/src/curve25519.c" />
|
||||
<file file_name="../../wolfcrypt/src/des3.c" />
|
||||
<file file_name="../../wolfcrypt/src/dh.c" />
|
||||
<file file_name="../../wolfcrypt/src/dsa.c" />
|
||||
<file file_name="../../wolfcrypt/src/ecc.c" />
|
||||
<file file_name="../../wolfcrypt/src/ecc_fp.c" />
|
||||
<file file_name="../../wolfcrypt/src/ed25519.c" />
|
||||
<file file_name="../../wolfcrypt/src/error.c" />
|
||||
<file file_name="../../wolfcrypt/src/fe_low_mem.c" />
|
||||
<file file_name="../../wolfcrypt/src/fe_operations.c" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mont_small.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_12.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_17.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_20.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_24.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_28.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_3.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_32.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_4.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_48.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_6.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_64.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_7.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_8.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_9.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_mul_comba_small_set.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_12.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_17.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_20.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_24.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_28.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_3.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_32.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_4.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_48.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_6.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_64.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_7.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_8.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_9.i" />
|
||||
<file file_name="../../wolfcrypt/src/fp_sqr_comba_small_set.i" />
|
||||
<file file_name="../../wolfcrypt/src/ge_low_mem.c" />
|
||||
<file file_name="../../wolfcrypt/src/ge_operations.c" />
|
||||
<file file_name="../../wolfcrypt/src/hash.c" />
|
||||
<file file_name="../../wolfcrypt/src/hc128.c" />
|
||||
<file file_name="../../wolfcrypt/src/hmac.c" />
|
||||
<file file_name="../../wolfcrypt/src/idea.c" />
|
||||
<file file_name="../../wolfcrypt/src/include.am" />
|
||||
<file file_name="../../wolfcrypt/src/integer.c" />
|
||||
<file file_name="../../wolfcrypt/src/logging.c" />
|
||||
<file file_name="../../wolfcrypt/src/md2.c" />
|
||||
<file file_name="../../wolfcrypt/src/md4.c" />
|
||||
<file file_name="../../wolfcrypt/src/md5.c" />
|
||||
<file file_name="../../wolfcrypt/src/memory.c" />
|
||||
<file file_name="../../wolfcrypt/src/misc.c">
|
||||
<configuration Name="ARM_Debug" build_exclude_from_build="Yes" />
|
||||
<configuration
|
||||
Name="ARM_Release"
|
||||
build_exclude_from_build="Yes" />
|
||||
</file>
|
||||
<file file_name="../../wolfcrypt/src/pkcs7.c" />
|
||||
<file file_name="../../wolfcrypt/src/poly1305.c" />
|
||||
<file file_name="../../wolfcrypt/src/pwdbased.c" />
|
||||
<file file_name="../../wolfcrypt/src/rabbit.c" />
|
||||
<file file_name="../../wolfcrypt/src/random.c" />
|
||||
<file file_name="../../wolfcrypt/src/ripemd.c" />
|
||||
<file file_name="../../wolfcrypt/src/rsa.c" />
|
||||
<file file_name="../../wolfcrypt/src/sha.c" />
|
||||
<file file_name="../../wolfcrypt/src/sha256.c" />
|
||||
<file file_name="../../wolfcrypt/src/sha512.c" />
|
||||
<file file_name="../../wolfcrypt/src/signature.c" />
|
||||
<file file_name="../../wolfcrypt/src/srp.c" />
|
||||
<file file_name="../../wolfcrypt/src/tfm.c" />
|
||||
<file file_name="../../wolfcrypt/src/wc_encrypt.c" />
|
||||
<file file_name="../../wolfcrypt/src/wc_port.c" />
|
||||
<folder Name="port">
|
||||
<folder Name="nxp">
|
||||
<file file_name="../../wolfcrypt/src/port/nxp/ksdk_port.c" />
|
||||
<file file_name="fsl_debug_console.c" />
|
||||
<file file_name="MK82F25615.h" />
|
||||
<file file_name="MK82F25615_features.h" />
|
||||
<file file_name="arm_common_tables.h" />
|
||||
<file file_name="arm_const_structs.h" />
|
||||
<file file_name="arm_math.h" />
|
||||
<file file_name="cmsis_gcc.h" />
|
||||
<file file_name="core_cm4.h" />
|
||||
<file file_name="core_cmFunc.h" />
|
||||
<file file_name="core_cmInstr.h" />
|
||||
<file file_name="core_cmSimd.h" />
|
||||
<file file_name="fsl_debug_console.h" />
|
||||
<file file_name="fsl_device_registers.h" />
|
||||
<file file_name="system_MK82F25615.h" />
|
||||
<file file_name="clock_config.c" />
|
||||
<file file_name="clock_config.h" />
|
||||
<folder Name="drivers">
|
||||
<file file_name="drivers/fsl_adc16.c" />
|
||||
<file file_name="drivers/fsl_adc16.h" />
|
||||
<file file_name="drivers/fsl_clock.c" />
|
||||
<file file_name="drivers/fsl_clock.h" />
|
||||
<file file_name="drivers/fsl_cmp.c" />
|
||||
<file file_name="drivers/fsl_cmp.h" />
|
||||
<file file_name="drivers/fsl_cmt.c" />
|
||||
<file file_name="drivers/fsl_cmt.h" />
|
||||
<file file_name="drivers/fsl_common.c" />
|
||||
<file file_name="drivers/fsl_common.h" />
|
||||
<file file_name="drivers/fsl_crc.c" />
|
||||
<file file_name="drivers/fsl_crc.h" />
|
||||
<file file_name="drivers/fsl_dac.c" />
|
||||
<file file_name="drivers/fsl_dac.h" />
|
||||
<file file_name="drivers/fsl_dmamux.c" />
|
||||
<file file_name="drivers/fsl_dmamux.h" />
|
||||
<file file_name="drivers/fsl_dspi.c" />
|
||||
<file file_name="drivers/fsl_dspi.h" />
|
||||
<file file_name="drivers/fsl_dspi_edma.c" />
|
||||
<file file_name="drivers/fsl_dspi_edma.h" />
|
||||
<file file_name="drivers/fsl_dspi_freertos.c">
|
||||
<configuration
|
||||
Name="ARM_Debug"
|
||||
build_exclude_from_build="Yes" />
|
||||
<configuration
|
||||
Name="ARM_Release"
|
||||
build_exclude_from_build="Yes" />
|
||||
</file>
|
||||
<file file_name="drivers/fsl_dspi_freertos.h" />
|
||||
<file file_name="drivers/fsl_edma.c" />
|
||||
<file file_name="drivers/fsl_edma.h" />
|
||||
<file file_name="drivers/fsl_ewm.c" />
|
||||
<file file_name="drivers/fsl_ewm.h" />
|
||||
<file file_name="drivers/fsl_flash.c" />
|
||||
<file file_name="drivers/fsl_flash.h" />
|
||||
<file file_name="drivers/fsl_flexbus.c" />
|
||||
<file file_name="drivers/fsl_flexbus.h" />
|
||||
<file file_name="drivers/fsl_flexio.c" />
|
||||
<file file_name="drivers/fsl_flexio.h" />
|
||||
<file file_name="drivers/fsl_flexio_camera.c" />
|
||||
<file file_name="drivers/fsl_flexio_camera.h" />
|
||||
<file file_name="drivers/fsl_flexio_camera_edma.c" />
|
||||
<file file_name="drivers/fsl_flexio_camera_edma.h" />
|
||||
<file file_name="drivers/fsl_flexio_i2c_master.c" />
|
||||
<file file_name="drivers/fsl_flexio_i2c_master.h" />
|
||||
<file file_name="drivers/fsl_flexio_i2s.c" />
|
||||
<file file_name="drivers/fsl_flexio_i2s.h" />
|
||||
<file file_name="drivers/fsl_flexio_i2s_edma.c" />
|
||||
<file file_name="drivers/fsl_flexio_i2s_edma.h" />
|
||||
<file file_name="drivers/fsl_flexio_spi.c" />
|
||||
<file file_name="drivers/fsl_flexio_spi.h" />
|
||||
<file file_name="drivers/fsl_flexio_spi_edma.c" />
|
||||
<file file_name="drivers/fsl_flexio_spi_edma.h" />
|
||||
<file file_name="drivers/fsl_flexio_uart.c" />
|
||||
<file file_name="drivers/fsl_flexio_uart.h" />
|
||||
<file file_name="drivers/fsl_flexio_uart_edma.c" />
|
||||
<file file_name="drivers/fsl_flexio_uart_edma.h" />
|
||||
<file file_name="drivers/fsl_ftm.c" />
|
||||
<file file_name="drivers/fsl_ftm.h" />
|
||||
<file file_name="drivers/fsl_gpio.c" />
|
||||
<file file_name="drivers/fsl_gpio.h" />
|
||||
<file file_name="drivers/fsl_i2c.c" />
|
||||
<file file_name="drivers/fsl_i2c.h" />
|
||||
<file file_name="drivers/fsl_i2c_edma.c" />
|
||||
<file file_name="drivers/fsl_i2c_edma.h" />
|
||||
<file file_name="drivers/fsl_i2c_freertos.c">
|
||||
<configuration
|
||||
Name="ARM_Debug"
|
||||
build_exclude_from_build="Yes" />
|
||||
<configuration
|
||||
Name="ARM_Release"
|
||||
build_exclude_from_build="Yes" />
|
||||
</file>
|
||||
<file file_name="drivers/fsl_i2c_freertos.h" />
|
||||
<file file_name="drivers/fsl_llwu.c" />
|
||||
<file file_name="drivers/fsl_llwu.h" />
|
||||
<file file_name="drivers/fsl_lmem_cache.c" />
|
||||
<file file_name="drivers/fsl_lmem_cache.h" />
|
||||
<file file_name="drivers/fsl_lptmr.c" />
|
||||
<file file_name="drivers/fsl_lptmr.h" />
|
||||
<file file_name="drivers/fsl_lpuart.c" />
|
||||
<file file_name="drivers/fsl_lpuart.h" />
|
||||
<file file_name="drivers/fsl_lpuart_edma.c" />
|
||||
<file file_name="drivers/fsl_lpuart_edma.h" />
|
||||
<file file_name="fsl_lpuart_freertos.c">
|
||||
<configuration
|
||||
Name="ARM_Debug"
|
||||
build_exclude_from_build="Yes" />
|
||||
<configuration
|
||||
Name="ARM_Release"
|
||||
build_exclude_from_build="Yes" />
|
||||
</file>
|
||||
<file file_name="drivers/fsl_lpuart_freertos.h" />
|
||||
<file file_name="drivers/fsl_ltc.c" />
|
||||
<file file_name="drivers/fsl_ltc.h" />
|
||||
<file file_name="drivers/fsl_ltc_edma.c" />
|
||||
<file file_name="drivers/fsl_ltc_edma.h" />
|
||||
<file file_name="drivers/fsl_mpu.c" />
|
||||
<file file_name="drivers/fsl_mpu.h" />
|
||||
<file file_name="drivers/fsl_pdb.c" />
|
||||
<file file_name="drivers/fsl_pdb.h" />
|
||||
<file file_name="drivers/fsl_pit.c" />
|
||||
<file file_name="drivers/fsl_pit.h" />
|
||||
<file file_name="drivers/fsl_pmc.c" />
|
||||
<file file_name="drivers/fsl_pmc.h" />
|
||||
<file file_name="drivers/fsl_port.h" />
|
||||
<file file_name="drivers/fsl_qspi.c" />
|
||||
<file file_name="drivers/fsl_qspi.h" />
|
||||
<file file_name="drivers/fsl_qspi_edma.c" />
|
||||
<file file_name="drivers/fsl_qspi_edma.h" />
|
||||
<file file_name="drivers/fsl_rcm.c" />
|
||||
<file file_name="drivers/fsl_rcm.h" />
|
||||
<file file_name="drivers/fsl_rtc.c" />
|
||||
<file file_name="drivers/fsl_rtc.h" />
|
||||
<file file_name="drivers/fsl_sai.c" />
|
||||
<file file_name="drivers/fsl_sai.h" />
|
||||
<file file_name="drivers/fsl_sai_edma.c" />
|
||||
<file file_name="drivers/fsl_sai_edma.h" />
|
||||
<file file_name="drivers/fsl_sdhc.c" />
|
||||
<file file_name="drivers/fsl_sdhc.h" />
|
||||
<file file_name="drivers/fsl_sdramc.c" />
|
||||
<file file_name="drivers/fsl_sdramc.h" />
|
||||
<file file_name="drivers/fsl_sim.c" />
|
||||
<file file_name="drivers/fsl_sim.h" />
|
||||
<file file_name="drivers/fsl_smartcard.h" />
|
||||
<file file_name="drivers/fsl_smartcard_emvsim.c" />
|
||||
<file file_name="drivers/fsl_smartcard_emvsim.h" />
|
||||
<file file_name="drivers/fsl_smartcard_freertos.c">
|
||||
<configuration
|
||||
Name="ARM_Debug"
|
||||
build_exclude_from_build="Yes" />
|
||||
<configuration
|
||||
Name="ARM_Release"
|
||||
build_exclude_from_build="Yes" />
|
||||
</file>
|
||||
<file file_name="drivers/fsl_smartcard_freertos.h" />
|
||||
<file file_name="drivers/fsl_smartcard_phy_emvsim.c" />
|
||||
<file file_name="drivers/fsl_smartcard_phy_emvsim.h" />
|
||||
<file file_name="drivers/fsl_smartcard_phy_ncn8025.c" />
|
||||
<file file_name="drivers/fsl_smartcard_phy_ncn8025.h" />
|
||||
<file file_name="drivers/fsl_smc.c" />
|
||||
<file file_name="drivers/fsl_smc.h" />
|
||||
<file file_name="drivers/fsl_tpm.c" />
|
||||
<file file_name="drivers/fsl_tpm.h" />
|
||||
<file file_name="drivers/fsl_trng.c" />
|
||||
<file file_name="drivers/fsl_trng.h" />
|
||||
<file file_name="drivers/fsl_tsi_v4.c" />
|
||||
<file file_name="drivers/fsl_tsi_v4.h" />
|
||||
<file file_name="drivers/fsl_vref.c" />
|
||||
<file file_name="drivers/fsl_vref.h" />
|
||||
<file file_name="drivers/fsl_wdog.c" />
|
||||
<file file_name="drivers/fsl_wdog.h" />
|
||||
</folder>
|
||||
<file file_name="system_MK82F25615.c" />
|
||||
</folder>
|
||||
</folder>
|
||||
</folder>
|
||||
<folder Name="test">
|
||||
<file file_name="../../wolfcrypt/test/include.am" />
|
||||
<file file_name="../../wolfcrypt/test/test.c" />
|
||||
<file file_name="../../wolfcrypt/test/test.h" />
|
||||
</folder>
|
||||
<folder Name="user-crypto" path="../../wolfcrypt/user-crypto">
|
||||
<configuration Name="Common" build_exclude_from_build="Yes" />
|
||||
</folder>
|
||||
</folder>
|
||||
<folder
|
||||
Name="wolfssl"
|
||||
exclude="*.asm;*.s"
|
||||
filter=""
|
||||
path="../../wolfssl"
|
||||
recurse="Yes" />
|
||||
<file file_name="user_settings.h" />
|
||||
<file file_name="README.md" />
|
||||
<folder
|
||||
Name="source"
|
||||
exclude=""
|
||||
filter=""
|
||||
path="../../src"
|
||||
recurse="No" />
|
||||
</folder>
|
||||
</project>
|
||||
<project Name="test_ltc">
|
||||
<configuration
|
||||
Name="Common"
|
||||
Placement="Flash"
|
||||
Target="MK82FN256xxx15"
|
||||
arm_architecture="v7EM"
|
||||
arm_core_type="Cortex-M4"
|
||||
arm_fpu_type="FPv4-SP-D16"
|
||||
arm_linker_fiq_stack_size="0"
|
||||
arm_linker_heap_size="91136"
|
||||
arm_linker_irq_stack_size="0"
|
||||
arm_linker_stack_size="30720"
|
||||
arm_simulator_memory_simulation_filename="$(TargetsDir)/Kinetis/KinetisSimulatorMemory.dll"
|
||||
arm_simulator_memory_simulation_parameter="MK82FN256xxx15;0x40000;0x0;0x0;0x40000;4"
|
||||
arm_target_loader_applicable_loaders="Flash"
|
||||
arm_target_loader_default_loader="Flash"
|
||||
c_preprocessor_definitions="WOLFSSL_ROWLEY_ARM;WOLFSSL_USER_SETTINGS"
|
||||
c_user_include_directories=".;./drivers;./mmcau_2.0.0;./CMSIS/Include;../;../../;$(TargetsDir);$(TargetsDir)/Kinetis;$(TargetsDir)/Kinetis/CMSIS;$(TargetsDir)/Kinetis/CMSIS/include;$(TargetsDir)/CMSIS_3/CMSIS/include"
|
||||
debug_register_definition_file="$(TargetsDir)/Kinetis/MK82F25615_Peripherals.xml"
|
||||
linker_memory_map_file="$(TargetsDir)/Kinetis/MK82FN256xxx15_MemoryMap.xml"
|
||||
linker_memory_map_macros="FLASHSIZE=0x40000;SRAMSIZE=0x40000"
|
||||
linker_output_format="bin"
|
||||
project_dependencies="libwolfssl_ltc"
|
||||
project_type="Executable"
|
||||
property_groups_file_path="$(TargetsDir)/Kinetis/propertyGroups.xml"
|
||||
target_get_partname_script="GetPartName()"
|
||||
target_match_partname_script="MatchPartName("$(Target)")"
|
||||
target_reset_script="FLASHReset()"
|
||||
target_script_file="$(TargetsDir)/Kinetis/Kinetis_Target.js" />
|
||||
<folder Name="Source Files">
|
||||
<configuration Name="Common" filter="c;cpp;cxx;cc;h;s;asm;inc" />
|
||||
<file file_name="retarget.c" />
|
||||
<file file_name="kinetis_hw.c" />
|
||||
<file file_name="hw.h" />
|
||||
<file file_name="test_main.c" />
|
||||
<file file_name="arm_startup.c" />
|
||||
<file file_name="user_settings.h" />
|
||||
<file file_name="README.md" />
|
||||
<folder Name="mmcau">
|
||||
<file file_name="mmcau_2.0.0/cau_api.h" />
|
||||
<file file_name="mmcau_2.0.0/fsl_mmcau.c" />
|
||||
<file file_name="mmcau_2.0.0/fsl_mmcau.h" />
|
||||
<file file_name="mmcau_2.0.0/README.txt" />
|
||||
<folder Name="asm-cm4-cm7">
|
||||
<file file_name="mmcau_2.0.0/asm-cm4-cm7/lib_mmcau.a" />
|
||||
</folder>
|
||||
</folder>
|
||||
</folder>
|
||||
<folder Name="System Files">
|
||||
<file file_name="Kinetis_FlashPlacement.xml" />
|
||||
</folder>
|
||||
<configuration
|
||||
Name="Flash"
|
||||
arm_target_flash_loader_file_path="$(TargetsDir)/Kinetis/Release/Loader3.elf" />
|
||||
</project>
|
||||
<project Name="benchmark_ltc">
|
||||
<configuration
|
||||
Name="Common"
|
||||
Placement="Flash"
|
||||
Target="MK82FN256xxx15"
|
||||
arm_architecture="v7EM"
|
||||
arm_core_type="Cortex-M4"
|
||||
arm_fpu_type="FPv4-SP-D16"
|
||||
arm_linker_fiq_stack_size="0"
|
||||
arm_linker_heap_size="91136"
|
||||
arm_linker_irq_stack_size="0"
|
||||
arm_linker_stack_size="30720"
|
||||
arm_simulator_memory_simulation_filename="$(TargetsDir)/Kinetis/KinetisSimulatorMemory.dll"
|
||||
arm_simulator_memory_simulation_parameter="MK82FN256xxx15;0x40000;0x0;0x0;0x40000;4"
|
||||
arm_target_loader_applicable_loaders="Flash"
|
||||
arm_target_loader_default_loader="Flash"
|
||||
c_preprocessor_definitions="WOLFSSL_ROWLEY_ARM;WOLFSSL_USER_SETTINGS"
|
||||
c_user_include_directories=".;./drivers;./mmcau_2.0.0;./CMSIS/Include;../;../../;$(TargetsDir);$(TargetsDir)/Kinetis;$(TargetsDir)/Kinetis/CMSIS;$(TargetsDir)/Kinetis/CMSIS/include;$(TargetsDir)/CMSIS_3/CMSIS/include"
|
||||
debug_register_definition_file="$(TargetsDir)/Kinetis/MK82F25615_Peripherals.xml"
|
||||
linker_memory_map_file="$(TargetsDir)/Kinetis/MK82FN256xxx15_MemoryMap.xml"
|
||||
linker_memory_map_macros="FLASHSIZE=0x40000;SRAMSIZE=0x40000"
|
||||
linker_output_format="bin"
|
||||
project_dependencies="libwolfssl_ltc"
|
||||
project_type="Executable"
|
||||
property_groups_file_path="$(TargetsDir)/Kinetis/propertyGroups.xml"
|
||||
target_get_partname_script="GetPartName()"
|
||||
target_match_partname_script="MatchPartName("$(Target)")"
|
||||
target_reset_script="FLASHReset()"
|
||||
target_script_file="$(TargetsDir)/Kinetis/Kinetis_Target.js" />
|
||||
<folder Name="Source Files">
|
||||
<configuration Name="Common" filter="c;cpp;cxx;cc;h;s;asm;inc" />
|
||||
<file file_name="retarget.c" />
|
||||
<file file_name="kinetis_hw.c" />
|
||||
<file file_name="hw.h" />
|
||||
<file file_name="benchmark_main.c" />
|
||||
<file file_name="arm_startup.c" />
|
||||
<file file_name="user_settings.h" />
|
||||
<file file_name="README.md" />
|
||||
<folder Name="mmcau">
|
||||
<file file_name="mmcau_2.0.0/cau_api.h" />
|
||||
<file file_name="mmcau_2.0.0/fsl_mmcau.c" />
|
||||
<file file_name="mmcau_2.0.0/fsl_mmcau.h" />
|
||||
<file file_name="mmcau_2.0.0/README.txt" />
|
||||
<folder Name="asm-cm4-cm7">
|
||||
<file file_name="mmcau_2.0.0/asm-cm4-cm7/lib_mmcau.a">
|
||||
<configuration Name="ARM_Debug" build_exclude_from_build="No" />
|
||||
</file>
|
||||
</folder>
|
||||
</folder>
|
||||
</folder>
|
||||
<folder Name="System Files">
|
||||
<file file_name="Kinetis_FlashPlacement.xml" />
|
||||
</folder>
|
||||
<configuration
|
||||
Name="Flash"
|
||||
arm_target_flash_loader_file_path="$(TargetsDir)/Kinetis/Release/Loader3.elf" />
|
||||
</project>
|
||||
<configuration
|
||||
Name="ARM"
|
||||
Platform="ARM"
|
||||
arm_architecture="v7EM"
|
||||
arm_core_type="Cortex-M4"
|
||||
arm_instruction_set="ARM"
|
||||
arm_library_instruction_set="ARM"
|
||||
c_preprocessor_definitions="__ARM"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="LE"
|
||||
arm_endian="Little"
|
||||
c_preprocessor_definitions="__LITTLE_ENDIAN"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="BE"
|
||||
arm_endian="Big"
|
||||
c_preprocessor_definitions="__BIG_ENDIAN"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="Soft"
|
||||
arm_fp_abi="Soft"
|
||||
c_preprocessor_definitions="__FP_ABI_SOFT__"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="Small"
|
||||
arm_library_optimization="Small"
|
||||
c_preprocessor_definitions="__OPTIMIZATION_SMALL"
|
||||
gcc_optimization_level="Optimize For Size"
|
||||
hidden="Yes" />
|
||||
<configuration Name="WCHAR16" gcc_wchar_size="16-Bit" hidden="Yes" />
|
||||
<configuration
|
||||
Name="Debug"
|
||||
c_preprocessor_definitions="DEBUG"
|
||||
gcc_debugging_level="Level 3"
|
||||
gcc_optimization_level="Debug"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="Float"
|
||||
c_preprocessor_definitions="SHORT_FLOAT"
|
||||
double_is_float="Yes"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="Release"
|
||||
c_preprocessor_definitions="NDEBUG"
|
||||
gcc_debugging_level="Level 1"
|
||||
gcc_optimization_level="Level 1"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="Fast"
|
||||
arm_library_optimization="Fast"
|
||||
c_preprocessor_definitions="__OPTIMIZATION_FAST"
|
||||
gcc_optimization_level="Level 1"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="THUMB"
|
||||
Platform="ARM"
|
||||
arm_instruction_set="Thumb"
|
||||
arm_library_instruction_set="Thumb"
|
||||
c_preprocessor_definitions="__THUMB"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="Hard"
|
||||
arm_fp_abi="Hard"
|
||||
c_preprocessor_definitions="__FP_ABI_HARD__"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="Flash"
|
||||
c_preprocessor_definitions="__FLASH_BUILD"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="RAM"
|
||||
c_preprocessor_definitions="__RAM_BUILD"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="Kinetis"
|
||||
arm_target_debug_interface_type="ADIv5"
|
||||
c_preprocessor_definitions="FREESCALE;K_SERIES;CPU_MK82FN256VLL15;FREESCALE_KSDK_BM"
|
||||
hidden="Yes"
|
||||
linker_section_placement_file="$(ProjectDir)/Kinetis_FlashPlacement.xml" />
|
||||
<configuration
|
||||
Name="V4"
|
||||
arm_architecture="v4T"
|
||||
arm_interwork="No"
|
||||
c_preprocessor_definitions="__ARCH_V4"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V4T"
|
||||
arm_architecture="v4T"
|
||||
c_preprocessor_definitions="__ARCH_V4T"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V5TE"
|
||||
arm_architecture="v5TE"
|
||||
c_preprocessor_definitions="__ARCH_V5TE"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V6"
|
||||
arm_architecture="v6"
|
||||
c_preprocessor_definitions="__ARCH_V6"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V7A"
|
||||
arm_architecture="v7A"
|
||||
c_preprocessor_definitions="__ARCH_V7A"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V7R"
|
||||
arm_architecture="v7R"
|
||||
c_preprocessor_definitions="__ARCH_V7R"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V6M"
|
||||
arm_architecture="v6M"
|
||||
c_preprocessor_definitions="__ARCH_V6M"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V7M"
|
||||
arm_architecture="v7M"
|
||||
c_preprocessor_definitions="__ARCH_V7M"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V7EM"
|
||||
arm_architecture="v7EM"
|
||||
c_preprocessor_definitions="__ARCH_V7EM"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V5TE VFP"
|
||||
arm_architecture="v5TE"
|
||||
arm_fpu_type="VFP"
|
||||
c_preprocessor_definitions="__ARCH_V5TE;__FPU_VFP__"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="SoftFP"
|
||||
arm_fp_abi="SoftFP"
|
||||
c_preprocessor_definitions="__FP_ABI_SOFT_FP__"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V6 VFP"
|
||||
arm_architecture="v6"
|
||||
arm_fpu_type="VFP"
|
||||
c_preprocessor_definitions="__ARCH_V6;__FPU_VFP__"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V7A VFPv3-D32"
|
||||
arm_architecture="v7A"
|
||||
arm_fpu_type="VFPv3-D32"
|
||||
c_preprocessor_definitions="__ARCH_V7A;__FPU_VFP__"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V7A VFPv4-D16"
|
||||
arm_architecture="v7A"
|
||||
arm_fpu_type="VFPv4-D16"
|
||||
c_preprocessor_definitions="__ARCH_V7A;__FPU_VFP__"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V7A_IDIV VFPv4-D16"
|
||||
arm_architecture="v7A"
|
||||
arm_fpu_type="VFPv4-D16"
|
||||
arm_v7_has_divide_instructions="Yes"
|
||||
c_preprocessor_definitions="__ARCH_V7A;__FPU_VFP__"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V7R VFPv3-D16"
|
||||
arm_architecture="v7R"
|
||||
arm_fpu_type="VFPv3-D16"
|
||||
c_preprocessor_definitions="__ARCH_V7R;__FPU_VFP__"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V7R_IDIV VFPv3-D16"
|
||||
arm_architecture="v7R"
|
||||
arm_fpu_type="VFPv3-D16"
|
||||
arm_v7_has_divide_instructions="Yes"
|
||||
c_preprocessor_definitions="__ARCH_V7R;__FPU_VFP__"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V7EM FPv4-SP-D16"
|
||||
arm_architecture="v7EM"
|
||||
arm_fpu_type="FPv4-SP-D16"
|
||||
c_preprocessor_definitions="__ARCH_V7EM;__FPV4_SP_D16__"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V7EM FPv5-SP-D16"
|
||||
arm_architecture="v7EM"
|
||||
arm_fpu_type="FPv5-SP-D16"
|
||||
c_preprocessor_definitions="__ARCH_V7EM;__FPV5_SP_D16__"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="V7EM FPv5-D16"
|
||||
arm_architecture="v7EM"
|
||||
arm_fpu_type="FPv5-D16"
|
||||
c_preprocessor_definitions="__ARCH_V7EM;__FPU_VFP__"
|
||||
hidden="Yes" />
|
||||
<configuration
|
||||
Name="ARM_Debug"
|
||||
batch_build_configurations="V7EM THUMB * Debug"
|
||||
inherited_configurations="ARM;V7EM;Debug;Kinetis;THUMB;Flash" />
|
||||
<configuration
|
||||
Name="ARM_Release"
|
||||
batch_build_configurations="V7EM THUMB * Release"
|
||||
inherited_configurations="ARM;V7EM;Release;Kinetis;Flash;THUMB" />
|
||||
<configuration
|
||||
Name="Common"
|
||||
build_intermediate_directory="$(ProjectName)_$(Configuration)"
|
||||
build_output_directory="$(ProjectName)_$(Configuration)" />
|
||||
</solution>
|
@@ -4507,7 +4507,32 @@ ProtocolVersion MakeDTLSv1_2(void)
|
||||
|
||||
|
||||
|
||||
#ifdef USE_WINDOWS_API
|
||||
#if defined(USER_TICKS)
|
||||
#if 0
|
||||
word32 LowResTimer(void)
|
||||
{
|
||||
/*
|
||||
write your own clock tick function if don't want time(0)
|
||||
needs second accuracy but doesn't have to correlated to EPOCH
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif defined(TIME_OVERRIDES)
|
||||
|
||||
/* use same asn time overrides unless user wants tick override above */
|
||||
|
||||
#ifndef HAVE_TIME_T_TYPE
|
||||
typedef long time_t;
|
||||
#endif
|
||||
extern time_t XTIME(time_t * timer);
|
||||
|
||||
word32 LowResTimer(void)
|
||||
{
|
||||
return (word32) XTIME(0);
|
||||
}
|
||||
|
||||
#elif defined(USE_WINDOWS_API)
|
||||
|
||||
word32 LowResTimer(void)
|
||||
{
|
||||
@@ -4618,33 +4643,8 @@ ProtocolVersion MakeDTLSv1_2(void)
|
||||
return (word32)(uTaskerSystemTick / TICK_RESOLUTION);
|
||||
}
|
||||
|
||||
#elif defined(USER_TICKS)
|
||||
#if 0
|
||||
word32 LowResTimer(void)
|
||||
{
|
||||
/*
|
||||
write your own clock tick function if don't want time(0)
|
||||
needs second accuracy but doesn't have to correlated to EPOCH
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif defined(TIME_OVERRIDES)
|
||||
|
||||
/* use same asn time overrides unless user wants tick override above */
|
||||
|
||||
#ifndef HAVE_TIME_T_TYPE
|
||||
typedef long time_t;
|
||||
#endif
|
||||
extern time_t XTIME(time_t * timer);
|
||||
|
||||
word32 LowResTimer(void)
|
||||
{
|
||||
return (word32) XTIME(0);
|
||||
}
|
||||
|
||||
#else /* !USE_WINDOWS_API && !HAVE_RTP_SYS && !MICRIUM && !USER_TICKS */
|
||||
|
||||
#else
|
||||
/* Posix style time */
|
||||
#include <time.h>
|
||||
|
||||
word32 LowResTimer(void)
|
||||
@@ -4653,7 +4653,7 @@ ProtocolVersion MakeDTLSv1_2(void)
|
||||
}
|
||||
|
||||
|
||||
#endif /* USE_WINDOWS_API */
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NO_CERTS
|
||||
|
@@ -1953,57 +1953,26 @@ int wc_InitAes_h(Aes* aes, void* h)
|
||||
void wc_AesEncryptDirect(Aes* aes, byte* out, const byte* in)
|
||||
{
|
||||
byte *key;
|
||||
uint32_t keySize = 0;
|
||||
uint32_t keySize;
|
||||
|
||||
key = (byte*)aes->key;
|
||||
wc_AesGetKeySize(aes, &keySize);
|
||||
|
||||
switch (aes->rounds) {
|
||||
case 10:
|
||||
keySize = 16;
|
||||
break;
|
||||
case 12:
|
||||
keySize = 24;
|
||||
break;
|
||||
case 14:
|
||||
keySize = 32;
|
||||
break;
|
||||
}
|
||||
|
||||
LTC_AES_EncryptEcb( LTC_BASE,
|
||||
in,
|
||||
out,
|
||||
16,
|
||||
key,
|
||||
keySize);
|
||||
LTC_AES_EncryptEcb(LTC_BASE, in, out, AES_BLOCK_SIZE,
|
||||
key, keySize);
|
||||
}
|
||||
|
||||
/* Allow direct access to one block decrypt */
|
||||
void wc_AesDecryptDirect(Aes* aes, byte* out, const byte* in)
|
||||
{
|
||||
byte *key;
|
||||
uint32_t keySize = 0;
|
||||
uint32_t keySize;
|
||||
|
||||
key = (byte*)aes->key;
|
||||
wc_AesGetKeySize(aes, &keySize);
|
||||
|
||||
switch (aes->rounds) {
|
||||
case 10:
|
||||
keySize = 16;
|
||||
break;
|
||||
case 12:
|
||||
keySize = 24;
|
||||
break;
|
||||
case 14:
|
||||
keySize = 32;
|
||||
break;
|
||||
}
|
||||
|
||||
LTC_AES_DecryptEcb( LTC_BASE,
|
||||
in,
|
||||
out,
|
||||
16,
|
||||
key,
|
||||
keySize,
|
||||
kLTC_EncryptKey);
|
||||
LTC_AES_DecryptEcb(LTC_BASE, in, out, AES_BLOCK_SIZE,
|
||||
key, keySize, kLTC_EncryptKey);
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -2120,9 +2089,9 @@ int wc_InitAes_h(Aes* aes, void* h)
|
||||
/* store iv for next call */
|
||||
XMEMCPY(aes->reg, out + sz - AES_BLOCK_SIZE, AES_BLOCK_SIZE);
|
||||
|
||||
sz -= 16;
|
||||
in += 16;
|
||||
out += 16;
|
||||
sz -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
/* disable crypto processor */
|
||||
@@ -2242,9 +2211,9 @@ int wc_InitAes_h(Aes* aes, void* h)
|
||||
/* store iv for next call */
|
||||
XMEMCPY(aes->reg, aes->tmp, AES_BLOCK_SIZE);
|
||||
|
||||
sz -= 16;
|
||||
in += 16;
|
||||
out += 16;
|
||||
sz -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
/* disable crypto processor */
|
||||
@@ -2362,65 +2331,40 @@ int wc_InitAes_h(Aes* aes, void* h)
|
||||
#elif defined(FREESCALE_LTC)
|
||||
int wc_AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
uint32_t keySize = 0;
|
||||
uint32_t keySize;
|
||||
status_t status;
|
||||
byte *iv, *enc_key;
|
||||
|
||||
iv = (byte*)aes->reg;
|
||||
enc_key = (byte*)aes->key;
|
||||
|
||||
switch (aes->rounds) {
|
||||
case 10:
|
||||
keySize = 16;
|
||||
break;
|
||||
case 12:
|
||||
keySize = 24;
|
||||
break;
|
||||
case 14:
|
||||
keySize = 32;
|
||||
break;
|
||||
status = wc_AesGetKeySize(aes, &keySize);
|
||||
if (status != 0) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = LTC_AES_EncryptCbc(LTC_BASE,
|
||||
in,
|
||||
out,
|
||||
sz,
|
||||
iv,
|
||||
enc_key,
|
||||
keySize);
|
||||
status = LTC_AES_EncryptCbc(LTC_BASE, in, out, sz,
|
||||
iv, enc_key, keySize);
|
||||
return (status == kStatus_Success) ? 0 : -1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_AES_DECRYPT
|
||||
int wc_AesCbcDecrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
uint32_t keySize = 0;
|
||||
uint32_t keySize;
|
||||
status_t status;
|
||||
byte* iv, *dec_key;
|
||||
|
||||
iv = (byte*)aes->reg;
|
||||
dec_key = (byte*)aes->key;
|
||||
|
||||
switch (aes->rounds) {
|
||||
case 10:
|
||||
keySize = 16;
|
||||
break;
|
||||
case 12:
|
||||
keySize = 24;
|
||||
break;
|
||||
case 14:
|
||||
keySize = 32;
|
||||
break;
|
||||
status = wc_AesGetKeySize(aes, &keySize);
|
||||
if (status != 0) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = LTC_AES_DecryptCbc(LTC_BASE,
|
||||
in,
|
||||
out,
|
||||
sz,
|
||||
iv,
|
||||
dec_key,
|
||||
keySize,
|
||||
kLTC_EncryptKey);
|
||||
status = LTC_AES_DecryptCbc(LTC_BASE, in, out, sz,
|
||||
iv, dec_key, keySize, kLTC_EncryptKey);
|
||||
return (status == kStatus_Success) ? 0 : -1;
|
||||
}
|
||||
#endif /* HAVE_AES_DECRYPT */
|
||||
@@ -2437,7 +2381,6 @@ int wc_InitAes_h(Aes* aes, void* h)
|
||||
|
||||
iv = (byte*)aes->reg;
|
||||
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
XMEMCPY(temp_block, in + offset, AES_BLOCK_SIZE);
|
||||
@@ -2821,9 +2764,9 @@ int wc_InitAes_h(Aes* aes, void* h)
|
||||
/* store iv for next call */
|
||||
XMEMCPY(aes->reg, out + sz - AES_BLOCK_SIZE, AES_BLOCK_SIZE);
|
||||
|
||||
sz -= 16;
|
||||
in += 16;
|
||||
out += 16;
|
||||
sz -= AES_BLOCK_SIZE;
|
||||
in += AES_BLOCK_SIZE;
|
||||
out += AES_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
/* disable crypto processor */
|
||||
@@ -2894,7 +2837,7 @@ int wc_InitAes_h(Aes* aes, void* h)
|
||||
#elif defined(FREESCALE_LTC)
|
||||
void wc_AesCtrEncrypt(Aes* aes, byte* out, const byte* in, word32 sz)
|
||||
{
|
||||
uint32_t keySize = 0;
|
||||
uint32_t keySize;
|
||||
byte *iv, *enc_key;
|
||||
byte* tmp = (byte*)aes->tmp + AES_BLOCK_SIZE - aes->left;
|
||||
|
||||
@@ -2909,26 +2852,10 @@ int wc_InitAes_h(Aes* aes, void* h)
|
||||
iv = (byte*)aes->reg;
|
||||
enc_key = (byte*)aes->key;
|
||||
|
||||
switch (aes->rounds) {
|
||||
case 10:
|
||||
keySize = 16;
|
||||
break;
|
||||
case 12:
|
||||
keySize = 24;
|
||||
break;
|
||||
case 14:
|
||||
keySize = 32;
|
||||
break;
|
||||
}
|
||||
wc_AesGetKeySize(aes, &keySize);
|
||||
|
||||
LTC_AES_CryptCtr( LTC_BASE,
|
||||
in,
|
||||
out,
|
||||
sz,
|
||||
iv,
|
||||
enc_key,
|
||||
keySize,
|
||||
(byte*)aes->tmp,
|
||||
LTC_AES_CryptCtr(LTC_BASE, in, out, sz,
|
||||
iv, enc_key, keySize, (byte*)aes->tmp,
|
||||
(uint32_t*)&(aes->left));
|
||||
}
|
||||
}
|
||||
@@ -4068,35 +3995,18 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz,
|
||||
{
|
||||
#if defined(FREESCALE_LTC_AES_GCM)
|
||||
byte *key;
|
||||
uint32_t keySize = 0;
|
||||
uint32_t keySize;
|
||||
status_t status;
|
||||
|
||||
key = (byte*)aes->key;
|
||||
|
||||
switch (aes->rounds) {
|
||||
case 10:
|
||||
keySize = 16;
|
||||
break;
|
||||
case 12:
|
||||
keySize = 24;
|
||||
break;
|
||||
case 14:
|
||||
keySize = 32;
|
||||
break;
|
||||
status = wc_AesGetKeySize(aes, &keySize);
|
||||
if (status != 0) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = LTC_AES_EncryptTagGcm( LTC_BASE,
|
||||
in,
|
||||
out,
|
||||
sz,
|
||||
iv,
|
||||
ivSz,
|
||||
authIn,
|
||||
authInSz,
|
||||
key,
|
||||
keySize,
|
||||
authTag,
|
||||
authTagSz);
|
||||
status = LTC_AES_EncryptTagGcm(LTC_BASE, in, out, sz,
|
||||
iv, ivSz, authIn, authInSz, key, keySize, authTag, authTagSz);
|
||||
|
||||
return (status == kStatus_Success) ? 0 : AES_GCM_AUTH_E;
|
||||
|
||||
@@ -4180,35 +4090,18 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz,
|
||||
{
|
||||
#if defined(FREESCALE_LTC_AES_GCM)
|
||||
byte *key;
|
||||
uint32_t keySize = 0;
|
||||
uint32_t keySize;
|
||||
status_t status;
|
||||
|
||||
key = (byte*)aes->key;
|
||||
|
||||
switch (aes->rounds) {
|
||||
case 10:
|
||||
keySize = 16;
|
||||
break;
|
||||
case 12:
|
||||
keySize = 24;
|
||||
break;
|
||||
case 14:
|
||||
keySize = 32;
|
||||
break;
|
||||
status = wc_AesGetKeySize(aes, &keySize);
|
||||
if (status != 0) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = LTC_AES_DecryptTagGcm( LTC_BASE,
|
||||
in,
|
||||
out,
|
||||
sz,
|
||||
iv,
|
||||
ivSz,
|
||||
authIn,
|
||||
authInSz,
|
||||
key,
|
||||
keySize,
|
||||
authTag,
|
||||
authTagSz);
|
||||
status = LTC_AES_DecryptTagGcm(LTC_BASE, in, out, sz,
|
||||
iv, ivSz, authIn, authInSz, key, keySize, authTag, authTagSz);
|
||||
|
||||
return (status == kStatus_Success) ? 0 : AES_GCM_AUTH_E;
|
||||
|
||||
@@ -4417,40 +4310,20 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
|
||||
{
|
||||
#ifdef FREESCALE_LTC
|
||||
byte *key;
|
||||
uint32_t keySize = 0;
|
||||
uint32_t keySize;
|
||||
status_t status;
|
||||
|
||||
key = (byte*)aes->key;
|
||||
|
||||
switch (aes->rounds)
|
||||
{
|
||||
case 10:
|
||||
keySize = 16;
|
||||
break;
|
||||
case 12:
|
||||
keySize = 24;
|
||||
break;
|
||||
case 14:
|
||||
keySize = 32;
|
||||
break;
|
||||
status = wc_AesGetKeySize(aes, &keySize);
|
||||
if (status != 0) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = LTC_AES_EncryptTagCcm(LTC_BASE,
|
||||
in,
|
||||
out,
|
||||
inSz,
|
||||
nonce,
|
||||
nonceSz,
|
||||
authIn,
|
||||
authInSz,
|
||||
key,
|
||||
keySize,
|
||||
authTag,
|
||||
authTagSz);
|
||||
if (kStatus_Success == status)
|
||||
return 0;
|
||||
else
|
||||
return BAD_FUNC_ARG;
|
||||
status = LTC_AES_EncryptTagCcm(LTC_BASE, in, out, inSz,
|
||||
nonce, nonceSz, authIn, authInSz, key, keySize, authTag, authTagSz);
|
||||
|
||||
return (kStatus_Success == status) ? 0 : BAD_FUNC_ARG;
|
||||
#else
|
||||
byte A[AES_BLOCK_SIZE];
|
||||
byte B[AES_BLOCK_SIZE];
|
||||
@@ -4521,35 +4394,18 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
|
||||
{
|
||||
#ifdef FREESCALE_LTC
|
||||
byte *key;
|
||||
uint32_t keySize = 0;
|
||||
uint32_t keySize;
|
||||
status_t status;
|
||||
|
||||
key = (byte*)aes->key;
|
||||
|
||||
switch (aes->rounds) {
|
||||
case 10:
|
||||
keySize = 16;
|
||||
break;
|
||||
case 12:
|
||||
keySize = 24;
|
||||
break;
|
||||
case 14:
|
||||
keySize = 32;
|
||||
break;
|
||||
status = wc_AesGetKeySize(aes, &keySize);
|
||||
if (status != 0) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = LTC_AES_DecryptTagCcm( LTC_BASE,
|
||||
in,
|
||||
out,
|
||||
inSz,
|
||||
nonce,
|
||||
nonceSz,
|
||||
authIn,
|
||||
authInSz,
|
||||
key,
|
||||
keySize,
|
||||
authTag,
|
||||
authTagSz);
|
||||
status = LTC_AES_DecryptTagCcm(LTC_BASE, in, out, inSz,
|
||||
nonce, nonceSz, authIn, authInSz, key, keySize, authTag, authTagSz);
|
||||
|
||||
if (status == kStatus_Success) {
|
||||
return 0;
|
||||
@@ -4671,7 +4527,34 @@ void wc_AesAsyncFree(Aes* aes)
|
||||
|
||||
#endif /* WOLFSSL_ASYNC_CRYPT */
|
||||
|
||||
#endif /* WOLFSSL_TI_CRYPT */
|
||||
|
||||
int wc_AesGetKeySize(Aes* aes, word32* keySize)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (aes == NULL || keySize == NULL) {
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
switch (aes->rounds) {
|
||||
case 10:
|
||||
*keySize = 16;
|
||||
break;
|
||||
case 12:
|
||||
*keySize = 24;
|
||||
break;
|
||||
case 14:
|
||||
*keySize = 32;
|
||||
break;
|
||||
default:
|
||||
*keySize = 0;
|
||||
ret = BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !WOLFSSL_TI_CRYPT */
|
||||
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
|
@@ -104,7 +104,26 @@ ASN Options:
|
||||
#endif
|
||||
|
||||
#ifndef NO_ASN_TIME
|
||||
#if defined(HAVE_RTP_SYS)
|
||||
#if defined(USER_TIME)
|
||||
/* user time, and gmtime compatible functions, there is a gmtime
|
||||
implementation here that WINCE uses, so really just need some ticks
|
||||
since the EPOCH
|
||||
*/
|
||||
#define WOLFSSL_GMTIME
|
||||
#define USE_WOLF_TM
|
||||
#define USE_WOLF_TIME_T
|
||||
|
||||
#elif defined(TIME_OVERRIDES)
|
||||
/* user would like to override time() and gmtime() functionality */
|
||||
#ifndef HAVE_TIME_T_TYPE
|
||||
#define USE_WOLF_TIME_T
|
||||
#endif
|
||||
#ifndef HAVE_TM_TYPE
|
||||
#define USE_WOLF_TM
|
||||
#endif
|
||||
#define NEED_TMP_TIME
|
||||
|
||||
#elif defined(HAVE_RTP_SYS)
|
||||
/* uses parital <time.h> structures */
|
||||
#define XTIME(tl) (0)
|
||||
#define XGMTIME(c, t) rtpsys_gmtime((c))
|
||||
@@ -134,25 +153,6 @@ ASN Options:
|
||||
#endif
|
||||
#define XGMTIME(c, t) gmtime((c))
|
||||
|
||||
#elif defined(USER_TIME)
|
||||
/* user time, and gmtime compatible functions, there is a gmtime
|
||||
implementation here that WINCE uses, so really just need some ticks
|
||||
since the EPOCH
|
||||
*/
|
||||
#define WOLFSSL_GMTIME
|
||||
#define USE_WOLF_TM
|
||||
#define USE_WOLF_TIME_T
|
||||
|
||||
#elif defined(TIME_OVERRIDES)
|
||||
/* user would like to override time() and gmtime() functionality */
|
||||
#ifndef HAVE_TIME_T_TYPE
|
||||
#define USE_WOLF_TIME_T
|
||||
#endif
|
||||
#ifndef HAVE_TM_TYPE
|
||||
#define USE_WOLF_TM
|
||||
#endif
|
||||
#define NEED_TMP_TIME
|
||||
|
||||
#elif defined(IDIRECT_DEV_TIME)
|
||||
/*Gets the timestamp from cloak software owned by VT iDirect
|
||||
in place of time() from <time.h> */
|
||||
|
@@ -41,7 +41,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(FREESCALE_LTC_ECC)
|
||||
#include "nxp/ksdk_port.h"
|
||||
#include <wolfssl/wolfcrypt/port/nxp/ksdk_port.h>
|
||||
#endif
|
||||
|
||||
const curve25519_set_type curve25519_sets[] = {
|
||||
@@ -53,11 +53,11 @@ const curve25519_set_type curve25519_sets[] = {
|
||||
|
||||
int wc_curve25519_make_key(WC_RNG* rng, int keysize, curve25519_key* key)
|
||||
{
|
||||
#ifdef FREESCALE_LTC_ECC
|
||||
ECPoint * basepoint = wc_curve25519_GetBasePoint();
|
||||
#else
|
||||
#ifdef FREESCALE_LTC_ECC
|
||||
const ECPoint* basepoint = wc_curve25519_GetBasePoint();
|
||||
#else
|
||||
unsigned char basepoint[CURVE25519_KEYSIZE] = {9};
|
||||
#endif
|
||||
#endif
|
||||
int ret;
|
||||
|
||||
if (key == NULL || rng == NULL)
|
||||
@@ -79,7 +79,7 @@ int wc_curve25519_make_key(WC_RNG* rng, int keysize, curve25519_key* key)
|
||||
|
||||
/* compute public key */
|
||||
#ifdef FREESCALE_LTC_ECC
|
||||
ret = wc_curve25519(&key->p, key->k.point, basepoint, kLTC_Weierstrass /* input basepoint on Weierstrass curve */);
|
||||
ret = wc_curve25519(&key->p, key->k.point, basepoint, kLTC_Weierstrass); /* input basepoint on Weierstrass curve */
|
||||
#else
|
||||
ret = curve25519(key->p.point, key->k.point, basepoint);
|
||||
#endif
|
||||
|
@@ -104,7 +104,7 @@ ECC Curve Sizes:
|
||||
#endif
|
||||
|
||||
#if defined(FREESCALE_LTC_ECC)
|
||||
#include "nxp/ksdk_port.h"
|
||||
#include <wolfssl/wolfcrypt/port/nxp/ksdk_port.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_FAST_MATH
|
||||
@@ -983,7 +983,6 @@ static int get_digit_count(mp_int* a)
|
||||
}
|
||||
|
||||
/* helper for either lib */
|
||||
#ifndef FREESCALE_LTC_ECC
|
||||
static mp_digit get_digit(mp_int* a, int n)
|
||||
{
|
||||
if (a == NULL)
|
||||
@@ -991,7 +990,6 @@ static mp_digit get_digit(mp_int* a, int n)
|
||||
|
||||
return (n >= a->used || n < 0) ? 0 : a->dp[n];
|
||||
}
|
||||
#endif /* FREESCALE_LTC_ECC */
|
||||
|
||||
/**
|
||||
Add two ECC points
|
||||
@@ -1651,6 +1649,7 @@ done:
|
||||
return err;
|
||||
}
|
||||
|
||||
#if !defined(FREESCALE_LTC_ECC)
|
||||
|
||||
#ifndef ECC_TIMING_RESISTANT
|
||||
|
||||
@@ -1926,7 +1925,6 @@ int wc_ecc_mulmod(mp_int* k, ecc_point *G, ecc_point *R, mp_int* a,
|
||||
(1==map, 0 == leave in projective)
|
||||
return MP_OKAY on success
|
||||
*/
|
||||
#if !defined(FREESCALE_LTC_ECC)
|
||||
#ifdef FP_ECC
|
||||
static int normal_ecc_mulmod(mp_int* k, ecc_point *G, ecc_point *R,
|
||||
mp_int* a, mp_int* modulus, int map, void* heap)
|
||||
@@ -2118,7 +2116,6 @@ int wc_ecc_mulmod_ex(mp_int* k, ecc_point *G, ecc_point *R,
|
||||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* FREESCALE_LTC_ECC */
|
||||
|
||||
|
||||
#ifndef FP_ECC
|
||||
@@ -2130,6 +2127,8 @@ int wc_ecc_mulmod(mp_int* k, ecc_point *G, ecc_point *R, mp_int* a,
|
||||
#endif /* ! FP_ECC */
|
||||
#endif /* ECC_TIMING_RESISTANT */
|
||||
|
||||
#endif /* !FREESCALE_LTC_ECC */
|
||||
|
||||
|
||||
#ifdef ALT_ECC_SIZE
|
||||
|
||||
@@ -2432,7 +2431,8 @@ int wc_ecc_shared_secret_ssh(ecc_key* private_key, ecc_point* point,
|
||||
err = mp_read_radix(&a, private_key->dp->Af, 16);
|
||||
|
||||
if (err == MP_OKAY)
|
||||
err = wc_ecc_mulmod(&private_key->k, point, result, &a, &prime, 1);
|
||||
err = wc_ecc_mulmod_ex(&private_key->k, point, result, &a, &prime, 1,
|
||||
private_key->heap);
|
||||
|
||||
if (err == MP_OKAY) {
|
||||
x = mp_unsigned_bin_size(&prime);
|
||||
@@ -2588,6 +2588,12 @@ int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id)
|
||||
err = mp_mod(&key->k, &order, &key->k);
|
||||
}
|
||||
|
||||
/* the key should be smaller than the order of base point */
|
||||
if (err == MP_OKAY) {
|
||||
if (mp_cmp(&key->k, &order) != MP_LT)
|
||||
err = mp_mod(&key->k, &order, &key->k);
|
||||
}
|
||||
|
||||
/* make the public key */
|
||||
if (err == MP_OKAY)
|
||||
err = wc_ecc_mulmod_ex(&key->k, base, &key->pubkey, &a, &prime, 1,
|
||||
@@ -3374,9 +3380,9 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
|
||||
#ifdef FREESCALE_LTC_ECC
|
||||
/* use PKHA to compute u1*mG + u2*mQ */
|
||||
if (err == MP_OKAY)
|
||||
err = wc_ecc_mulmod(&u1, mG, mG, &m, 0);
|
||||
err = wc_ecc_mulmod_ex(&u1, mG, mG, &m, 0, NULL);
|
||||
if (err == MP_OKAY)
|
||||
err = wc_ecc_mulmod(&u2, mQ, mQ, &m, 0);
|
||||
err = wc_ecc_mulmod_ex(&u2, mQ, mQ, &m, 0, NULL);
|
||||
if (err == MP_OKAY)
|
||||
err = wc_ecc_point_add(mG, mQ, mG, &m);
|
||||
#else /* FREESCALE_LTC_ECC */
|
||||
@@ -5656,6 +5662,7 @@ int ecc_mul2add(ecc_point* A, mp_int* kA,
|
||||
}
|
||||
#endif /* ECC_SHAMIR */
|
||||
|
||||
#if !defined(FREESCALE_LTC_TFM)
|
||||
/** ECC Fixed Point mulmod global
|
||||
k The multiplicand
|
||||
G Base point to multiply
|
||||
@@ -5671,7 +5678,7 @@ int wc_ecc_mulmod(mp_int* k, ecc_point *G, ecc_point *R, mp_int* a,
|
||||
{
|
||||
return wc_ecc_mulmod_ex(k, G, R, a, modulus, map, NULL);
|
||||
}
|
||||
|
||||
#endif /* !FREESCALE_LTC_TFM */
|
||||
|
||||
/** ECC Fixed Point mulmod global
|
||||
k The multiplicand
|
||||
|
@@ -42,7 +42,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef FREESCALE_LTC_ECC
|
||||
#include "nxp/ksdk_port.h"
|
||||
#include <wolfssl/wolfcrypt/port/nxp/ksdk_port.h>
|
||||
#endif
|
||||
|
||||
/* generate an ed25519 key pair.
|
||||
|
@@ -4628,7 +4628,9 @@ LBL_U:mp_clear (&v);
|
||||
/* chars used in radix conversions */
|
||||
const char *mp_s_rmap = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\
|
||||
abcdefghijklmnopqrstuvwxyz+/";
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ECC
|
||||
/* read a string [ASCII] in a given radix */
|
||||
int mp_read_radix (mp_int * a, const char *str, int radix)
|
||||
{
|
||||
@@ -4692,6 +4694,7 @@ int mp_read_radix (mp_int * a, const char *str, int radix)
|
||||
}
|
||||
return MP_OKAY;
|
||||
}
|
||||
#endif /* HAVE_ECC */
|
||||
|
||||
#if defined(WOLFSSL_KEY_GEN) || defined(HAVE_COMP_KEY) || \
|
||||
defined(WOLFSSL_DEBUG_MATH)
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -154,7 +154,7 @@ int wc_RsaFlattenPublicKey(RsaKey* key, byte* a, word32* aSz, byte* b,
|
||||
#endif /* WOLFSSL_ASYNC_CRYPT */
|
||||
|
||||
#ifdef FREESCALE_LTC_TFM
|
||||
#include <nxp/ksdk_port.h>
|
||||
#include <wolfssl/wolfcrypt/port/nxp/ksdk_port.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
|
@@ -20,13 +20,13 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
|
||||
#if !defined(NO_SHA)
|
||||
|
||||
#include <wolfssl/wolfcrypt/sha.h>
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <wolfcrypt/src/misc.c>
|
||||
#endif
|
||||
|
||||
|
||||
/* fips wrapper calls, user can call direct */
|
||||
#ifdef HAVE_FIPS
|
||||
int wc_InitSha(Sha* sha)
|
||||
@@ -47,13 +48,11 @@
|
||||
return InitSha_fips(sha);
|
||||
}
|
||||
|
||||
|
||||
int wc_ShaUpdate(Sha* sha, const byte* data, word32 len)
|
||||
{
|
||||
return ShaUpdate_fips(sha, data, len);
|
||||
}
|
||||
|
||||
|
||||
int wc_ShaFinal(Sha* sha, byte* out)
|
||||
{
|
||||
return ShaFinal_fips(sha,out);
|
||||
@@ -61,35 +60,30 @@
|
||||
|
||||
#else /* else build without fips */
|
||||
|
||||
|
||||
/****************************************/
|
||||
/* SHA Hardware Variations */
|
||||
/****************************************/
|
||||
#if defined(WOLFSSL_TI_HASH)
|
||||
/* #include <wolfcrypt/src/port/ti/ti-hash.c> included by wc_port.c */
|
||||
#else
|
||||
|
||||
#ifdef WOLFSSL_PIC32MZ_HASH
|
||||
#define wc_InitSha wc_InitSha_sw
|
||||
#define wc_ShaUpdate wc_ShaUpdate_sw
|
||||
#define wc_ShaFinal wc_ShaFinal_sw
|
||||
#endif
|
||||
#elif defined(WOLFSSL_PIC32MZ_HASH)
|
||||
#define USE_SHA_SOFTWARE_IMPL
|
||||
#define wc_InitSha wc_InitSha_sw
|
||||
#define wc_ShaUpdate wc_ShaUpdate_sw
|
||||
#define wc_ShaFinal wc_ShaFinal_sw
|
||||
|
||||
|
||||
#ifdef FREESCALE_MMCAU_SHA
|
||||
#include "fsl_mmcau.h"
|
||||
#define XTRANSFORM(S,B) Transform((S), (B))
|
||||
#else
|
||||
#define XTRANSFORM(S,B) Transform((S))
|
||||
#endif
|
||||
|
||||
#ifdef STM32F2_HASH
|
||||
/*
|
||||
#elif defined(STM32F2_HASH)
|
||||
/*
|
||||
* STM32F2 hardware SHA1 support through the STM32F2 standard peripheral
|
||||
* library. Documentation located in STM32F2xx Standard Peripheral Library
|
||||
* document (See note in README).
|
||||
*/
|
||||
#include "stm32f2xx.h"
|
||||
#include "stm32f2xx_hash.h"
|
||||
#include "stm32f2xx.h"
|
||||
#include "stm32f2xx_hash.h"
|
||||
|
||||
int wc_InitSha(Sha* sha)
|
||||
{
|
||||
int wc_InitSha(Sha* sha)
|
||||
{
|
||||
/* STM32F2 struct notes:
|
||||
* sha->buffer = first 4 bytes used to hold partial block if needed
|
||||
* sha->buffLen = num bytes currently stored in sha->buffer
|
||||
@@ -111,10 +105,10 @@ int wc_InitSha(Sha* sha)
|
||||
HASH->CR |= HASH_CR_INIT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int wc_ShaUpdate(Sha* sha, const byte* data, word32 len)
|
||||
{
|
||||
int wc_ShaUpdate(Sha* sha, const byte* data, word32 len)
|
||||
{
|
||||
word32 i = 0;
|
||||
word32 fill = 0;
|
||||
word32 diff = 0;
|
||||
@@ -159,10 +153,10 @@ int wc_ShaUpdate(Sha* sha, const byte* data, word32 len)
|
||||
sha->loLen += (len - sha->buffLen);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int wc_ShaFinal(Sha* sha, byte* hash)
|
||||
{
|
||||
int wc_ShaFinal(Sha* sha, byte* hash)
|
||||
{
|
||||
__IO uint16_t nbvalidbitsdata = 0;
|
||||
|
||||
/* finish reading any trailing bytes into FIFO */
|
||||
@@ -195,92 +189,124 @@ int wc_ShaFinal(Sha* sha, byte* hash)
|
||||
XMEMCPY(hash, sha->digest, SHA_DIGEST_SIZE);
|
||||
|
||||
return wc_InitSha(sha); /* reset state */
|
||||
}
|
||||
|
||||
#else /* wc_ software implementation */
|
||||
|
||||
#ifndef WOLFSSL_HAVE_MIN
|
||||
#define WOLFSSL_HAVE_MIN
|
||||
|
||||
static INLINE word32 min(word32 a, word32 b)
|
||||
{
|
||||
return a > b ? b : a;
|
||||
}
|
||||
|
||||
#endif /* WOLFSSL_HAVE_MIN */
|
||||
|
||||
#ifdef FREESCALE_LTC_SHA
|
||||
int wc_InitSha(Sha* sha)
|
||||
{
|
||||
#elif defined(FREESCALE_LTC_SHA)
|
||||
|
||||
#include "fsl_ltc.h"
|
||||
int wc_InitSha(Sha* sha)
|
||||
{
|
||||
LTC_HASH_Init(LTC_BASE, &sha->ctx, kLTC_Sha1, NULL, 0);
|
||||
return 0;
|
||||
}
|
||||
#else /* FREESCALE_LTC_SHA */
|
||||
int wc_InitSha(Sha* sha)
|
||||
{
|
||||
}
|
||||
|
||||
int wc_ShaUpdate(Sha* sha, const byte* data, word32 len)
|
||||
{
|
||||
LTC_HASH_Update(&sha->ctx, data, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wc_ShaFinal(Sha* sha, byte* hash)
|
||||
{
|
||||
uint32_t hashlen = SHA_DIGEST_SIZE;
|
||||
LTC_HASH_Finish(&sha->ctx, hash, &hashlen);
|
||||
return wc_InitSha(sha); /* reset state */
|
||||
}
|
||||
|
||||
|
||||
#elif defined(FREESCALE_MMCAU_SHA)
|
||||
|
||||
#include "fsl_mmcau.h"
|
||||
#define USE_SHA_SOFTWARE_IMPL /* Only for API's, actual transform is here */
|
||||
#define XSHATRANSFORM ShaTransform
|
||||
|
||||
int wc_InitSha(Sha* sha)
|
||||
{
|
||||
int ret = 0;
|
||||
#ifdef FREESCALE_MMCAU_SHA
|
||||
ret = wolfSSL_CryptHwMutexLock();
|
||||
if(ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
MMCAU_SHA1_InitializeOutput((uint32_t*)sha->digest);
|
||||
wolfSSL_CryptHwMutexUnLock();
|
||||
#else
|
||||
sha->digest[0] = 0x67452301L;
|
||||
sha->digest[1] = 0xEFCDAB89L;
|
||||
sha->digest[2] = 0x98BADCFEL;
|
||||
sha->digest[3] = 0x10325476L;
|
||||
sha->digest[4] = 0xC3D2E1F0L;
|
||||
#endif
|
||||
|
||||
sha->buffLen = 0;
|
||||
sha->loLen = 0;
|
||||
sha->hiLen = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif /* FREESCALE_LTC_SHA */
|
||||
}
|
||||
|
||||
#ifdef FREESCALE_MMCAU_SHA
|
||||
static int Transform(Sha* sha, byte* data)
|
||||
{
|
||||
static int ShaTransform(Sha* sha, byte* data)
|
||||
{
|
||||
int ret = wolfSSL_CryptHwMutexLock();
|
||||
if(ret == 0) {
|
||||
MMCAU_SHA1_HashN(data, 1, (uint32_t*)sha->digest);
|
||||
wolfSSL_CryptHwMutexUnLock();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
#endif /* FREESCALE_MMCAU_SHA */
|
||||
}
|
||||
|
||||
#if !(defined(FREESCALE_MMCAU_SHA) || defined(FREESCALE_LTC_SHA))
|
||||
#else
|
||||
|
||||
#define blk0(i) (W[i] = sha->buffer[i])
|
||||
#define blk1(i) (W[(i)&15] = \
|
||||
rotlFixed(W[((i)+13)&15]^W[((i)+8)&15]^W[((i)+2)&15]^W[(i)&15],1))
|
||||
/* Software implementation */
|
||||
#define USE_SHA_SOFTWARE_IMPL
|
||||
|
||||
#define f1(x,y,z) ((z)^((x) &((y)^(z))))
|
||||
#define f2(x,y,z) ((x)^(y)^(z))
|
||||
#define f3(x,y,z) (((x)&(y))|((z)&((x)|(y))))
|
||||
#define f4(x,y,z) ((x)^(y)^(z))
|
||||
int wc_InitSha(Sha* sha)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
|
||||
#define R0(v,w,x,y,z,i) (z)+= f1((w),(x),(y)) + blk0((i)) + 0x5A827999+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
#define R1(v,w,x,y,z,i) (z)+= f1((w),(x),(y)) + blk1((i)) + 0x5A827999+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
#define R2(v,w,x,y,z,i) (z)+= f2((w),(x),(y)) + blk1((i)) + 0x6ED9EBA1+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
#define R3(v,w,x,y,z,i) (z)+= f3((w),(x),(y)) + blk1((i)) + 0x8F1BBCDC+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
#define R4(v,w,x,y,z,i) (z)+= f4((w),(x),(y)) + blk1((i)) + 0xCA62C1D6+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
sha->digest[0] = 0x67452301L;
|
||||
sha->digest[1] = 0xEFCDAB89L;
|
||||
sha->digest[2] = 0x98BADCFEL;
|
||||
sha->digest[3] = 0x10325476L;
|
||||
sha->digest[4] = 0xC3D2E1F0L;
|
||||
|
||||
static void Transform(Sha* sha)
|
||||
{
|
||||
sha->buffLen = 0;
|
||||
sha->loLen = 0;
|
||||
sha->hiLen = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Software implementation */
|
||||
#ifdef USE_SHA_SOFTWARE_IMPL
|
||||
|
||||
/* Check if custom Sha transform is used */
|
||||
#ifndef XSHATRANSFORM
|
||||
#define XSHATRANSFORM ShaTransform
|
||||
|
||||
#define blk0(i) (W[i] = sha->buffer[i])
|
||||
#define blk1(i) (W[(i)&15] = \
|
||||
rotlFixed(W[((i)+13)&15]^W[((i)+8)&15]^W[((i)+2)&15]^W[(i)&15],1))
|
||||
|
||||
#define f1(x,y,z) ((z)^((x) &((y)^(z))))
|
||||
#define f2(x,y,z) ((x)^(y)^(z))
|
||||
#define f3(x,y,z) (((x)&(y))|((z)&((x)|(y))))
|
||||
#define f4(x,y,z) ((x)^(y)^(z))
|
||||
|
||||
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
|
||||
#define R0(v,w,x,y,z,i) (z)+= f1((w),(x),(y)) + blk0((i)) + 0x5A827999+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
#define R1(v,w,x,y,z,i) (z)+= f1((w),(x),(y)) + blk1((i)) + 0x5A827999+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
#define R2(v,w,x,y,z,i) (z)+= f2((w),(x),(y)) + blk1((i)) + 0x6ED9EBA1+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
#define R3(v,w,x,y,z,i) (z)+= f3((w),(x),(y)) + blk1((i)) + 0x8F1BBCDC+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
#define R4(v,w,x,y,z,i) (z)+= f4((w),(x),(y)) + blk1((i)) + 0xCA62C1D6+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
|
||||
static void ShaTransform(Sha* sha, byte* data)
|
||||
{
|
||||
word32 W[SHA_BLOCK_SIZE / sizeof(word32)];
|
||||
|
||||
(void)data; /* Not used */
|
||||
|
||||
/* Copy context->state[] to working vars */
|
||||
word32 a = sha->digest[0];
|
||||
word32 b = sha->digest[1];
|
||||
@@ -288,7 +314,7 @@ static void Transform(Sha* sha)
|
||||
word32 d = sha->digest[3];
|
||||
word32 e = sha->digest[4];
|
||||
|
||||
#ifdef USE_SLOW_SHA
|
||||
#ifdef USE_SLOW_SHA
|
||||
word32 t, i;
|
||||
|
||||
for (i = 0; i < 16; i++) {
|
||||
@@ -315,7 +341,7 @@ static void Transform(Sha* sha)
|
||||
R4(a, b, c, d, e, i);
|
||||
t = e; e = d; d = c; c = b; b = a; a = t;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
/* nearly 1 K bigger in code size but 25% faster */
|
||||
/* 4 rounds of 20 operations each. Loop unrolled. */
|
||||
R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
|
||||
@@ -342,7 +368,7 @@ static void Transform(Sha* sha)
|
||||
R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
|
||||
R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
|
||||
R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Add the working vars back into digest state[] */
|
||||
sha->digest[0] += a;
|
||||
@@ -350,17 +376,17 @@ static void Transform(Sha* sha)
|
||||
sha->digest[2] += c;
|
||||
sha->digest[3] += d;
|
||||
sha->digest[4] += e;
|
||||
}
|
||||
}
|
||||
#endif /* !USE_CUSTOM_SHA_TRANSFORM */
|
||||
|
||||
#endif /* FREESCALE_MMCAU_SHA */
|
||||
|
||||
#ifdef FREESCALE_LTC_SHA
|
||||
int wc_ShaUpdate(Sha* sha, const byte* data, word32 len)
|
||||
{
|
||||
LTC_HASH_Update(&sha->ctx, data, len);
|
||||
return 0;
|
||||
}
|
||||
#else /* FREESCALE_LTC_SHA */
|
||||
#ifndef WOLFSSL_HAVE_MIN
|
||||
#define WOLFSSL_HAVE_MIN
|
||||
static INLINE word32 min(word32 a, word32 b) {
|
||||
return a > b ? b : a;
|
||||
}
|
||||
#endif /* WOLFSSL_HAVE_MIN */
|
||||
|
||||
static INLINE void AddLength(Sha* sha, word32 len)
|
||||
{
|
||||
word32 tmp = sha->loLen;
|
||||
@@ -386,7 +412,7 @@ int wc_ShaUpdate(Sha* sha, const byte* data, word32 len)
|
||||
#if defined(LITTLE_ENDIAN_ORDER) && !defined(FREESCALE_MMCAU_SHA)
|
||||
ByteReverseWords(sha->buffer, sha->buffer, SHA_BLOCK_SIZE);
|
||||
#endif
|
||||
XTRANSFORM(sha, local);
|
||||
XSHATRANSFORM(sha, local);
|
||||
AddLength(sha, SHA_BLOCK_SIZE);
|
||||
sha->buffLen = 0;
|
||||
}
|
||||
@@ -394,16 +420,7 @@ int wc_ShaUpdate(Sha* sha, const byte* data, word32 len)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* FREESCALE_LTC_SHA */
|
||||
|
||||
#ifdef FREESCALE_LTC_SHA
|
||||
int wc_ShaFinal(Sha* sha, byte* hash)
|
||||
{
|
||||
uint32_t hashlen = SHA_DIGEST_SIZE;
|
||||
LTC_HASH_Finish(&sha->ctx, hash, &hashlen);
|
||||
return wc_InitSha(sha); /* reset state */
|
||||
}
|
||||
#else /* FREESCALE_LTC_SHA */
|
||||
int wc_ShaFinal(Sha* sha, byte* hash)
|
||||
{
|
||||
byte* local = (byte*)sha->buffer;
|
||||
@@ -420,7 +437,7 @@ int wc_ShaFinal(Sha* sha, byte* hash)
|
||||
#if defined(LITTLE_ENDIAN_ORDER) && !defined(FREESCALE_MMCAU_SHA)
|
||||
ByteReverseWords(sha->buffer, sha->buffer, SHA_BLOCK_SIZE);
|
||||
#endif
|
||||
XTRANSFORM(sha, local);
|
||||
XSHATRANSFORM(sha, local);
|
||||
sha->buffLen = 0;
|
||||
}
|
||||
XMEMSET(&local[sha->buffLen], 0, SHA_PAD_SIZE - sha->buffLen);
|
||||
@@ -445,7 +462,7 @@ int wc_ShaFinal(Sha* sha, byte* hash)
|
||||
2 * sizeof(word32));
|
||||
#endif
|
||||
|
||||
XTRANSFORM(sha, local);
|
||||
XSHATRANSFORM(sha, local);
|
||||
#ifdef LITTLE_ENDIAN_ORDER
|
||||
ByteReverseWords(sha->digest, sha->digest, SHA_DIGEST_SIZE);
|
||||
#endif
|
||||
@@ -453,13 +470,8 @@ int wc_ShaFinal(Sha* sha, byte* hash)
|
||||
|
||||
return wc_InitSha(sha); /* reset state */
|
||||
}
|
||||
#endif /* FREESCALE_LTC_SHA */
|
||||
|
||||
#endif /* STM32F2_HASH */
|
||||
|
||||
|
||||
#endif /* USE_SHA_SOFTWARE_IMPL */
|
||||
|
||||
#endif /* HAVE_FIPS */
|
||||
#endif /* WOLFSSL_TI_HASH */
|
||||
#endif /* NO_SHA */
|
||||
|
||||
#endif /* !NO_SHA */
|
||||
|
@@ -51,7 +51,7 @@
|
||||
#include <wolfcrypt/src/asm.c> /* will define asm MACROS or C ones */
|
||||
|
||||
#if defined(FREESCALE_LTC_TFM)
|
||||
#include "nxp/ksdk_port.h"
|
||||
#include <wolfssl/wolfcrypt/port/nxp/ksdk_port.h>
|
||||
#endif
|
||||
#ifdef WOLFSSL_DEBUG_MATH
|
||||
#include <stdio.h>
|
||||
|
@@ -35,6 +35,10 @@
|
||||
#include <ippcp.h>
|
||||
#endif
|
||||
|
||||
#if defined(FREESCALE_LTC_TFM)
|
||||
#include <wolfssl/wolfcrypt/port/nxp/ksdk_port.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */
|
||||
#pragma warning(disable: 4996)
|
||||
@@ -69,6 +73,10 @@ int wolfCrypt_Init()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FREESCALE_LTC_TFM) || defined(FREESCALE_LTC_ECC)
|
||||
ksdk_port_init();
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_ARMASM
|
||||
WOLFSSL_MSG("Using ARM hardware acceleration");
|
||||
#endif
|
||||
|
@@ -167,6 +167,8 @@ WOLFSSL_API int wc_AesCbcDecrypt(Aes* aes, byte* out,
|
||||
const byte* authIn, word32 authInSz);
|
||||
#endif /* HAVE_AESCCM */
|
||||
|
||||
WOLFSSL_API int wc_AesGetKeySize(Aes* aes, word32* keySize);
|
||||
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
WOLFSSL_API int wc_AesAsyncInit(Aes*, int);
|
||||
WOLFSSL_API void wc_AesAsyncFree(Aes*);
|
||||
|
@@ -1,12 +1,22 @@
|
||||
/* ksdk_port.h
|
||||
*
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc. All rights reserved.
|
||||
* Copyright (C) 2006-2016 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL.
|
||||
*
|
||||
* Contact licensing@wolfssl.com with any questions or comments.
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* http://www.wolfssl.com
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
||||
*/
|
||||
|
||||
#ifndef _KSDK_PORT_H_
|
||||
@@ -18,6 +28,10 @@
|
||||
#include <wolfssl/wolfcrypt/curve25519.h>
|
||||
#include <wolfssl/wolfcrypt/ed25519.h>
|
||||
|
||||
|
||||
/* API to init required hardware */
|
||||
int ksdk_port_init(void);
|
||||
|
||||
/* software algorithm, by wolfcrypt */
|
||||
#if defined(FREESCALE_LTC_TFM)
|
||||
void wolfcrypt_fp_mul(fp_int *A, fp_int *B, fp_int *C);
|
||||
@@ -34,7 +48,6 @@
|
||||
#endif /* FREESCALE_LTC_TFM */
|
||||
|
||||
#if defined(FREESCALE_LTC_ECC)
|
||||
|
||||
#include "fsl_ltc.h"
|
||||
|
||||
typedef enum _fsl_ltc_ecc_coordinate_system
|
||||
@@ -47,8 +60,8 @@
|
||||
int wc_ecc_point_add(ecc_point *mG, ecc_point *mQ, ecc_point *mR, mp_int *m);
|
||||
|
||||
#ifdef HAVE_CURVE25519
|
||||
int wc_curve25519(ECPoint *q, byte *n, ECPoint *p, fsl_ltc_ecc_coordinate_system_t type);
|
||||
ECPoint *wc_curve25519_GetBasePoint(void);
|
||||
int wc_curve25519(ECPoint *q, byte *n, const ECPoint *p, fsl_ltc_ecc_coordinate_system_t type);
|
||||
const ECPoint *wc_curve25519_GetBasePoint(void);
|
||||
status_t LTC_PKHA_Curve25519ToWeierstrass(const ltc_pkha_ecc_point_t *ltcPointIn, ltc_pkha_ecc_point_t *ltcPointOut);
|
||||
status_t LTC_PKHA_WeierstrassToCurve25519(const ltc_pkha_ecc_point_t *ltcPointIn, ltc_pkha_ecc_point_t *ltcPointOut);
|
||||
status_t LTC_PKHA_Curve25519ComputeY(ltc_pkha_ecc_point_t *ltcPoint);
|
||||
|
@@ -185,7 +185,9 @@
|
||||
#if defined(WOLFSSL_IAR_ARM) || defined(WOLFSSL_ROWLEY_ARM)
|
||||
#define NO_MAIN_DRIVER
|
||||
#define SINGLE_THREADED
|
||||
#if !defined(USE_CERT_BUFFERS_2048) && !defined(USE_CERT_BUFFERS_4096)
|
||||
#define USE_CERT_BUFFERS_1024
|
||||
#endif
|
||||
#define BENCH_EMBEDDED
|
||||
#define NO_FILESYSTEM
|
||||
#define NO_WRITEV
|
||||
@@ -237,7 +239,9 @@
|
||||
#define WOLFSSL_USER_IO
|
||||
#define NO_FILESYSTEM
|
||||
#define NO_CERT
|
||||
#if !defined(USE_CERT_BUFFERS_2048) && !defined(USE_CERT_BUFFERS_4096)
|
||||
#define USE_CERT_BUFFERS_1024
|
||||
#endif
|
||||
#define NO_WRITEV
|
||||
#define NO_DEV_RANDOM
|
||||
#define NO_SHA512
|
||||
@@ -769,10 +773,10 @@ static char *fgets(char *buff, int sz, FILE *fp)
|
||||
|
||||
#define TFM_TIMING_RESISTANT
|
||||
#define ECC_TIMING_RESISTANT
|
||||
//#define ALT_ECC_SIZE
|
||||
|
||||
#undef HAVE_ECC
|
||||
#define HAVE_ECC
|
||||
#ifndef NO_AES
|
||||
#undef HAVE_AESCCM
|
||||
#define HAVE_AESCCM
|
||||
#undef HAVE_AESGCM
|
||||
@@ -781,6 +785,7 @@ static char *fgets(char *buff, int sz, FILE *fp)
|
||||
#define WOLFSSL_AES_COUNTER
|
||||
#undef WOLFSSL_AES_DIRECT
|
||||
#define WOLFSSL_AES_DIRECT
|
||||
#endif
|
||||
|
||||
#include "fsl_common.h"
|
||||
|
||||
@@ -849,7 +854,9 @@ static char *fgets(char *buff, int sz, FILE *fp)
|
||||
|
||||
/* the LTC PKHA hardware limit is 2048 bits (256 bytes) for integer arithmetic.
|
||||
the LTC_MAX_INT_BYTES defines the size of local variables that hold big integers. */
|
||||
#ifndef LTC_MAX_INT_BYTES
|
||||
#define LTC_MAX_INT_BYTES (256)
|
||||
#endif
|
||||
|
||||
/* This FREESCALE_LTC_TFM_RSA_4096_ENABLE macro can be defined.
|
||||
* In such a case both software and hardware algorithm
|
||||
@@ -857,7 +864,7 @@ static char *fgets(char *buff, int sz, FILE *fp)
|
||||
* from size of inputs. If inputs and result can fit into LTC (see LTC_MAX_INT_BYTES)
|
||||
* then we call hardware algorithm, otherwise we call software algorithm.
|
||||
*
|
||||
* Chinese reminder theorem is used to break RSA 4096 exponentiations (both public and prive key)
|
||||
* Chinese reminder theorem is used to break RSA 4096 exponentiations (both public and private key)
|
||||
* into several computations with 2048-bit modulus and exponents.
|
||||
*/
|
||||
/* #define FREESCALE_LTC_TFM_RSA_4096_ENABLE */
|
||||
@@ -870,14 +877,18 @@ static char *fgets(char *buff, int sz, FILE *fp)
|
||||
/* the LTC PKHA hardware limit is 512 bits (64 bytes) for ECC.
|
||||
the LTC_MAX_ECC_BITS defines the size of local variables that hold ECC parameters
|
||||
and point coordinates */
|
||||
#ifndef LTC_MAX_ECC_BITS
|
||||
#define LTC_MAX_ECC_BITS (384)
|
||||
#endif
|
||||
|
||||
/* Enable curves up to 384 bits */
|
||||
#if !defined(ECC_USER_CURVES) && !defined(HAVE_ALL_CURVES)
|
||||
#define ECC_USER_CURVES
|
||||
#define HAVE_ECC192
|
||||
#define HAVE_ECC224
|
||||
#undef NO_ECC256
|
||||
#define HAVE_ECC384
|
||||
#endif
|
||||
|
||||
/* enable features */
|
||||
#undef HAVE_CURVE25519
|
||||
|
Reference in New Issue
Block a user