Update code to v1.0.14 (10)

This commit is contained in:
Caten
2024-02-29 19:35:00 +08:00
parent c2ee3b694c
commit a956d26f6d
3188 changed files with 2317293 additions and 146 deletions

View File

@@ -0,0 +1,309 @@
/* Linker Script for Zynq MP */
/* Stack and Heap increased to 64KB */
_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x10000;
_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x10000;
_EL0_STACK_SIZE = DEFINED(_EL0_STACK_SIZE) ? _EL0_STACK_SIZE : 1024;
_EL1_STACK_SIZE = DEFINED(_EL1_STACK_SIZE) ? _EL1_STACK_SIZE : 2048;
_EL2_STACK_SIZE = DEFINED(_EL2_STACK_SIZE) ? _EL2_STACK_SIZE : 1024;
/* Define Memories in the system */
MEMORY
{
ddr4_ctrl_C0_DDR4_ADDRESS_BLOCK : ORIGIN = 0x500000000, LENGTH = 0x20000000
psu_ddr_0_MEM_0 : ORIGIN = 0x0, LENGTH = 0x7FF00000
psu_ddr_1_MEM_0 : ORIGIN = 0x800000000, LENGTH = 0x80000000
psu_ocm_ram_0_MEM_0 : ORIGIN = 0xFFFC0000, LENGTH = 0x40000
psu_qspi_linear_0_MEM_0 : ORIGIN = 0xC0000000, LENGTH = 0x20000000
}
/* Specify the default entry point to the program */
ENTRY(_vector_table)
/* Define the sections, and where they are mapped in memory */
SECTIONS
{
.text : {
KEEP (*(.vectors))
*(.boot)
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
*(.plt)
*(.gnu_warning)
*(.gcc_execpt_table)
*(.glue_7)
*(.glue_7t)
*(.ARM.extab)
*(.gnu.linkonce.armextab.*)
} > psu_ddr_0_MEM_0
.init (ALIGN(64)) : {
KEEP (*(.init))
} > psu_ddr_0_MEM_0
.fini (ALIGN(64)) : {
KEEP (*(.fini))
} > psu_ddr_0_MEM_0
.interp : {
KEEP (*(.interp))
} > psu_ddr_0_MEM_0
.note-ABI-tag : {
KEEP (*(.note-ABI-tag))
} > psu_ddr_0_MEM_0
.rodata : {
. = ALIGN(64);
__rodata_start = .;
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r.*)
__rodata_end = .;
} > psu_ddr_0_MEM_0
.rodata1 : {
. = ALIGN(64);
__rodata1_start = .;
*(.rodata1)
*(.rodata1.*)
__rodata1_end = .;
} > psu_ddr_0_MEM_0
.sdata2 : {
. = ALIGN(64);
__sdata2_start = .;
*(.sdata2)
*(.sdata2.*)
*(.gnu.linkonce.s2.*)
__sdata2_end = .;
} > psu_ddr_0_MEM_0
.sbss2 : {
. = ALIGN(64);
__sbss2_start = .;
*(.sbss2)
*(.sbss2.*)
*(.gnu.linkonce.sb2.*)
__sbss2_end = .;
} > psu_ddr_0_MEM_0
.data : {
. = ALIGN(64);
__data_start = .;
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
*(.jcr)
*(.got)
*(.got.plt)
__data_end = .;
} > psu_ddr_0_MEM_0
.data1 : {
. = ALIGN(64);
__data1_start = .;
*(.data1)
*(.data1.*)
__data1_end = .;
} > psu_ddr_0_MEM_0
.got : {
*(.got)
} > psu_ddr_0_MEM_0
.got1 : {
*(.got1)
} > psu_ddr_0_MEM_0
.got2 : {
*(.got2)
} > psu_ddr_0_MEM_0
.ctors : {
. = ALIGN(64);
__CTOR_LIST__ = .;
___CTORS_LIST___ = .;
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE(*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
__CTOR_END__ = .;
___CTORS_END___ = .;
} > psu_ddr_0_MEM_0
.dtors : {
. = ALIGN(64);
__DTOR_LIST__ = .;
___DTORS_LIST___ = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE(*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
__DTOR_END__ = .;
___DTORS_END___ = .;
} > psu_ddr_0_MEM_0
.fixup : {
__fixup_start = .;
*(.fixup)
__fixup_end = .;
} > psu_ddr_0_MEM_0
.eh_frame : {
*(.eh_frame)
} > psu_ddr_0_MEM_0
.eh_framehdr : {
__eh_framehdr_start = .;
*(.eh_framehdr)
__eh_framehdr_end = .;
} > psu_ddr_0_MEM_0
.gcc_except_table : {
*(.gcc_except_table)
} > psu_ddr_0_MEM_0
.mmu_tbl0 (ALIGN(4096)) : {
__mmu_tbl0_start = .;
*(.mmu_tbl0)
__mmu_tbl0_end = .;
} > psu_ddr_0_MEM_0
.mmu_tbl1 (ALIGN(4096)) : {
__mmu_tbl1_start = .;
*(.mmu_tbl1)
__mmu_tbl1_end = .;
} > psu_ddr_0_MEM_0
.mmu_tbl2 (ALIGN(4096)) : {
__mmu_tbl2_start = .;
*(.mmu_tbl2)
__mmu_tbl2_end = .;
} > psu_ddr_0_MEM_0
.ARM.exidx : {
__exidx_start = .;
*(.ARM.exidx*)
*(.gnu.linkonce.armexidix.*.*)
__exidx_end = .;
} > psu_ddr_0_MEM_0
.preinit_array : {
. = ALIGN(64);
__preinit_array_start = .;
KEEP (*(SORT(.preinit_array.*)))
KEEP (*(.preinit_array))
__preinit_array_end = .;
} > psu_ddr_0_MEM_0
.init_array : {
. = ALIGN(64);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
} > psu_ddr_0_MEM_0
.fini_array : {
. = ALIGN(64);
__fini_array_start = .;
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array))
__fini_array_end = .;
} > psu_ddr_0_MEM_0
.ARM.attributes : {
__ARM.attributes_start = .;
*(.ARM.attributes)
__ARM.attributes_end = .;
} > psu_ddr_0_MEM_0
.sdata : {
. = ALIGN(64);
__sdata_start = .;
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
__sdata_end = .;
} > psu_ddr_0_MEM_0
.sbss (NOLOAD) : {
. = ALIGN(64);
__sbss_start = .;
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb.*)
. = ALIGN(64);
__sbss_end = .;
} > psu_ddr_0_MEM_0
.tdata : {
. = ALIGN(64);
__tdata_start = .;
*(.tdata)
*(.tdata.*)
*(.gnu.linkonce.td.*)
__tdata_end = .;
} > psu_ddr_0_MEM_0
.tbss : {
. = ALIGN(64);
__tbss_start = .;
*(.tbss)
*(.tbss.*)
*(.gnu.linkonce.tb.*)
__tbss_end = .;
} > psu_ddr_0_MEM_0
.bss (NOLOAD) : {
. = ALIGN(64);
__bss_start__ = .;
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(64);
__bss_end__ = .;
} > psu_ddr_0_MEM_0
_SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 );
_SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2 );
/* Generate Stack and Heap definitions */
.heap (NOLOAD) : {
. = ALIGN(64);
_heap = .;
HeapBase = .;
_heap_start = .;
. += _HEAP_SIZE;
_heap_end = .;
HeapLimit = .;
} > psu_ddr_0_MEM_0
.stack (NOLOAD) : {
. = ALIGN(64);
_el3_stack_end = .;
. += _STACK_SIZE;
__el3_stack = .;
_el2_stack_end = .;
. += _EL2_STACK_SIZE;
. = ALIGN(64);
__el2_stack = .;
_el1_stack_end = .;
. += _EL1_STACK_SIZE;
. = ALIGN(64);
__el1_stack = .;
_el0_stack_end = .;
. += _EL0_STACK_SIZE;
. = ALIGN(64);
__el0_stack = .;
} > psu_ddr_0_MEM_0
_end = .;
}

View File

@@ -0,0 +1,309 @@
/* Linker Script for Zynq MP */
/* Stack and Heap increased to 64KB */
_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x10000;
_HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x10000;
_EL0_STACK_SIZE = DEFINED(_EL0_STACK_SIZE) ? _EL0_STACK_SIZE : 1024;
_EL1_STACK_SIZE = DEFINED(_EL1_STACK_SIZE) ? _EL1_STACK_SIZE : 2048;
_EL2_STACK_SIZE = DEFINED(_EL2_STACK_SIZE) ? _EL2_STACK_SIZE : 1024;
/* Define Memories in the system */
MEMORY
{
ddr4_ctrl_C0_DDR4_ADDRESS_BLOCK : ORIGIN = 0x500000000, LENGTH = 0x20000000
psu_ddr_0_MEM_0 : ORIGIN = 0x0, LENGTH = 0x7FF00000
psu_ddr_1_MEM_0 : ORIGIN = 0x800000000, LENGTH = 0x80000000
psu_ocm_ram_0_MEM_0 : ORIGIN = 0xFFFC0000, LENGTH = 0x40000
psu_qspi_linear_0_MEM_0 : ORIGIN = 0xC0000000, LENGTH = 0x20000000
}
/* Specify the default entry point to the program */
ENTRY(_vector_table)
/* Define the sections, and where they are mapped in memory */
SECTIONS
{
.text : {
KEEP (*(.vectors))
*(.boot)
*(.text)
*(.text.*)
*(.gnu.linkonce.t.*)
*(.plt)
*(.gnu_warning)
*(.gcc_execpt_table)
*(.glue_7)
*(.glue_7t)
*(.ARM.extab)
*(.gnu.linkonce.armextab.*)
} > psu_ddr_0_MEM_0
.init (ALIGN(64)) : {
KEEP (*(.init))
} > psu_ddr_0_MEM_0
.fini (ALIGN(64)) : {
KEEP (*(.fini))
} > psu_ddr_0_MEM_0
.interp : {
KEEP (*(.interp))
} > psu_ddr_0_MEM_0
.note-ABI-tag : {
KEEP (*(.note-ABI-tag))
} > psu_ddr_0_MEM_0
.rodata : {
. = ALIGN(64);
__rodata_start = .;
*(.rodata)
*(.rodata.*)
*(.gnu.linkonce.r.*)
__rodata_end = .;
} > psu_ddr_0_MEM_0
.rodata1 : {
. = ALIGN(64);
__rodata1_start = .;
*(.rodata1)
*(.rodata1.*)
__rodata1_end = .;
} > psu_ddr_0_MEM_0
.sdata2 : {
. = ALIGN(64);
__sdata2_start = .;
*(.sdata2)
*(.sdata2.*)
*(.gnu.linkonce.s2.*)
__sdata2_end = .;
} > psu_ddr_0_MEM_0
.sbss2 : {
. = ALIGN(64);
__sbss2_start = .;
*(.sbss2)
*(.sbss2.*)
*(.gnu.linkonce.sb2.*)
__sbss2_end = .;
} > psu_ddr_0_MEM_0
.data : {
. = ALIGN(64);
__data_start = .;
*(.data)
*(.data.*)
*(.gnu.linkonce.d.*)
*(.jcr)
*(.got)
*(.got.plt)
__data_end = .;
} > psu_ddr_0_MEM_0
.data1 : {
. = ALIGN(64);
__data1_start = .;
*(.data1)
*(.data1.*)
__data1_end = .;
} > psu_ddr_0_MEM_0
.got : {
*(.got)
} > psu_ddr_0_MEM_0
.got1 : {
*(.got1)
} > psu_ddr_0_MEM_0
.got2 : {
*(.got2)
} > psu_ddr_0_MEM_0
.ctors : {
. = ALIGN(64);
__CTOR_LIST__ = .;
___CTORS_LIST___ = .;
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE(*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
__CTOR_END__ = .;
___CTORS_END___ = .;
} > psu_ddr_0_MEM_0
.dtors : {
. = ALIGN(64);
__DTOR_LIST__ = .;
___DTORS_LIST___ = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE(*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
__DTOR_END__ = .;
___DTORS_END___ = .;
} > psu_ddr_0_MEM_0
.fixup : {
__fixup_start = .;
*(.fixup)
__fixup_end = .;
} > psu_ddr_0_MEM_0
.eh_frame : {
*(.eh_frame)
} > psu_ddr_0_MEM_0
.eh_framehdr : {
__eh_framehdr_start = .;
*(.eh_framehdr)
__eh_framehdr_end = .;
} > psu_ddr_0_MEM_0
.gcc_except_table : {
*(.gcc_except_table)
} > psu_ddr_0_MEM_0
.mmu_tbl0 (ALIGN(4096)) : {
__mmu_tbl0_start = .;
*(.mmu_tbl0)
__mmu_tbl0_end = .;
} > psu_ddr_0_MEM_0
.mmu_tbl1 (ALIGN(4096)) : {
__mmu_tbl1_start = .;
*(.mmu_tbl1)
__mmu_tbl1_end = .;
} > psu_ddr_0_MEM_0
.mmu_tbl2 (ALIGN(4096)) : {
__mmu_tbl2_start = .;
*(.mmu_tbl2)
__mmu_tbl2_end = .;
} > psu_ddr_0_MEM_0
.ARM.exidx : {
__exidx_start = .;
*(.ARM.exidx*)
*(.gnu.linkonce.armexidix.*.*)
__exidx_end = .;
} > psu_ddr_0_MEM_0
.preinit_array : {
. = ALIGN(64);
__preinit_array_start = .;
KEEP (*(SORT(.preinit_array.*)))
KEEP (*(.preinit_array))
__preinit_array_end = .;
} > psu_ddr_0_MEM_0
.init_array : {
. = ALIGN(64);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
} > psu_ddr_0_MEM_0
.fini_array : {
. = ALIGN(64);
__fini_array_start = .;
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array))
__fini_array_end = .;
} > psu_ddr_0_MEM_0
.ARM.attributes : {
__ARM.attributes_start = .;
*(.ARM.attributes)
__ARM.attributes_end = .;
} > psu_ddr_0_MEM_0
.sdata : {
. = ALIGN(64);
__sdata_start = .;
*(.sdata)
*(.sdata.*)
*(.gnu.linkonce.s.*)
__sdata_end = .;
} > psu_ddr_0_MEM_0
.sbss (NOLOAD) : {
. = ALIGN(64);
__sbss_start = .;
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.sb.*)
. = ALIGN(64);
__sbss_end = .;
} > psu_ddr_0_MEM_0
.tdata : {
. = ALIGN(64);
__tdata_start = .;
*(.tdata)
*(.tdata.*)
*(.gnu.linkonce.td.*)
__tdata_end = .;
} > psu_ddr_0_MEM_0
.tbss : {
. = ALIGN(64);
__tbss_start = .;
*(.tbss)
*(.tbss.*)
*(.gnu.linkonce.tb.*)
__tbss_end = .;
} > psu_ddr_0_MEM_0
.bss (NOLOAD) : {
. = ALIGN(64);
__bss_start__ = .;
*(.bss)
*(.bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(64);
__bss_end__ = .;
} > psu_ddr_0_MEM_0
_SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 );
_SDA2_BASE_ = __sdata2_start + ((__sbss2_end - __sdata2_start) / 2 );
/* Generate Stack and Heap definitions */
.heap (NOLOAD) : {
. = ALIGN(64);
_heap = .;
HeapBase = .;
_heap_start = .;
. += _HEAP_SIZE;
_heap_end = .;
HeapLimit = .;
} > psu_ddr_0_MEM_0
.stack (NOLOAD) : {
. = ALIGN(64);
_el3_stack_end = .;
. += _STACK_SIZE;
__el3_stack = .;
_el2_stack_end = .;
. += _EL2_STACK_SIZE;
. = ALIGN(64);
__el2_stack = .;
_el1_stack_end = .;
. += _EL1_STACK_SIZE;
. = ALIGN(64);
__el1_stack = .;
_el0_stack_end = .;
. += _EL0_STACK_SIZE;
. = ALIGN(64);
__el0_stack = .;
} > psu_ddr_0_MEM_0
_end = .;
}

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="ASCII"?>
<systemproject:SystemProject xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdsproject="http://www.xilinx.com/sdsproject" xmlns:systemproject="http://www.xilinx.com/systemproject" name="wolfCrypt_example_system" platform="${workspace_loc:/standalone_bsp_0}/export/standalone_bsp_0/standalone_bsp_0.xpfm" platformUID="xilinx:zcu102:design_1:0.0(custom)" sysConfig="standalone_bsp_0" runtime="C/C++">
<configuration name="Debug">
<configBuildOptions xsi:type="systemproject:SystemOptions">
<applications name="wolfCrypt_example" domainName="standalone_domain" domainPrettyName="standalone on psu_cortexa53_0" appBuildConfig="Debug"/>
<options xsi:type="sdsproject:Option" gensdcard="true" dmclkid="0"/>
</configBuildOptions>
<lastBuildOptions xsi:type="systemproject:SystemOptions">
<applications name="wolfCrypt_example" domainName="standalone_domain" domainPrettyName="standalone on psu_cortexa53_0" appBuildConfig="Debug"/>
<options xsi:type="sdsproject:Option" gensdcard="true" dmclkid="0"/>
</lastBuildOptions>
</configuration>
<configuration name="Release">
<configBuildOptions xsi:type="systemproject:SystemOptions">
<applications name="wolfCrypt_example" domainName="standalone_domain" domainPrettyName="standalone on psu_cortexa53_0" appBuildConfig="Release"/>
<options xsi:type="sdsproject:Option" gensdcard="true" dmclkid="0"/>
</configBuildOptions>
</configuration>
</systemproject:SystemProject>

View File

@@ -0,0 +1,9 @@
.analytics
.metadata/
_ide/
Debug/
Release/
*/.gitignore
vmk180/
*.ld

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="ASCII"?>
<sdkproject:SdkProject xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdkproject="http://www.xilinx.com/sdkproject" name="wolfCrypt_FreeRTOS_example" platformUID="xilinx:vmk180::0.0(custom)" systemProject="wolfCrypt_FreeRTOS_example_system" sysConfig="vmk180" runtime="cpp" cpu="freertos" cpuInstance="versal_cips_0_pspmc_0_psv_cortexa72_0" os="freertos10_xilinx" mssSignature="69319cadb247104471151c20895b8098">
<configuration name="Debug" id="xilinx.gnu.arm.a53.exe.debug.1474877702" dirty="true">
<configBuildOptions xsi:type="sdkproject:SdkOptions"/>
<lastBuildOptions xsi:type="sdkproject:SdkOptions"/>
</configuration>
<configuration name="Release" id="xilinx.gnu.arm.a53.exe.release.1927748810">
<configBuildOptions xsi:type="sdkproject:SdkOptions"/>
<lastBuildOptions xsi:type="sdkproject:SdkOptions"/>
</configuration>
<template appTemplateName="empty_application"/>
</sdkproject:SdkProject>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="ASCII"?>
<systemproject:SystemProject xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdkproject="http://www.xilinx.com/sdkproject" xmlns:systemproject="http://www.xilinx.com/systemproject" name="wolfCrypt_FreeRTOS_example_system" platformUID="xilinx:vmk180::0.0(custom)" sysConfig="vmk180" runtime="cpp" dimmRepoPath="" rootFSLocation="" linuxImage="" sysroot="">
<configuration name="Debug" id="com.xilinx.sdx.system.managedbuilder.debugConfiguration.750862644">
<configBuildOptions xsi:type="systemproject:SystemOptions">
<applications name="wolfCrypt_FreeRTOS_example" domainName="freertos" domainPrettyName="freertos" appBuildConfig="Debug"/>
<options xsi:type="sdkproject:SdkOptions" generateSdCard="true"/>
</configBuildOptions>
<lastBuildOptions xsi:type="systemproject:SystemOptions">
<applications name="wolfCrypt_FreeRTOS_example" domainName="freertos" domainPrettyName="freertos" appBuildConfig="Debug"/>
<options xsi:type="sdkproject:SdkOptions" generateSdCard="true"/>
</lastBuildOptions>
</configuration>
<configuration name="Release" id="com.xilinx.sdx.system.managedbuilder.releaseConfiguration.687928633">
<configBuildOptions xsi:type="systemproject:SystemOptions">
<applications name="wolfCrypt_FreeRTOS_example" domainName="freertos" domainPrettyName="freertos" appBuildConfig="Release"/>
<options xsi:type="sdkproject:SdkOptions" generateSdCard="true"/>
</configBuildOptions>
<lastBuildOptions xsi:type="systemproject:SystemOptions">
<applications name="wolfCrypt_FreeRTOS_example" domainName="freertos" domainPrettyName="freertos" appBuildConfig="Release"/>
<options xsi:type="sdkproject:SdkOptions" generateSdCard="true"/>
</lastBuildOptions>
</configuration>
</systemproject:SystemProject>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="ASCII"?>
<sdkproject:SdkProject xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdkproject="http://www.xilinx.com/sdkproject" name="wolfCrypt_example" platformUID="xilinx:vmk180::0.0(custom)" systemProject="wolfCrypt_example_system" sysConfig="vmk180" runtime="cpp" cpu="standalone_domain" cpuInstance="versal_cips_0_pspmc_0_psv_cortexa72_0" os="standalone" mssSignature="69319cadb247104471151c20895b8098">
<configuration name="Debug" id="xilinx.gnu.arm.a53.exe.debug.1474877702" dirty="true">
<configBuildOptions xsi:type="sdkproject:SdkOptions"/>
<lastBuildOptions xsi:type="sdkproject:SdkOptions"/>
</configuration>
<configuration name="Release" id="xilinx.gnu.arm.a53.exe.release.1927748810">
<configBuildOptions xsi:type="sdkproject:SdkOptions"/>
<lastBuildOptions xsi:type="sdkproject:SdkOptions"/>
</configuration>
<template appTemplateName="empty_application"/>
</sdkproject:SdkProject>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="ASCII"?>
<systemproject:SystemProject xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdkproject="http://www.xilinx.com/sdkproject" xmlns:systemproject="http://www.xilinx.com/systemproject" name="wolfCrypt_example_system" platformUID="xilinx:vmk180::0.0(custom)" sysConfig="vmk180" runtime="cpp" dimmRepoPath="" rootFSLocation="" linuxImage="" sysroot="">
<configuration name="Debug" id="com.xilinx.sdx.system.managedbuilder.debugConfiguration.750862644">
<configBuildOptions xsi:type="systemproject:SystemOptions">
<applications name="wolfCrypt_example" domainName="standalone_domain" domainPrettyName="standalone on versal_cips_0_pspmc_0_psv_cortexa72_0" appBuildConfig="Debug"/>
<options xsi:type="sdkproject:SdkOptions" generateSdCard="true"/>
</configBuildOptions>
<lastBuildOptions xsi:type="systemproject:SystemOptions">
<applications name="wolfCrypt_example" domainName="standalone_domain" domainPrettyName="standalone on versal_cips_0_pspmc_0_psv_cortexa72_0" appBuildConfig="Debug"/>
<options xsi:type="sdkproject:SdkOptions" generateSdCard="true"/>
</lastBuildOptions>
</configuration>
<configuration name="Release" id="com.xilinx.sdx.system.managedbuilder.releaseConfiguration.687928633">
<configBuildOptions xsi:type="systemproject:SystemOptions">
<applications name="wolfCrypt_example" domainName="standalone_psv_cortexa72_0" domainPrettyName="standalone_psv_cortexa72_0" appBuildConfig="Release"/>
<options xsi:type="sdkproject:SdkOptions" generateSdCard="true"/>
</configBuildOptions>
<lastBuildOptions xsi:type="systemproject:SystemOptions">
<applications name="wolfCrypt_example" domainName="standalone_psv_cortexa72_0" domainPrettyName="standalone_psv_cortexa72_0" appBuildConfig="Release"/>
<options xsi:type="sdkproject:SdkOptions" generateSdCard="true"/>
</lastBuildOptions>
</configuration>
</systemproject:SystemProject>

View File

@@ -0,0 +1,187 @@
# Common Gotcha's
- If compiling all code together (ie no separate wolfssl library) then the -fPIC compiler flag should be used. Without using -fPIC in this build setup there could be unexpected failures.
- If building with ARMv8 crypto extensions then the compiler flags "-mstrict-align -mcpu=generic+crypto" must be used.
- Check that enough stack and heap memory is set for the operations if a crash or stall happens.
# Xilinx SDK wolfCrypt Vitis 2018.2 Project
To use this example project:
1. Start a new workspace
2. Create a new BSP called `standalone_bsp_0`.
3. Copy `.cproject` and `.project` from IDE/XilinxSDK/2018_2 into the wolfSSL root.
4. From the Xilinx SDK Import wolfBoot using "Import" -> "Existing Projects into Workspace".
# Detailed Instructions For Example Use With Vitis 2019.2
1. Create a new workspace located in the directory wolfssl/IDE/XilinxSDK/2019_2
2. Create a new BSP, by selecting;
- File->New->Platform Project
- Setting "Project name" to standalone_bsp_0, then click "Next"
- Select the "Create from hardware specification" radius and click "Next"
- "Browse..." to the desired XSA file for the hardware
- (optional) change Processor to R5 now
- click "Finish"
3. (optional) If building for TLS support than expand the standalone_bsp_0 project, double click on platform_spr, Expand the cpu (i.e psu_cortexa53_0), click on Board Support Package, select the "Modify BSP Settings..." box and click on lwip211. Note that the api_mode should be changed from RAW API to SOCKET API.
4. Right click on the standalone_bsp_0 project and click on "Build Project"
5. Import the wolfcrypt example project "File->Import->Eclipse workspace or zip file"
6. Uncheck "Copy projects into workspace"
7. Select the root directory of `wolfssl/IDE/XilinxSDK/2019_2`, and select `wolfCrypt_example` and `wolfCrypt_example_system`. Then click "Finish"
# Detailed Instructions For Example Use With Vitis 2022.1
This shows the necessary steps on the basis of using the VMK180 development board.
1. Create a new workspace located in the directory `wolfssl/IDE/XilinxSDK/2022_1`.
2. Create a new platform project.
- On the welcome screen select "Create platform project".
- Give it a good name, e.g. `vmk180` and click 'Next'.
- In the Hardware Specification drop-down menu select "vmk180" and click 'Finish'.
3. Enable the necessary libraries in the bsp.
- Open `platform.spr` in the 'vmk180' platform project.
- In the tree-view select "Board Support Package" and click on "Modify BSP Settings...".
- Enable the `xilmailbox` and `xilsecure` libraries.
- In this tree-view on the left side under "Overview->standalone" appeared now a "xilsecure" entry.
- Select "xilsecure" and change the configuration of `cache_disable` to `false`. Press 'OK' to confirm the change.
- Build the platform project, either via "Project->Build All" or by the keyboard shortcut 'CTRL+b'.
4. Import the wolfcrypt example projects "File->Import->Eclipse workspace or zip file".
- Behind 'Select Root directory' click on 'Browse...'. You should already be in the correct directory, but still make sure that you're in `wolfssl/IDE/XilinxSDK/2022_1/`. Click 'Open'.
- Uncheck "Copy projects into workspace".
- Select the two example projects `wolfCrypt_example` and `wolfCrypt_example_system`, then click 'Finish'.
5. Fix the missing link from platform project and system project.
- In the 'Explorer' Window open the `wolfCrypt_example_system` and double-click `wolfCrypt_example_system.prj`.
- You should normally see a pop-up with the title "Platform invalid". Click on "Change referred platform", select your platform and click 'OK'.
- In case you didn't see the pop-up, you should see the 'System Project Settings'. Click on the `...` behind 'Platform', select your platform and click 'OK'.
- Vitis will now remind you that all build configurations will be cleaned, click 'Yes'.
6. Create a new linker script
- In the 'Explorer' Window open the `wolfCrypt_example_system` and right-click on the `wolfCrypt_example` project. Click 'Generate Linker Script'.
- Configure the memory sections you want to use, the default should be OK for this example.
- 'Heap Size' must be increased according to your use case. For this example to run it is sufficient to increase to `8 MB`. For benchmarks with big chunk sizes increase to `512 MB`.
- Increase 'Stack Size' to `32 KB`.
- Click 'Generate'
## FreeRTOS based example projects
1. In the previously created `vmk180` platform, one can see a tree where you can also find the "Board support package" settings.
- Click on the bold green `+` on the top to 'Add Domain'.
- Give the new domain the name "freertos" and change the "OS" in the drop-down menu to "freertos".
2. Repeat the same steps of the previous step 3 for the newly created domain.
- In the tree-view select "freertos10_xilinx" and then open the "kernel_behavior" sub-entry.
- Change `minimal_stack_size` to `8000`, `tick_rate` to `1000` and `total_heap_size` to `8388608`. "Big chunk sizes" have not been tested under FreeRTOS.
3. Repeat the same steps of the preivous steps 4 to 6, but with the `wolfCrypt_FreeRTOS_example` resp. `wolfCrypt_FreeRTOS_example_system`.
## Troubleshooting
* `make: *** No rule to make target '../src/lscript.ld', needed by 'wolfCrypt_example.elf'. Stop.`: You forgot to create the linker script
* `/path/to/wolfssl/wolfcrypt/port/xilinx/xil-versal-glue.h:30:10: fatal error: xsecure_mailbox.h: No such file or directory`: You forgot to add the `xilmailbox` and/or `xilsecure` libraries.
* `/path/to/wolfssl/wolfcrypt/src/port/xilinx/xil-aesgcm.c:90: undefined reference to 'Secure_AesInitialize'` (and others): You forgot to build the platform project after adding the libraries.
## Code formatter
In case one wants to write code in "wolfSSL style" in Vitis:
- go to "Window->Preferences->Additional->C/C++->Code Style->Formatter".
- Click on 'Import', navigate to `wolfssl/IDE/XilinxSDK/` and select the file `eclipse_formatter_profile.xml`, click on 'Apply and Close'.
## Configuration
All configuration is done through the header file in `wolfssl/IDE/XilinxSDK/user_settings.h`
### Build flavors
Define `WOLFSSL_XILINX_CRYPT` to enable the **crypto engines**. (This is the default)
Undefine `WOLFSSL_XILINX_CRYPT` and define `WOLFSSL_ARMASM` to enable the **ARMv8 Cryptographic Extensions**.
Undefine both `WOLFSSL_XILINX_CRYPT` and `WOLFSSL_ARMASM` to enable a **software-only build**.
### Further features
Define `WC_XIL_AESGCM_DPA_CM` to enable Counter Measures for Differential Power Analysis of the AES-GCM core. (Only available when using the crypto engines).
Undefine `HAVE_HASHDRBG` to enable usage of the DRBG in the crypto engine.
Define `WOLFSSL_ECDSA_DETERMINISTIC_K` to use "deterministic K" as of RFC6979. (Supported for all three build flavors).
# Steps For Creating Project From Scratch
1. Create a new workspace
2. Create a new BSP, by selecting;
- File->New->Platform Project
- Setting "Project name" to standalone_bsp_0, then click "Next"
- Select the "Create from hardware specification" radius and click "Next"
- "Browse..." to the desired XSA file for the hardware
- (optional) change Processor to R5 now
- click "Finish"
3. (optional) If building for TLS support than expand the standalone_bsp_0 project, double click on platform_spr, Expand the cpu (i.e psu_cortexa53_0), click on Board Support Package, select the "Modify BSP Settings..." box and click on lwip211. Note that the api_mode should be changed from RAW API to SOCKET API.
4. Right click on the standalone_bsp_0 project and click on "Build Project"
5. Create wolfssl project File->New->Application Project
6. Name the project wolfCrypt_example, select "Next"
7. For the platform select standalone_bsp_0 and click next, then next once more on Domain.
8. Select "Empty Application" and click "Finish"
9. Expand the wolfCrypt_example project and right click on the folder "src".
10. Select "Import Sources" and set the "From directory" to be the wolfssl root directory.
11. Select the folders to import as ./src, ./IDE/XilinxSDK, ./wolfcrypt/benchmark, ./wolfcrypt/test, ./wolfcrypt/src
12. (optional) Expand the Advanced table and select "Create links in workspace"
13. Click on "Finish"
14. Expand the wolfcrypt/src directory and exclude all .S files from the build
15. Right click on the wolfCrypt_example project and got to Properties. Set the macro `WOLFSSL_USER_SETTINGS` in C/C++ Build->Settings->ARM v8 gcc compiler->Symbols
16. Set the include path for finding user_settings.h by going to the Properties and setting it in C/C++ Build->Settings->ARM v8 gcc compiler->Directories. This is to the directory wolfssl/IDE/XilinxSDK
17. Set the include path for finding wolfSSL headers. To the root directory wolfssl
18. Add compiler flags "-fPIC -mstrict-align -mcpu=generic+crypto" to the project properties. C/C++ Build->Settings->ARM v8 gcc compiler->Miscellaneous
19. Right click on wolfCrypt_example and "Build Project"
## Platform
Tested on the Zynq UltraScale+ MPSoC (ZUC102).
This is a bare-metal example for wolfCrypt only with algorithm support for:
* RNG
* RSA
* ECC
* AES-GCM
* ChaCha20
* Poly1305
* SHA2
* SHA3
* PBKDF2
## Benchmark Results
```
------------------------------------------------------------------------------
wolfSSL version 4.3.0
------------------------------------------------------------------------------
wolfCrypt Benchmark (block bytes 1024, min sec each)
RNG 72 MB took 1.000 seconds, 72.388 MB/s
AES-128-GCM-enc 370 MB took 1.000 seconds, 370.312 MB/s
AES-128-GCM-dec 187 MB took 1.000 seconds, 187.451 MB/s
AES-192-GCM-enc 341 MB took 1.000 seconds, 341.382 MB/s
AES-192-GCM-dec 180 MB took 1.000 seconds, 179.663 MB/s
AES-256-GCM-enc 316 MB took 1.000 seconds, 316.382 MB/s
AES-256-GCM-dec 172 MB took 1.000 seconds, 172.485 MB/s
CHACHA 256 MB took 1.000 seconds, 255.859 MB/s
CHA-POLY 98 MB took 1.000 seconds, 97.559 MB/s
POLY1305 517 MB took 1.000 seconds, 516.895 MB/s
SHA-256 535 MB took 1.000 seconds, 534.595 MB/s
SHA-384 123 MB took 1.000 seconds, 123.291 MB/s
SHA-512 124 MB took 1.000 seconds, 123.657 MB/s
SHA3-224 70 MB took 1.000 seconds, 70.337 MB/s
SHA3-256 67 MB took 1.000 seconds, 66.528 MB/s
SHA3-384 53 MB took 1.000 seconds, 52.710 MB/s
SHA3-512 38 MB took 1.000 seconds, 37.598 MB/s
HMAC-SHA256 520 MB took 1.000 seconds, 520.093 MB/s
HMAC-SHA384 121 MB took 1.000 seconds, 121.265 MB/s
HMAC-SHA512 121 MB took 1.000 seconds, 121.289 MB/s
PBKDF2 28 KB took 1.000 seconds, 28.375 KB/s
ECC 256 key gen 8518 ops took 1.000 sec, avg 0.117 ms, 8518.000 ops/sec
ECDHE 256 agree 1818 ops took 1.000 sec, avg 0.550 ms, 1818.000 ops/sec
ECDSA 256 sign 4448 ops took 1.000 sec, avg 0.225 ms, 4448.000 ops/sec
ECDSA 256 verify 1430 ops took 1.000 sec, avg 0.699 ms, 1430.000 ops/sec
Benchmark complete
Benchmark Test: Return code 0
```

View File

@@ -0,0 +1,77 @@
#!/usr/bin/env bash
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Parametrisation to this script is as follows:
# * The first argument will be taken as suffix to the result folder
# e.g. `./bench.sh _config0`
# * It is possible to make its output a bit more verbose by setting
# the `VERBOSE` environment variable to '1', e.g. via
# `VERBOSE=1 ./bench.sh` or to make it quiet by setting it to '0'
# * Per default we read from /dev/ttyUSB2, by setting the `WC_TTY`
# environment variable this can adapted
# e.g. `WC_TTY=/dev/ttyACM0 ./bench.sh`
###
# Preamble
###
my_path=$(dirname $(readlink -f $0)) || exit $?
readonly my_path
readonly csv_path_suffix="$1"
readonly common_opts="-blocks 128"
readonly ccm_gcm_opts="-all_aad -aad_size 13"
# options used in `small_block()`
readonly cbc_opts="$common_opts"
readonly ccm_opts="$common_opts $ccm_gcm_opts"
readonly gcm_opts="$common_opts $ccm_gcm_opts"
readonly small_block_ciphers="cbc ccm gcm"
readonly small_block_ciphers_hw="gcm"
readonly small_block_sizes="16 528 1024 4112 7696 15888 32768 65536 131072"
# options used in `large_block()`
readonly ccm_fast_opts="$common_opts -all_aad"
readonly gcm_fast_opts="$common_opts -all_aad"
# 512 MiB transfer, 128 MiB max. blocksize
readonly large_block_ciphers="gcm"
readonly large_num_bytes=$((512 * 1024 * 1024))
readonly large_max_blocksize=$((128 * 1024 * 1024))
source "$my_path"/../../scripts/bench/bench_functions.sh
###
# Implementation
###
[ "$1" == "_HW" ] && small_block "$small_block_ciphers_hw" \
|| small_block "$small_block_ciphers"
# No large blocksizes for analysis
#[ "$1" == "_HW" ] && large_block
# Benchmark only on HW and SW
if [ "$1" != "_ARMv8" ]; then
bench "ecc" "-ecc -ecc-all -ecc-kg"
bench "sha3" "-sha3-384"
for keysize in 2048 3072 4096
do
bench "rsa" "-rsa-sz -rsa-kg $keysize" "_$keysize"
done
bench "rng" "-rng"
fi
# Benchmark only on ARMv8 and SW
if [ "$1" != "_HW" ]; then
bench "sha2" "-sha2"
bench "cmac" "-cmac"
fi
#eof

View File

@@ -0,0 +1,83 @@
#!/usr/bin/env bash
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Parametrisation to this script is as follows:
# * none yet
###
# Preamble
###
my_path="$(dirname $(readlink -f $0))" || exit $?
readonly my_path
readonly csv_path="$my_path/data"
function cleanup() {
echo OK
}
trap cleanup EXIT
function error_out() {
exit 1
}
trap error_out INT TERM
###
# Functions
###
###
# Implementation
###
configs=$(find $csv_path -maxdepth 1 -type d -name '*results_*' | sed 's@.*results_@@g') || exit $?
readonly configs
declare -A algos
algos["asym"]="ecc rsa"
algos["hashes"]="sha2 sha3"
algos["mac"]="cmac"
algos["rng"]="rng"
algos["sym"]="cbc ccm gcm"
declare -A headers
headers["asym"]="config,keysize_2,algorithm,keysize,operation,avg ms,ops/sec,"
headers["hashes"]="config,unused,algorithm,MiB/s,"
headers["mac"]="config,unused,algorithm,keysize,MiB/s,"
headers["rng"]="config,unused,algorithm,MiB/s,"
headers["sym"]="config,chunksize,algorithm,blocksize,direction,AAD,MiB/s,"
# "... now you have two problems"
declare -A filters
filters["ccm"]="-e s/-\(enc\|dec\)-\(no_AAD\|custom\)/,128,\1,\2/g -e s/-\(enc\|dec\),/,128,\1,,/g"
filters["gcm"]="-e /-192-/d -e /GMAC/d -e s/-\(enc\|dec\)-\(no_AAD\|custom\)/,\1,\2/g -e s/-\(enc\|dec\),/,\1,default,/g -e s/\(128\|256\)-GCM/GCM,\1/g"
filters["cbc"]="-e /-192-/d -e s/-\(enc\|dec\),/,\1,,/g -e s/\(128\|256\)-CBC/CBC,\1/g"
filters["cmac"]="-e s/\(128\|256\)-CMAC/CMAC,\1/g"
filters["ecc"]='-e 1!{/SECP384R1\|SECP521R1/!d}'
filters["sha2"]="-e s/SHA-/SHA2-/g"
for t in "${!algos[@]}"
do
for algo in ${algos[$t]}
do
outfile="$csv_path/combined_${algo}.csv"
echo ${headers[$t]} > "$outfile"
for cfg in $configs
do
for f in $(find $csv_path/results_${cfg} -name "*${algo}*.csv" | sort -V)
do
sz=$(basename $f | sed -e s/${algo}// -e s/_// -e s/\.csv//)
sz=",$sz"
for l in $(tail -n +2 $f | tr -d ' ')
do
echo "${cfg}${sz},${l}" >> "$outfile"
done
[ "${filters[$algo]}" == "" ] || sed -i "$outfile" ${filters[$algo]}
done
echo $algo $t $cfg
done
done
done

View File

@@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="1">
<profile kind="CodeFormatterProfile" name="wolfssl" version="1">
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_exception_specification" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_base_clause" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_conditional_expression" value="18"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="true"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_binary_expression" value="18"/>
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_method_declaration" value="next_line"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_array_initializer" value="next_line_shifted"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_switch" value="next_line"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_expression_list" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_base_clause" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_base_types" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.comment.line_up_line_comment_in_blocks_on_first_column" value="false"/>
<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_namespace_header" value="false"/>
<setting id="org.eclipse.cdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/>
<setting id="org.eclipse.cdt.core.formatter.indent_access_specifier_extra_spaces" value="0"/>
<setting id="org.eclipse.cdt.core.formatter.comment.never_indent_line_comments_on_first_column" value="true"/>
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_expression_list" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block" value="end_of_line"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_bracket" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration" value="80"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_parameters" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_member_access" value="0"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_namespace_declaration" value="next_line"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_parameters_in_method_declaration" value="82"/>
<setting id="org.eclipse.cdt.core.formatter.lineSplit" value="80"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_brackets" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_angle_bracket_in_template_arguments" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_bracket" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_arguments" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_arguments" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_compact_if" value="16"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_declarator_list" value="16"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_expressions_in_array_initializer" value="18"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_between_empty_parens_in_exception_specification" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.cdt.core.formatter.comment.min_distance_between_code_and_line_comment" value="1"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_bracket" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_constructor_initializer_list" value="0"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_declarator_list" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_angle_bracket_in_template_parameters" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_block_in_case" value="next_line"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_parameters" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.compact_else_if" value="true"/>
<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_overloaded_left_shift_chain" value="16"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_identifier_in_function_declaration" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_declarator_list" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_brace_in_namespace_declaration" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.indent_access_specifier_compare_to_type_header" value="false"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_parameters" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_conditional_expression_chain" value="18"/>
<setting id="org.eclipse.cdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_after_template_declaration" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_colon_in_constructor_initializer_list" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.brace_position_for_type_declaration" value="next_line"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.continuation_indentation" value="2"/>
<setting id="org.eclipse.cdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.cdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_parameters" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_expression_list" value="0"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_base_types" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.cdt.core.formatter.indent_declaration_compare_to_template_header" value="false"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_angle_bracket_in_template_arguments" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation" value="18"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_exception_specification" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.join_wrapped_lines" value="true"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_assignment" value="0"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_comma_in_template_arguments" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_after_closing_angle_bracket_in_template_arguments" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_comma_in_template_parameters" value="do not insert"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<setting id="org.eclipse.cdt.core.formatter.indent_body_declarations_compare_to_access_specifier" value="true"/>
<setting id="org.eclipse.cdt.core.formatter.alignment_for_enumerator_list" value="51"/>
<setting id="org.eclipse.cdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.cdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
</profile>
</profiles>

View File

@@ -0,0 +1,330 @@
#!/usr/bin/env bash
# shellcheck disable=SC2043 # noise. fine for a loop to run only once.
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# Parametrisation to this script is as follows:
# * none yet
###
# Preamble
###
my_path="$(dirname $(readlink -f $0))" || exit $?
readonly my_path
readonly csv_path="$my_path/data"
readonly log_path="$csv_path/logs"
readonly img_path="$csv_path/images"
readonly gnuplot_terminal="svg enhanced background rgb 'white' size 800 600"
mkdir -p "$log_path"
mkdir -p "$img_path"
function cleanup() {
echo OK
}
trap cleanup EXIT
function error_out() {
exit 1
}
trap error_out INT TERM
###
# Functions
###
function cg() {
csvgrep -c $1 -r $2 $3
}
###
# Implementation
###
readonly desc_block_ciphers="Benchmarks were done with growing sample size and averaging over\nprocessing of 128 samples of said sample size"
readonly desc_asymmetric="Benchmarks were done with averaging over\nas many repetitions possible of the benchmarked operation in 1s"
readonly desc_others="Benchmarks were done with 1MiB block size and averaging over\nas many repetitions possible of processing 5MiB data in 1s"
configs=$(find $csv_path -type d -name '*results*' | sed 's@.*results_@@g') || exit $?
readonly configs
###
# Symmetric crypto
readonly sym="cbc ccm gcm"
declare -A directions
directions["dec"]="decryption"
directions["enc"]="encryption"
declare -A aad_sizes
aad_sizes["no_AAD"]="0 Bytes"
aad_sizes["custom"]="13 Bytes"
aad_sizes["default"]="16 Bytes"
# not pretty but works for me :)
# CBC&GCM encryption is in software a lot faster than decryption,
# therefor use the same Range on the Y-Axis to also have a visual indication.
# This will break if something changes, so let the user override the value
cbc_yrange="${cbc_yrange:=1400}"
gcm_yrange="${gcm_yrange:=500}"
for mode in $sym
do
infile="$csv_path/combined_${mode}.csv"
for dir in "${!directions[@]}"
do
plotstring=
more_style=
for cfg in $configs
do
for bsize in $(csvcut -c blocksize $infile | tail -n +2 | sort -u)
do
if [ "$mode" == "cbc" ]; then
outfile=$log_path/${mode}${bsize}_${cfg}_${dir}.log
val="$(cg config $cfg $infile | cg blocksize $bsize | cg direction $dir | csvcut -c chunksize,MiB/s | tail -n +2 | tr ',' ' ')"
if [ "$val" != "" ]; then
echo "$val" > $outfile
[ -z "$plotstring" ] && plotstring="plot" || plotstring="${plotstring},"
plotstring="${plotstring} '$outfile' smooth bezier title \"$cfg AES$bsize\""
fi
[ "$mode" == "cbc" -a "$cbc_yrange" != "" ] && more_style="set yrange [ 0 : $cbc_yrange ]"
else
for aad in "${!aad_sizes[@]}"
do
outfile=$log_path/${mode}${bsize}_${cfg}_${dir}_${aad}.log
val="$(cg config $cfg $infile | cg blocksize $bsize | cg direction $dir | cg AAD $aad | csvcut -c chunksize,MiB/s | tail -n +2 | tr ',' ' ')"
if [ "$val" != "" ]; then
echo "$val" > $outfile
[ -z "$plotstring" ] && plotstring="plot" || plotstring="${plotstring},"
plotstring="${plotstring} '$outfile' smooth bezier title \"$cfg AES$bsize ${aad_sizes[$aad]} AAD\""
fi
done
[ "$mode" == "gcm" -a "$gcm_yrange" != "" ] && more_style="set yrange [ 0 : $gcm_yrange ]"
fi
done
done
modep=${mode^^}
gnuplot << EOF
set terminal $gnuplot_terminal
set title "${modep} ${directions[${dir}]} on Xilinx Versal"
set x2label "${desc_block_ciphers}"
set xlabel "Sample size"
set ylabel "MiB/s"
set style data lines
$more_style
set output "${img_path}/${mode}_${dir}.${gnuplot_terminal%% *}"
$plotstring
EOF
done
done
###
# Also create separate graphs for AES-GCM-128 and -256 since that's too many lines in one image
for mode in gcm
do
infile="$csv_path/combined_${mode}.csv"
for dir in "${!directions[@]}"
do
for bsize in $(csvcut -c blocksize $infile | tail -n +2 | sort -u)
do
plotstring=
more_style="set yrange [ 0 : $gcm_yrange ]"
for cfg in $configs
do
for aad in "${!aad_sizes[@]}"
do
outfile=$log_path/${mode}${bsize}_${cfg}_${dir}_${aad}.log
val="$(cg config $cfg $infile | cg blocksize $bsize | cg direction $dir | cg AAD $aad | csvcut -c chunksize,MiB/s | tail -n +2 | tr ',' ' ')"
if [ "$val" != "" ]; then
echo "$val" > $outfile
[ -z "$plotstring" ] && plotstring="plot" || plotstring="${plotstring},"
plotstring="${plotstring} '$outfile' smooth bezier title \"$cfg AES$bsize ${aad_sizes[$aad]} AAD\""
fi
done
done
modep=${mode^^}
gnuplot << EOF
set terminal $gnuplot_terminal
set title "${modep}-${bsize} ${directions[${dir}]} on Xilinx Versal"
set x2label "${desc_block_ciphers}"
set xlabel "Sample size"
set ylabel "MiB/s"
set style data lines
$more_style
set output "${img_path}/${mode}${bsize}_${dir}.${gnuplot_terminal%% *}"
$plotstring
EOF
done
done
done
###
# Asymmetric crypto
declare -A asym_operations
asym_operations["ecc"]="keygen agree sign verify"
asym_operations["rsa"]="keygen public private"
for algo in "${!asym_operations[@]}"
do
infile="$csv_path/combined_${algo}.csv"
for op in ${asym_operations[$algo]}
do
outfile=$log_path/${algo}_${op}.log
echo -n "" > $outfile
for ksize in $(csvcut -c keysize $infile | tail -n +2 | sort -u)
do
for cfg in $configs
do
h="${algo^^}-$ksize"
v=$(cg config $cfg $infile | cg operation $op | cg keysize $ksize | csvcut -c "avg ms" | tail -n +2 | tr ',' ' ')
[ "$v" != "" ] && echo "$h\n$cfg $v" >> $outfile
done
done
algop=${algo^^}
gnuplot << EOF
set terminal $gnuplot_terminal
set title "${algop} ${op} on Xilinx Versal"
set x2label "${desc_asymmetric}"
set xlabel 'Configurations' offset 0,-1
set ylabel "ms per op"
set style fill solid
set style line 1 lc rgb "grey50"
set boxwidth 0.5
unset key
set output "${img_path}/${algo}_${op}.${gnuplot_terminal%% *}"
plot "$outfile" using :2:xtic(1) with boxes ls 1, \
'' using :2:2 w labels offset 0,0.7
EOF
done
done
###
# Hashes
declare -A hash_sizes
hash_sizes["sha2"]="224 256 384 512"
hash_sizes["sha3"]="384"
plotstring=
outfile=$log_path/sha.log
echo -n "" > $outfile
for algo in "${!hash_sizes[@]}"
do
infile="$csv_path/combined_${algo}.csv"
for hsize in ${hash_sizes[$algo]}
do
for cfg in $configs
do
h="${algo^^}-$hsize"
v=$(cg config $cfg $infile | cg algorithm $h | csvcut -c MiB/s | tail -n +2 | sed 's@\..*$@@')
[ "$v" != "" ] && echo "$h\n$cfg $v" >> $outfile
done
echo >> $outfile
done
done
gnuplot << EOF
set terminal $gnuplot_terminal
set title "SHA2/SHA3 on Xilinx Versal"
set x2label "${desc_others}"
set xlabel 'Configurations' offset 0,-1
set ylabel "MiB/s"
set style fill solid
set style line 1 lc rgb "grey50"
set boxwidth 0.5
unset key
set output "${img_path}/sha.${gnuplot_terminal%% *}"
plot "$outfile" using :2:xtic(1) with boxes ls 1, \
'' using :2:2 w labels offset 0,0.7
EOF
###
# MACs
declare -A macs
macs["cmac"]="128 256"
plotstring=
outfile=$log_path/mac.log
echo -n "" > $outfile
for algo in "${!macs[@]}"
do
infile="$csv_path/combined_${algo}.csv"
for hsize in ${macs[$algo]}
do
for cfg in $configs
do
h="${algo^^}-$hsize"
v=$(cg config $cfg $infile | cg keysize $hsize | csvcut -c MiB/s | tail -n +2 | sed 's@\..*$@@')
[ "$v" != "" ] && echo "$h\n$cfg $v" >> $outfile
done
echo >> $outfile
done
done
gnuplot << EOF
set terminal $gnuplot_terminal
set title "MAC's on Xilinx Versal"
set x2label "${desc_others}"
set xlabel 'Configurations' offset 0,-1
set ylabel "MiB/s"
set style fill solid
set style line 1 lc rgb "grey50"
set boxwidth 0.5
unset key
set yrange [ 0 : 500 ]
set output "${img_path}/mac.${gnuplot_terminal%% *}"
plot "$outfile" using :2:xtic(1) with boxes ls 1, \
'' using :2:2 w labels offset 0,0.7
EOF
###
# RNG
plotstring=
outfile=$log_path/rng.log
echo -n "" > $outfile
for algo in rng
do
infile="$csv_path/combined_${algo}.csv"
for cfg in $configs
do
h="${algo^^}"
v=$(cg config $cfg $infile | csvcut -c MiB/s | tail -n +2 | sed 's@\..*$@@')
[ "$v" != "" ] && echo "$h\n$cfg $v" >> $outfile
done
echo >> $outfile
done
gnuplot << EOF
set terminal $gnuplot_terminal
set title "RNG on Xilinx Versal"
set x2label "${desc_others}"
set xlabel 'Configurations' offset 0,-1
set ylabel "MiB/s"
set style fill solid
set style line 1 lc rgb "grey50"
set boxwidth 0.5
unset key
set yrange [ 0 : 50 ]
with_unit(Value,Unit) = sprintf("%d %s", Value, Unit)
set output "${img_path}/rng.${gnuplot_terminal%% *}"
plot "$outfile" using :2:xtic(1) with boxes ls 1, \
'' using :2:2 w labels offset 0,0.7
EOF
#eof

View File

@@ -0,0 +1,33 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root
EXTRA_DIST+= IDE/XilinxSDK/README.md
EXTRA_DIST+= IDE/XilinxSDK/bench.sh
EXTRA_DIST+= IDE/XilinxSDK/combine.sh
EXTRA_DIST+= IDE/XilinxSDK/eclipse_formatter_profile.xml
EXTRA_DIST+= IDE/XilinxSDK/graph.sh
EXTRA_DIST+= IDE/XilinxSDK/user_settings.h
EXTRA_DIST+= IDE/XilinxSDK/wolfssl_example.c
EXTRA_DIST+= IDE/XilinxSDK/2018_2/lscript.ld
EXTRA_DIST+= IDE/XilinxSDK/2018_2/.cproject
EXTRA_DIST+= IDE/XilinxSDK/2018_2/.project
EXTRA_DIST+= IDE/XilinxSDK/2019_2/wolfCrypt_example/.cproject
EXTRA_DIST+= IDE/XilinxSDK/2019_2/wolfCrypt_example/.project
EXTRA_DIST+= IDE/XilinxSDK/2019_2/wolfCrypt_example/src/lscript.ld
EXTRA_DIST+= IDE/XilinxSDK/2019_2/wolfCrypt_example_system/.cproject
EXTRA_DIST+= IDE/XilinxSDK/2019_2/wolfCrypt_example_system/.project
EXTRA_DIST+= IDE/XilinxSDK/2019_2/wolfCrypt_example_system/wolfCrypt_example_system.sprj
EXTRA_DIST+= IDE/XilinxSDK/2022_1/.gitignore
EXTRA_DIST+= IDE/XilinxSDK/2022_1/wolfCrypt_example/.cproject
EXTRA_DIST+= IDE/XilinxSDK/2022_1/wolfCrypt_example/.project
EXTRA_DIST+= IDE/XilinxSDK/2022_1/wolfCrypt_example/wolfCrypt_example.prj
EXTRA_DIST+= IDE/XilinxSDK/2022_1/wolfCrypt_example_system/.cproject
EXTRA_DIST+= IDE/XilinxSDK/2022_1/wolfCrypt_example_system/.project
EXTRA_DIST+= IDE/XilinxSDK/2022_1/wolfCrypt_example_system/wolfCrypt_example_system.sprj
EXTRA_DIST+= IDE/XilinxSDK/2022_1/wolfCrypt_FreeRTOS_example/.cproject
EXTRA_DIST+= IDE/XilinxSDK/2022_1/wolfCrypt_FreeRTOS_example/.project
EXTRA_DIST+= IDE/XilinxSDK/2022_1/wolfCrypt_FreeRTOS_example/wolfCrypt_FreeRTOS_example.prj
EXTRA_DIST+= IDE/XilinxSDK/2022_1/wolfCrypt_FreeRTOS_example_system/.cproject
EXTRA_DIST+= IDE/XilinxSDK/2022_1/wolfCrypt_FreeRTOS_example_system/.project
EXTRA_DIST+= IDE/XilinxSDK/2022_1/wolfCrypt_FreeRTOS_example_system/wolfCrypt_FreeRTOS_example_system.sprj

View File

@@ -0,0 +1,179 @@
/* user_settings.h
*
* Copyright (C) 2006-2022 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
*/
/*
* user_settings.h
*
* Created on: Mar 20, 2020
* Generated using:
* ./configure --enable-cryptonly --enable-armasm --enable-ecc --enable-aesgcm --enable-pwdbased --enable-sp --enable-sp-asm \
* --disable-dh --disable-sha --disable-md5 --disable-sha224 --disable-aescbc --disable-shake256
* Result: wolfssl/options.h
*/
#ifndef SRC_USER_SETTINGS_H_
#define SRC_USER_SETTINGS_H_
#include <xparameters.h>
/* Disable all TLS support, only wolfCrypt features */
#define WOLFCRYPT_ONLY
/* Xilinx SDK */
#define WOLFSSL_XILINX
#define WOLFSSL_XILINX_CRYPT
#if defined(versal) && defined(WOLFSSL_XILINX_CRYPT)
#define WOLFSSL_XILINX_CRYPT_VERSAL
#endif
#ifndef FREERTOS
#define SINGLE_THREADED
#endif
#define NO_FILESYSTEM
#define HAVE_UINTPTR_T
/* Platform - remap printf */
#include "xil_printf.h"
#define XPRINTF xil_printf
#if !defined(WOLFSSL_XILINX_CRYPT_VERSAL)
/* Enable ARMv8 (Aarch64) assembly speedups - SHA256 / AESGCM */
/* Note: Requires CFLAGS="-mcpu=generic+crypto -mstrict-align" */
#define WOLFSSL_ARMASM
#endif
/* Math */
#define USE_FAST_MATH
#define FP_MAX_BITS (4096 * 2) /* Max RSA 4096-bit */
/* Use Single Precision assembly math speedups for ECC */
#define WOLFSSL_SP
#define WOLFSSL_SP_ASM
#define WOLFSSL_SP_ARM64_ASM
#define WOLFSSL_HAVE_SP_ECC
#define WOLFSSL_HAVE_SP_RSA
#if defined(WOLFSSL_XILINX_CRYPT_VERSAL)
/* Random: HashDRGB / P-RNG (SHA256) */
/* Versal supports both, with and w/o software-based HashDRGB.
* It's your choice */
#define HAVE_HASHDRBG
#define WOLFSSL_PSV_TRNG_DEV_ID XPAR_VERSAL_CIPS_0_PSPMC_0_PSV_PMC_TRNG_DEVICE_ID
#if !defined(HAVE_HASHDRBG)
#define CUSTOM_RAND_GENERATE_BLOCK wc_VersalTrngGenerate
#else
#define CUSTOM_RAND_GENERATE_SEED wc_VersalTrngGenerate
#endif
#else
/* If we don't use the Versal Crypto we need the HASHDRBG */
#define HAVE_HASHDRBG
extern unsigned char my_rng_seed_gen(void);
#define CUSTOM_RAND_GENERATE my_rng_seed_gen
#endif
/* Timing Resistance */
#define TFM_TIMING_RESISTANT
#define ECC_TIMING_RESISTANT
#define WC_RSA_BLINDING
//#define WC_XIL_AESGCM_DPA_CM
/* ECC */
#define HAVE_ECC
#if defined(WOLFSSL_XILINX_CRYPT_VERSAL)
#define ECC_USER_CURVES
#define NO_ECC256
#define WOLFSSL_SP_NO_256
#define HAVE_ECC384
#define WOLFSSL_SP_384
#define HAVE_ECC521
#define WOLFSSL_SP_521
/* Versal also supports usage of RFC6979 if you want to */
//#define WOLFSSL_ECDSA_DETERMINISTIC_K
#else
#define TFM_ECC256
#define ECC_SHAMIR
#endif
/* DH */
#undef NO_DH
#define WOLFSSL_DH_CONST
#define HAVE_FFDHE_2048
#define HAVE_FFDHE_4096
/* Curve25519 / Ed25519 */
#define HAVE_CURVE25519
#define HAVE_ED25519 /* ED25519 Requires SHA512 */
/* 25519 assumes UINT128_T is available for Aarch64 */
#ifndef HAVE___UINT128_T
#define HAVE___UINT128_T
#endif
/* ChaCha20 / Poly1305 */
#define HAVE_CHACHA
#define HAVE_POLY1305
/* AES-CBC is enabled by default if not disabled
* The others have to be enabled */
#define HAVE_AESCCM
#define HAVE_AESGCM
#define WOLFSSL_AES_DIRECT
#define WOLFSSL_CMAC
/* Hashing */
#define WOLFSSL_SHA512
#define WOLFSSL_SHA384
#define WOLFSSL_SHA224
#define WOLFSSL_SHA3
#define WOLFSSL_NO_HASH_RAW /* not supported with ARMASM */
#define WOLFSSL_NO_SHAKE128
#define WOLFSSL_NO_SHAKE256
/* HKDF */
#define HAVE_HKDF
/* Disable Algorithms */
#define NO_DSA
#define NO_RC4
#define NO_MD4
#define NO_MD5
#define NO_SHA
#define NO_PSK
#define NO_DES3
/* Other */
#define WOLFSSL_IGNORE_FILE_WARN /* Ignore file include warnings */
#define NO_MAIN_FUNCTION /* User supplied "main" entry point */
//#define BENCH_EMBEDDED /* Use smaller buffers for benchmarking */
#define WOLFSSL_KEY_GEN
/* Pre-define AAD size to 16 for benchmarks. When executing the benchmarks we
* also use a custom size of 13 to measure "the default size". */
#define AES_AUTH_ADD_SZ 16
/* Test with "wolfssl/certs_test.h" buffers - no file system */
#define USE_CERT_BUFFERS_256
#define USE_CERT_BUFFERS_2048
/* Debugging */
#if 0
#define DEBUG_WOLFSSL
#endif
#endif /* SRC_USER_SETTINGS_H_ */

View File

@@ -0,0 +1,217 @@
/* wolfssl_example.c
*
* Copyright (C) 2006-2022 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
*/
#include "xil_printf.h"
#include "xrtcpsu.h"
#ifdef FREERTOS
/* FreeRTOS includes. */
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "timers.h"
#endif
#include "wolfssl/wolfcrypt/settings.h"
#include "wolfssl/wolfcrypt/wc_port.h"
#include "wolfssl/wolfcrypt/error-crypt.h"
#include "wolfssl/wolfcrypt/logging.h"
#include "wolfcrypt/test/test.h"
#include "wolfcrypt/benchmark/benchmark.h"
/*****************************************************************************
* Configuration
****************************************************************************/
/*****************************************************************************
* Private types/enumerations/variables
****************************************************************************/
/*****************************************************************************
* Public types/enumerations/variables
****************************************************************************/
typedef struct func_args
{
int argc;
char **argv;
int return_code;
} func_args;
const char menu1[] = "\n"
"\tb. WolfCrypt Benchmark\n"
"\tt. WolfCrypt Test\n"
"\n"
"\tc. Command mode\n";
/*****************************************************************************
* Private functions
****************************************************************************/
#if !defined(WOLFSSL_XILINX_CRYPT_VERSAL)
/* Test RNG Seed Function */
/* TODO: Must provide real seed to RNG */
unsigned char my_rng_seed_gen(void)
{
static unsigned int kTestSeed = 1;
return kTestSeed++;
}
#endif
/*****************************************************************************
* Public functions
****************************************************************************/
#ifdef FREERTOS
static void wolfssl_task( void *pvParameters );
static TaskHandle_t xWolfsslTask;
int main( void )
{
xil_printf("\nStarting up FreeRTOS\n");
xTaskCreate(wolfssl_task, /* The function that implements the task. */
(const char*) "Tx", /* Text name for the task, provided to assist debugging only. */
configMINIMAL_STACK_SIZE, /* The stack allocated to the task. */
NULL, /* The task parameter is not used, so set to NULL. */
tskIDLE_PRIORITY, /* The task runs at the idle priority. */
&xWolfsslTask);
/* Start the task. */
vTaskStartScheduler();
/* If all is well, the scheduler will now be running, and the following line
will never be reached. If the following line does execute, then there was
insufficient FreeRTOS heap memory available for the idle and/or timer tasks
to be created. See the memory management section on the FreeRTOS web site
for more details. */
for (;;)
;
}
static void wolfssl_task( void *pvParameters )
#else
int main()
#endif
{
uint8_t cmd[128], c;
char *arg[sizeof(cmd)/2 + 1];
size_t cmdlen, argnum, n;
func_args args;
int (*func)(int argc, char** argv);
int command_mode = 0;
#ifdef DEBUG_WOLFSSL
wolfSSL_Debugging_ON();
#endif
/* initialize wolfSSL */
wolfCrypt_Init();
while (1) {
memset(&args, 0, sizeof(args));
args.return_code = NOT_COMPILED_IN; /* default */
if (!command_mode) {
xil_printf("\n\t\t\t\tMENU\n");
xil_printf(menu1);
xil_printf("Please select one of the above options:\n");
xil_printf("Both 'b' and 't' allow arguments as if you'd call the regular shell version.\n");
}
cmdlen = 0;
do {
c = inbyte();
cmd[cmdlen] = c;
if (!command_mode) outbyte(c);
cmdlen++;
cmdlen %= sizeof(cmd);
} while (c != '\n' && c != '\r');
if (cmdlen > 2) {
outbyte('\n');
/* Poor man's argv parser */
XMEMSET(arg, 0, sizeof(arg));
if (cmd[1] == ' ') {
if (cmd[0] == 'b') {
arg[0] = "wolfcrypt_benchmark";
func = wolfcrypt_benchmark_main;
} else if (cmd[0] == 't') {
arg[0] = "wolfcrypt_test";
func = wolfcrypt_test_main;
}
if (arg[0] != NULL) {
argnum = 1;
for (n = 2; n < cmdlen; ++n) {
switch (cmd[n]) {
case ' ':
case '\t':
case '\r':
case '\n':
cmd[n] = '\0';
if (arg[argnum] != NULL)
argnum++;
break;
default:
if (arg[argnum] == NULL)
arg[argnum] = (char*)&cmd[n];
break;
}
}
func(argnum, arg);
}
}
} else {
switch (cmd[0]) {
case 't':
xil_printf("Running wolfCrypt Tests...\n");
#ifndef NO_CRYPT_TEST
args.return_code = 0;
wolfcrypt_test(&args);
#endif
xil_printf("Crypt Test: Return code %d\n", args.return_code);
break;
case 'b':
xil_printf("Running wolfCrypt Benchmarks...\n");
#ifndef NO_CRYPT_BENCHMARK
args.return_code = 0;
benchmark_test(&args);
#endif
xil_printf("Benchmark Test: Return code %d\n", args.return_code);
break;
case 'c':
if (!command_mode) xil_printf("Entering command mode, enter 'c<enter>' to return to manual mode\n");
command_mode ^= 1;
break;
default:
if (!command_mode) xil_printf("\nSelection out of range\n");
break;
}
}
}
wolfCrypt_Cleanup();
#ifndef FREERTOS
return 0;
#endif
}