Initial commit of CyaSSL port for TI-RTOS

This commit is contained in:
Vikram Adiga 2014-05-08 15:50:55 -07:00
parent 72e9ea8e4b
commit 5146f3dd94
26 changed files with 852 additions and 5 deletions

View File

@ -783,7 +783,7 @@ static RNG rng;
static char *certRSAname = "certs/rsa2048.der" ;
static void set_Bench_RSA_File(char * cert) { certRSAname = cert ; }
/* set by shell command */
#elif defined(CYASSL_MDK_SHELL)
#elif defined(CYASSL_MDK_SHELL) || defined(TIRTOS)
/* nothing */
#else
static const char *certRSAname = "certs/rsa2048.der" ;
@ -888,7 +888,7 @@ void bench_rsa(void)
static char *certDHname = "certs/dh2048.der" ;
void set_Bench_DH_File(char * cert) { certDHname = cert ; }
/* set by shell command */
#elif defined(CYASSL_MDK_SHELL)
#elif defined(CYASSL_MDK_SHELL) || defined(TIRTOS)
/* nothing */
#else
static const char *certDHname = "certs/dh2048.der" ;
@ -1204,6 +1204,10 @@ void bench_eccKeyAgree(void)
return (double)tickCount / 1000;
}
#elif defined (TIRTOS)
extern double current_time(int reset);
#else
#include <sys/time.h>

View File

@ -320,6 +320,21 @@ time_t mqx_time(time_t* timer)
#endif /* FREESCALE_MQX */
#ifdef TIRTOS
time_t XTIME(time_t * timer)
{
time_t sec = 0;
sec = (time_t) MYTIME_gettime();
if (timer != NULL)
*timer = sec;
return sec;
}
#endif /* TIRTOS */
static INLINE word32 btoi(byte b)
{

View File

@ -351,7 +351,42 @@ int UnLockMutex(CyaSSL_Mutex *m)
else
return BAD_MUTEX_E;
}
#elif defined (TIRTOS)
int InitMutex(CyaSSL_Mutex* m)
{
Semaphore_Params params;
Semaphore_Params_init(&params);
params.mode = Semaphore_Mode_BINARY;
*m = Semaphore_create(1, &params, NULL);
return 0;
}
int FreeMutex(CyaSSL_Mutex* m)
{
Semaphore_delete(m);
return 0;
}
int LockMutex(CyaSSL_Mutex* m)
{
Semaphore_pend(*m, BIOS_WAIT_FOREVER);
return 0;
}
int UnLockMutex(CyaSSL_Mutex* m)
{
Semaphore_post(*m);
return 0;
}
#elif defined(CYASSL_MDK_ARM)|| defined(CYASSL_CMSIS_RTOS)
#if defined(CYASSL_CMSIS_RTOS)

View File

@ -756,6 +756,25 @@ int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
return 0;
}
#elif defined(TIRTOS)
#include <xdc/runtime/Timestamp.h>
#include <stdlib.h>
int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
{
int i;
srand(xdc_runtime_Timestamp_get32());
for (i = 0; i < sz; i++ ) {
output[i] = rand() % 256;
if ((i % 8) == 7) {
srand(xdc_runtime_Timestamp_get32());
}
}
return 0;
}
#elif defined(CUSTOM_RAND_GENERATE)
/* Implement your own random generation function

View File

@ -241,7 +241,7 @@ enum ExtKeyUsage_Sum { /* From RFC 5280 */
EKU_ANY_OID = 151, /* 2.5.29.37.0, anyExtendedKeyUsage */
EKU_SERVER_AUTH_OID = 71, /* 1.3.6.1.5.5.7.3.1, id-kp-serverAuth */
EKU_CLIENT_AUTH_OID = 72, /* 1.3.6.1.5.5.7.3.2, id-kp-clientAuth */
EKU_OCSP_SIGN_OID = 79, /* 1.3.6.1.5.5.7.3.9, OCSPSigning */
EKU_OCSP_SIGN_OID = 79 /* 1.3.6.1.5.5.7.3.9, OCSPSigning */
};

View File

@ -62,6 +62,9 @@
#endif
#elif defined(CYASSL_CMSIS_RTOS)
#include "cmsis_os.h"
#elif defined(TIRTOS)
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Semaphore.h>
#else
#ifndef SINGLE_THREADED
#define CYASSL_PTHREADS
@ -104,6 +107,8 @@
#endif
#elif defined(CYASSL_CMSIS_RTOS)
typedef osMutexId CyaSSL_Mutex;
#elif defined(TIRTOS)
typedef ti_sysbios_knl_Semaphore_Handle CyaSSL_Mutex;
#else
#error Need a mutex type in multithreaded mode
#endif /* USE_WINDOWS_API */

View File

@ -90,6 +90,9 @@
/* Uncomment next line if building for EROAD */
/* #define CYASSL_EROAD */
/* Uncomment next line if using TI-RTOS settings */
/* #define TIRTOS */
#include <cyassl/ctaocrypt/visibility.h>
#ifdef IPHONE
@ -267,6 +270,32 @@
#endif
#endif
#ifdef TIRTOS
#define SIZEOF_LONG_LONG 8
#define NO_WRITEV
#define NO_CYASSL_DIR
#define NO_SHA512
#define NO_DH
#define NO_HC128
#define NO_RABBIT
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
#define NO_DEV_RANDOM
#define NO_FILESYSTEM
#define USE_CERT_BUFFERS_2048
#define NO_ERROR_STRINGS
#define USER_TIME
#ifdef __IAR_SYSTEMS_ICC__
#pragma diag_suppress=Pa089
#elif !defined(__GNUC__)
/* Suppress the sslpro warning */
#pragma diag_suppress=11
#endif
#include <ti/ndk/nettools/mytime/mytime.h>
#endif
#ifdef EBSNET
#include "rtip.h"

View File

@ -96,7 +96,8 @@
#include <rtl.h>
#endif
#elif defined(MBED)
#elif defined(TIRTOS)
/* do nothing */
#else
#ifndef SINGLE_THREADED
#define CYASSL_PTHREADS

View File

@ -2352,6 +2352,12 @@ ProtocolVersion MakeDTLSv1_2(void)
return (word32) mqxTime.SECONDS;
}
#elif defined(TIRTOS)
word32 LowResTimer(void)
{
return (word32) MYTIME_gettime();
}
#elif defined(USER_TICKS)
#if 0

View File

@ -69,6 +69,8 @@
#define RNG CyaSSL_RNG
/* for avoiding name conflict in "stm32f2xx.h" */
static int errno;
#elif defined(TIRTOS)
#include <sys/socket.h>
#else
#include <sys/types.h>
#include <errno.h>

36
tirtos/README Normal file
View File

@ -0,0 +1,36 @@
CyaSSL library for TI-RTOS
This directory contains the files that build CyaSSL library for TI-RTOS.
Please follow the instructions in TI-RTOS user guide (www.ti.com/tool/ti-rtos)
to build the CyaSSL library and the example applications.
Included Files
---------------
1. CyaSSL library build files (packages/ti/net/cyassl)
Build instructions provided in TI-RTOS user guide (www.ti.com/tool/ti-rtos)
2. CTaoCrypt test application (packages/ti/net/cyassl/tests/ctaocrypt/test)
This application is the standard CTaoCrypt test application provided with
CyaSSL.
It will be built along with the CyaSSL library. Load the built executable
on the target and make sure the CyaSSL library works as expected.
3. CTaoCrypt benchmark application
(packages/ti/net/cyassl/tests/ctaocrypt/benchmark)
This application is the standard CTaoCrypt benchmark application provided
with CyaSSL.
It will be built along with the CyaSSL library. Load the built executable
on the target and run to get the benchmark results for the configured
CyaSSL library.
Examples Application
--------------------
A simple 'TCP echo server with SSL' example application is provided with TI-RTOS
product. Look in the TI-RTOS user guide for instructions to build examples.

86
tirtos/cyassl.bld Normal file
View File

@ -0,0 +1,86 @@
/*
* Generally there is no need to edit this file!
*
* This file controls which libraries are built, as well as compiler options
* to use.
*
* The contents of this file usually don't change, but having it in your
* ownership allows you to tweak your compiler options. If you do change
* this file, however, on the next upgrade of the product we recommend
* that you take "cyassl.bld" file as supplied by the upgrade and then merge
* your changes with it.
*/
/*
* ======== cyassl.bld ========
* This script is run prior to all build scripts. It sets host-system-
* independent values for targets and platforms, then it attempts to
* find the host-system-specific user.bld script that sets rootDirs.
*
* These settings may be a function of the following global variables:
*
* environment a hash table of environment strings
*
* arguments an array of string arguments to the _config.bld script
* initialized as follows:
* arguments[0] - the file name of the _config.bld script
* arguments[1] - the first argument specified in XDCARGS
* :
* arguments[n] - the n'th argument in XDCARGS
*
* Build an alias for xdc.om.xdc.bld.BuildEnvironment
*/
var armOpts = " -ms ";
var gnuOpts = "";
var iarOpts = "";
/* Uncomment the following lines to build libraries for debug mode: */
// Pkg.attrs.profile = "debug";
// armOpts += " -g -o0 ";
// gnuOpts += " -g ";
// iarOpts += " --debug ";
var ccOpts = {
"ti.targets.arm.elf.M4F" : armOpts,
"gnu.targets.arm.M4F" : gnuOpts,
"iar.targets.arm.M4F" : iarOpts,
};
/* initialize local vars with those set in xdcpaths.mak (via XDCARGS) */
for (arg = 0; arg < arguments.length; arg++) {
/*
* Get the compiler's installation directory.
* For "ti.targets.arm.elf.M4F=/vendors/arm/6.1.0",
* we get "/vendors/arm/6.1.0"
*/
var targetName = arguments[arg].split("=")[0];
var rootDir = arguments[arg].split("=")[1];
/* only build for the specified compilers */
if (rootDir == "" || rootDir == undefined) {
continue;
}
if (targetName.match(/^TivaWareDir/) ) {
TivaWareDir = rootDir;
continue;
}
var target = xdc.useModule(targetName);
target.rootDir = rootDir;
target.ccOpts.suffix += ccOpts[targetName];
Build.targets.$add(target);
}
/* Include Path (needed to find NDK headers) */
var ndkPath = "$(NDK_INSTALL_DIR)/packages/ti/ndk/";
var cyasslPathInclude = " -I" + ndkPath + "/inc" + " -I" + ndkPath
+ "/inc/bsd -DTIRTOS ";
/* lib/ is a generated directory that 'xdc clean' should remove */
var Pkg = xdc.useModule('xdc.bld.PackageContents');
Pkg.generatedFiles.$add("lib/");

74
tirtos/cyassl.mak Normal file
View File

@ -0,0 +1,74 @@
#
# ======== cyassl.mak ========
#
# USER OPTIONAL STEP: These variables are set when building cyassl
# through the tirtos.mak
# Set up dependencies
XDC_INSTALL_DIR ?= C:/ti/xdctools_3_24_02_30
SYSBIOS_INSTALL_DIR ?= C:/ti/bios_6_34_01_14
NDK_INSTALL_DIR ?= C:/ti/ndk_2_24_00_02
TIRTOS_INSTALLATION_DIR ?= C:/ti/tirtos_tivac_2_00_00_22
TivaWareDir ?= C:/ti/tivaware
CYASSL_INSTALL_DIR ?= C:/cyassl/cyassl-2.9.4
#
# Set location of various cgtools
# These variables can be set here or on the command line. These
# variables are set when building cyassl through tirtos.mak
# USER OPTIONAL STEP: user can define below paths to compilers
ti.targets.arm.elf.M4F ?=
gnu.targets.arm.M4F ?=
iar.targets.arm.M4F ?=
#
# Set XDCARGS to some of the variables above. XDCARGS are passed
# to the XDC build engine... which will load cyassl.bld... which will
# extract these variables and use them to determine what to build and which
# toolchains to use.
#
# Note that not all of these variables need to be set to something valid.
# Unfortunately, since these vars are unconditionally assigned, your build line
# will be longer and more noisy than necessary.
#
# Some background is here:
# http://rtsc.eclipse.org/docs-tip/Command_-_xdc#Environment_Variables
#
XDCARGS= \
ti.targets.arm.elf.M4F=\"$(ti.targets.arm.elf.M4F)\" \
gnu.targets.arm.M4F=\"$(gnu.targets.arm.M4F)\" \
iar.targets.arm.M4F=\"$(iar.targets.arm.M4F)\" \
TivaWareDir=\"$(TivaWareDir)\"
#
# Set XDCPATH to contain necessary repositories.
#
XDCPATH = $(SYSBIOS_INSTALL_DIR)/packages;$(NDK_INSTALL_DIR)/packages;$(CYASSL_INSTALL_DIR);$(TIRTOS_INSTALLATION_DIR)/packages;$(TivaWareDir);
export XDCPATH
#
# Set XDCOPTIONS. Use -v for a verbose build.
#
#XDCOPTIONS=v
export XDCOPTIONS
#
# Set XDC executable command
# Note that XDCBUILDCFG points to the cyassl.bld file which uses
# the arguments specified by XDCARGS
#
XDC = $(XDC_INSTALL_DIR)/xdc XDCARGS="$(XDCARGS)" XDCBUILDCFG=./cyassl.bld
######################################################
## Shouldnt have to modify anything below this line ##
######################################################
all:
@ echo building cyassl packages ...
@ $(XDC) -Pr ./packages
clean:
@ echo cleaning cyassl packages ...
@ $(XDC) clean -Pr ./packages

View File

@ -0,0 +1,43 @@
/*
* ======== package.bld ========
* Build script for CyaSSL library
*/
var Build = xdc.useModule('xdc.bld.BuildEnvironment');
var Pkg = xdc.useModule('xdc.bld.PackageContents');
/* make command to search for the srcs */
Pkg.makePrologue = "vpath %.c $(subst ;, ,$(XPKGPATH))";
/* CYASSL sources */
var cyaSSLObjList = [
"ctaocrypt/src/aes.c",
"ctaocrypt/src/arc4.c",
"ctaocrypt/src/asn.c",
"ctaocrypt/src/coding.c",
"ctaocrypt/src/des3.c",
"ctaocrypt/src/dsa.c",
"ctaocrypt/src/error.c",
"ctaocrypt/src/hmac.c",
"ctaocrypt/src/logging.c",
"ctaocrypt/src/md4.c",
"ctaocrypt/src/md5.c",
"ctaocrypt/src/memory.c",
"ctaocrypt/src/port.c",
"ctaocrypt/src/pwdbased.c",
"ctaocrypt/src/random.c",
"ctaocrypt/src/rsa.c",
"ctaocrypt/src/sha.c",
"ctaocrypt/src/sha256.c",
"ctaocrypt/src/tfm.c",
"src/internal.c",
"src/io.c",
"src/keys.c",
"src/ssl.c",
"src/tls.c",
];
for each (var targ in Build.targets) {
var libOptions = {incs: cyasslPathInclude};
var lib = Pkg.addLibrary("lib/" + Pkg.name, targ, libOptions);
lib.addObjects(cyaSSLObjList);
}

View File

@ -0,0 +1,7 @@
/*!
* ======== ti.net.cyassl ========
* CyaSSL library for TI-RTOS
*
*/
package ti.net.cyassl {
}

View File

@ -0,0 +1,12 @@
/*
* ======== package.xs ========
*/
/*
* ======== getLibs ========
* Contribute CyaSSL library.
*/
function getLibs(prog)
{
return ("lib/" + this.$name + ".a" + prog.build.target.suffix);
}

View File

@ -0,0 +1,29 @@
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
define symbol __ICFEDIT_region_ROM_end__ = 0x000FFFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__ = 0x2003FFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x8000;
define symbol __ICFEDIT_size_heap__ = 0x10000;
/**** End of ICF editor section. ###ICF###*/
define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
initialize by copy { readwrite };
do not initialize { section .noinit };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };
place in RAM_region { readwrite,
block CSTACK, block HEAP };

View File

@ -0,0 +1,75 @@
/*
* ======== benchmark.cfg ========
*/
/* ================ General configuration ================ */
var Defaults = xdc.useModule('xdc.runtime.Defaults');
var Diags = xdc.useModule('xdc.runtime.Diags');
var Error = xdc.useModule('xdc.runtime.Error');
var Log = xdc.useModule('xdc.runtime.Log');
var Main = xdc.useModule('xdc.runtime.Main');
var Memory = xdc.useModule('xdc.runtime.Memory');
var System = xdc.useModule('xdc.runtime.System');
var Text = xdc.useModule('xdc.runtime.Text');
var TimeStamp = xdc.useModule('xdc.runtime.Timestamp');
var BIOS = xdc.useModule('ti.sysbios.BIOS');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var Timer = xdc.useModule('ti.sysbios.hal.Timer');
BIOS.heapSize = 100000;
Task.idleTaskStackSize = 768;
Program.stack = 2048;
/* ================ System configuration ================ */
var SysMin = xdc.useModule('xdc.runtime.SysMin');
SysMin.bufSize = 128;
System.SupportProxy = SysMin;
/* Enable Semihosting for GNU targets to print to CCS console */
if (Program.build.target.$name.match(/gnu/)) {
var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
}
/* ================ NDK configuration ================ */
var Ndk = xdc.loadPackage('ti.ndk.config');
var Global = xdc.useModule('ti.ndk.config.Global');
var Ip = xdc.useModule('ti.ndk.config.Ip');
var Udp = xdc.useModule('ti.ndk.config.Udp');
var Tcp = xdc.useModule('ti.ndk.config.Tcp');
Global.IPv6 = false;
Global.stackLibType = Global.MIN;
Global.pktNumFrameBufs = 10;
Global.memRawPageCount = 6;
Global.ndkThreadStackSize = 1536;
Global.lowTaskStackSize = 1024;
Global.normTaskStackSize = 1024;
Global.highTaskStackSize = 1024;
Tcp.transmitBufSize = 1024;
Tcp.receiveBufSize = 1024;
/* ================ Driver configuration ================ */
var TIRTOS = xdc.useModule('ti.tirtos.TIRTOS');
var EMAC = xdc.useModule('ti.drivers.EMAC');
EMAC.libType = EMAC.LibType_NonInstrumented;
var GPIO = xdc.useModule('ti.drivers.GPIO');
GPIO.libType = GPIO.LibType_NonInstrumented;
/* ================ CyaSSL configuration ================ */
try {
var CyaSSL = xdc.loadPackage('ti.net.cyassl');
}
catch (e) {
print("Error: Could not find CyaSSL library! Make sure the CyaSSL library"
+ " is built and package path is updated for the build tool"
+ " to find the library. More detailed CyaSSL build instructions"
+ " can be found in the TI-RTOS user guide.");
}

View File

@ -0,0 +1,106 @@
/*
* ======== main.c ========
* Entry point for Benchmark application
*/
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Swi.h>
#include <xdc/runtime/System.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/hal/Timer.h>
static int initialized = 0;
static double msTicks = 0;
static Timer_Handle hdl = NULL;
double current_time(int reset);
static void tick(unsigned int arg0);
void msTimer_init(void);
void runBenchmarks(UArg arg0, UArg arg1);
extern int benchmark_test(void* args);
/*
* ======== runBenchmarks ========
* Run the CyaSSL benchmark application
*/
void runBenchmarks(UArg arg0, UArg arg1)
{
void *args = NULL;
msTimer_init();
System_printf("Running benchmarks...\n");
System_flush();
benchmark_test(args);
System_printf("Benchmarks completed.\n");
BIOS_exit(0);
}
/*
* ======== ticks ========
* Keeps track of time in millisec
*/
static void tick(unsigned int arg0)
{
Swi_disable();
msTicks++;
Swi_enable();
}
/*
* ======== current_time ========
* Returns the time in sec (double precision)
*/
double current_time(int reset)
{
if (reset) {
msTicks = 0;
}
return (msTicks/1000);
}
/*
* ======== msTimer_init ========
* Sets up a BIOS timer with millisec period
*/
void msTimer_init(void)
{
Timer_Params params;
if (initialized) {
return;
}
Timer_Params_init(&params);
params.period = 1000;
params.periodType = Timer_PeriodType_MICROSECS;
params.runMode = Timer_RunMode_CONTINUOUS;
params.startMode = Timer_StartMode_AUTO;
hdl = Timer_create(-1, (ti_sysbios_hal_Timer_FuncPtr)tick,
&params, NULL);
if (!hdl) {
System_abort("msTimer_init: Timer creation failed.\n");
}
/* Set flag indicating that initialization has completed */
initialized = 1;
}
/*
* ======== main ========
*/
int main(int argc, char** argv)
{
/* Initialize the defaults and set the parameters. */
Task_Handle handle;
Task_Params taskParams;
Task_Params_init(&taskParams);
taskParams.stackSize = 65535;
handle = Task_create(runBenchmarks, &taskParams, NULL);
if (handle == NULL) {
System_printf("main: Failed to create new Task.\n");
}
BIOS_start();
}

View File

@ -0,0 +1,48 @@
/*
* ======== package.bld ========
* Build script for benchmark application
*/
if ((typeof(TivaWareDir) == undefined) || (TivaWareDir == "")) {
throw("ERROR: NO VALID TIVAWARE PATH DEFINED!!!");
}
var Build = xdc.useModule('xdc.bld.BuildEnvironment');
var Pkg = xdc.useModule('xdc.bld.PackageContents');
/* make command to search for the srcs */
Pkg.makePrologue = "vpath %.c $(subst ;, ,$(XPKGPATH))";
var srcs = [
"main.c",
"ctaocrypt/benchmark/benchmark.c",
"examples/EK_TM4C1294XL/EK_TM4C1294XL.c",
];
for each (var targ in Build.targets) {
var lnkOpts = " -l" + TivaWareDir + "/driverlib/ccs/Debug/driverlib.lib";
var platform = "ti.platforms.tiva:TM4C1294NCPDT:1";
if (targ.$name.match(/^ti/)) {
lnkOpts += " -x ";
}
else if (targ.$name.match(/^iar/)) {
lnkOpts = TivaWareDir + "/driverlib/ccs/Debug/driverlib.lib"
+ " --config TM4C1294NC.icf";
platform = "ti.platforms.tiva:TM4C1294NCPDT";
/* Floating point print support */
var suffix = targ.$orig.lnkOpts.suffix;
targ.$orig.lnkOpts.suffix = suffix.replace(/PrintfSmall/, "PrintfFull");
}
var exeOptions = {incs: cyasslPathInclude
+ " -DNO_MAIN_DRIVER -D_INCLUDE_NIMU_CODE -DBENCH_EMBEDDED "
+ " -DTIVAWARE -DPART_TM4C1294NCPDT",
lopts: lnkOpts
};
var exe = Pkg.addExecutable("benchmark", targ,
platform, exeOptions);
exe.addObjects(srcs);
}

View File

@ -0,0 +1,6 @@
/*
* ======== ti.net.cyassl.tests.ctaocrypt.benchmark ========
* CTaoCrypt Benchmark Application
*/
package ti.net.cyassl.tests.ctaocrypt.benchmark {
}

View File

@ -0,0 +1,29 @@
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
define symbol __ICFEDIT_region_ROM_end__ = 0x000FFFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__ = 0x2003FFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x8000;
define symbol __ICFEDIT_size_heap__ = 0x10000;
/**** End of ICF editor section. ###ICF###*/
define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
initialize by copy { readwrite };
do not initialize { section .noinit };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };
place in RAM_region { readwrite,
block CSTACK, block HEAP };

View File

@ -0,0 +1,56 @@
/*
* ======== main.c ========
* Entry point to Ctaocrypt Test Application
*/
/* XDCtools Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <xdc/runtime/System.h>
/* func_args from test.h, so don't have to pull in other junk */
typedef struct func_args {
int argc;
char** argv;
int return_code;
} func_args;
extern int ctaocrypt_test(void* args);
/*
* ======== testCtaocrypt ========
* Run the Ctaocrypt test
*/
void testCtaocrypt(UArg arg0, UArg arg1)
{
System_printf("Running ctaocrypt tests...\n");
System_flush();
ctaocrypt_test((void *)arg0);
System_printf("Tests completed.\n");
BIOS_exit(0);
}
/*
* ======== main ========
*/
int main(int argc, char** argv)
{
func_args args;
args.argc = argc;
args.argv = argv;
/* Initialize the defaults and set the parameters. */
Task_Handle handle;
Task_Params taskParams;
Task_Params_init(&taskParams);
taskParams.arg0 = (UArg)&args;
taskParams.stackSize = 65535;
handle =Task_create(testCtaocrypt, &taskParams, NULL);
if (handle == NULL) {
System_printf("main: Failed to create new Task.\n");
return (-1);
}
BIOS_start();
}

View File

@ -0,0 +1,43 @@
/*
* ======== package.bld ========
* Build script for Ctaocrypt Test
*/
if ((typeof(TivaWareDir) == undefined) || (TivaWareDir == "")) {
throw("ERROR: NO VALID TIVAWARE PATH DEFINED!!!");
}
var Build = xdc.useModule('xdc.bld.BuildEnvironment');
var Pkg = xdc.useModule('xdc.bld.PackageContents');
/* make command to search for the srcs */
Pkg.makePrologue = "vpath %.c $(subst ;, ,$(XPKGPATH))";
var srcs = [
"main.c",
"ctaocrypt/test/test.c",
"examples/EK_TM4C1294XL/EK_TM4C1294XL.c",
];
for each (var targ in Build.targets) {
var lnkOpts = " -l" + TivaWareDir + "/driverlib/ccs/Debug/driverlib.lib"
var platform = "ti.platforms.tiva:TM4C1294NCPDT:1";
if (targ.$name.match(/^ti/)) {
lnkOpts += " -x ";
}
else if (targ.$name.match(/^iar/)) {
lnkOpts = TivaWareDir + "/driverlib/ccs/Debug/driverlib.lib"
+ " --config TM4C1294NC.icf";
platform = "ti.platforms.tiva:TM4C1294NCPDT";
}
var exeOptions = {incs: cyasslPathInclude
+ " -DNO_MAIN_DRIVER -D_INCLUDE_NIMU_CODE -DBENCH_EMBEDDED "
+ " -DTIVAWARE -DPART_TM4C1294NCPDT",
lopts: lnkOpts,
};
var exe = Pkg.addExecutable("test", targ,
platform, exeOptions);
exe.addObjects(srcs);
}

View File

@ -0,0 +1,6 @@
/*
* ======== ti.net.cyassl.tests.ctaocrypt.test ========
* Ctaocrypt Test Application
*/
package ti.net.cyassl.tests.ctaocrypt.test {
}

View File

@ -0,0 +1,75 @@
/*
* ======== test.cfg ========
*/
/* ================ General configuration ================ */
var Defaults = xdc.useModule('xdc.runtime.Defaults');
var Diags = xdc.useModule('xdc.runtime.Diags');
var Error = xdc.useModule('xdc.runtime.Error');
var Log = xdc.useModule('xdc.runtime.Log');
var Main = xdc.useModule('xdc.runtime.Main');
var Memory = xdc.useModule('xdc.runtime.Memory');
var System = xdc.useModule('xdc.runtime.System');
var Text = xdc.useModule('xdc.runtime.Text');
var TimeStamp = xdc.useModule('xdc.runtime.Timestamp');
var BIOS = xdc.useModule('ti.sysbios.BIOS');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var Timer = xdc.useModule('ti.sysbios.hal.Timer');
BIOS.heapSize = 100000;
Task.idleTaskStackSize = 768;
Program.stack = 2048;
/* ================ System configuration ================ */
var SysMin = xdc.useModule('xdc.runtime.SysMin');
SysMin.bufSize = 128;
System.SupportProxy = SysMin;
/* Enable Semihosting for GNU targets to print to CCS console */
if (Program.build.target.$name.match(/gnu/)) {
var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
}
/* ================ NDK configuration ================ */
var Ndk = xdc.loadPackage('ti.ndk.config');
var Global = xdc.useModule('ti.ndk.config.Global');
var Ip = xdc.useModule('ti.ndk.config.Ip');
var Udp = xdc.useModule('ti.ndk.config.Udp');
var Tcp = xdc.useModule('ti.ndk.config.Tcp');
Global.IPv6 = false;
Global.stackLibType = Global.MIN;
Global.pktNumFrameBufs = 10;
Global.memRawPageCount = 6;
Global.ndkThreadStackSize = 1536;
Global.lowTaskStackSize = 1024;
Global.normTaskStackSize = 1024;
Global.highTaskStackSize = 1024;
Tcp.transmitBufSize = 1024;
Tcp.receiveBufSize = 1024;
/* ================ Driver configuration ================ */
var TIRTOS = xdc.useModule('ti.tirtos.TIRTOS');
var EMAC = xdc.useModule('ti.drivers.EMAC');
EMAC.libType = EMAC.LibType_NonInstrumented;
var GPIO = xdc.useModule('ti.drivers.GPIO');
GPIO.libType = GPIO.LibType_NonInstrumented;
/* ================ CyaSSL configuration ================ */
try {
var CyaSSL = xdc.loadPackage('ti.net.cyassl');
}
catch (e) {
print("Error: Could not find CyaSSL library! Make sure the CyaSSL library"
+ " is built and package path is updated for the build tool"
+ " to find the library. More detailed CyaSSL build instructions"
+ " can be found in the TI-RTOS user guide.");
}