1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
/* main.c
*
* Copyright (C) 2006-2020 wolfSSL Inc.
*
* This file is part of wolfSSL.
*
* 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.
*
* 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
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <wolfssl/wolfcrypt/settings.h>
#include <stdio.h>
#include <time.h>
#if defined(WOLFSSL_CMSIS_RTOS)
#include "cmsis_os.h"
#elif defined(WOLFSSL_CMSIS_RTOSv2)
#include "cmsis_os2.h"
#endif
/* Dummy definition for test RTC */
#define RTC_YEAR 2019
#define RTC_MONTH 1
#define RTC_DAY 1
#if defined(STM32F7xx)
#include "stm32f7xx_hal.h"
#elif defined(STM32F4xx)
#include "stm32f4xx_hal.h"
#elif defined(STM32F2xx)
#include "stm32f2xx_hal.h"
#endif
#warning "write MPU specific Set ups\n"
static void SystemClock_Config (void) {
}
static void MPU_Config (void) {
}
static void CPU_CACHE_Enable (void) {
}
#if defined(WOLFSSL_CMSIS_RTOS)
extern uint32_t os_time;
#endif
uint32_t HAL_GetTick(void) {
#if defined(WOLFSSL_CMSIS_RTOS)
return os_time;
#elif defined(WOLFSSL_CMSIS_RTOSv2)
return osKernelGetTickCount();
#endif
}
static time_t epochTime;
time_t time(time_t *t){
return epochTime ;
}
void setTime(time_t t){
epochTime = t;
}
/*-----------------------------------------------------------------------------
* Initialize a Flash Memory Card
*----------------------------------------------------------------------------*/
#if !defined(NO_FILESYSTEM)
#include "rl_fs.h" /* FileSystem definitions */
static void init_filesystem (void) {
int32_t retv;
retv = finit ("M0:");
if (retv == fsOK) {
retv = fmount ("M0:");
if (retv == fsOK) {
printf ("Drive M0 ready!\n");
}
else {
printf ("Drive M0 mount failed(%d)!\n", retv);
}
}
else {
printf ("Drive M0 initialization failed!\n");
}
}
#endif
/*-----------------------------------------------------------------------------
* mian entry
*----------------------------------------------------------------------------*/
void wolfcrypt_test(void *arg) ;
int main()
{
void * arg = NULL ;
MPU_Config();
CPU_CACHE_Enable();
HAL_Init(); /* Initialize the HAL Library */
SystemClock_Config(); /* Configure the System Clock */
#if !defined(NO_FILESYSTEM)
init_filesystem ();
#endif
setTime((RTC_YEAR-1970)*365*24*60*60 + RTC_MONTH*30*24*60*60 + RTC_DAY*24*60*60);
printf("=== Start: Crypt test === \n") ;
wolfcrypt_test(arg) ;
printf("=== End: Crypt test ===\n") ;
}
|