Update repo
This commit is contained in:
1 parent
749dab5721
commit
ce65a0f59a
14950 files changed
+4408250
-1
No files matched your search
@@ -0,0 +1,133 @@
|
||||
MEMORY
|
||||
{
|
||||
BEGIN : origin = 0x00080000, length = 0x00000002
|
||||
BOOT_RSVD : origin = 0x00000002, length = 0x00000126
|
||||
|
||||
RAMM0 : origin = 0x00000128, length = 0x000002D8
|
||||
RAMM1 : origin = 0x00000400, length = 0x000003F8
|
||||
// RAMM1_RSVD : origin = 0x000007F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
RAMLS0 : origin = 0x00008000, length = 0x00000800
|
||||
RAMLS1 : origin = 0x00008800, length = 0x00000800
|
||||
RAMLS2 : origin = 0x00009000, length = 0x00000800
|
||||
RAMLS3 : origin = 0x00009800, length = 0x00000800
|
||||
RAMLS4 : origin = 0x0000A000, length = 0x00000800
|
||||
RAMLS5 : origin = 0x0000A800, length = 0x00000800
|
||||
RAMLS6 : origin = 0x0000B000, length = 0x00000800
|
||||
RAMLS7 : origin = 0x0000B800, length = 0x00000800
|
||||
|
||||
RAMGS0 : origin = 0x0000C000, length = 0x00001000
|
||||
RAMGS1 : origin = 0x0000D000, length = 0x00001000
|
||||
RAMGS2 : origin = 0x0000E000, length = 0x00001000
|
||||
RAMGS3 : origin = 0x0000F000, length = 0x00000FF8
|
||||
// RAMGS3_RSVD : origin = 0x0000FFF8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
BOOTROM : origin = 0x003F8000, length = 0x00007FC0
|
||||
SECURE_ROM : origin = 0x003F2000, length = 0x00006000
|
||||
|
||||
RESET : origin = 0x003FFFC0, length = 0x00000002
|
||||
|
||||
/* Flash sectors */
|
||||
/* BANK 0 */
|
||||
FLASH_BANK0_SEC0 : origin = 0x080002, length = 0x000FFE
|
||||
FLASH_BANK0_SEC1 : origin = 0x081000, length = 0x001000
|
||||
FLASH_BANK0_SEC2 : origin = 0x082000, length = 0x001000
|
||||
FLASH_BANK0_SEC3 : origin = 0x083000, length = 0x001000
|
||||
FLASH_BANK0_SEC4 : origin = 0x084000, length = 0x001000
|
||||
FLASH_BANK0_SEC5 : origin = 0x085000, length = 0x001000
|
||||
FLASH_BANK0_SEC6 : origin = 0x086000, length = 0x001000
|
||||
FLASH_BANK0_SEC7 : origin = 0x087000, length = 0x001000
|
||||
FLASH_BANK0_SEC8 : origin = 0x088000, length = 0x001000
|
||||
FLASH_BANK0_SEC9 : origin = 0x089000, length = 0x001000
|
||||
FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000
|
||||
FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000
|
||||
FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000
|
||||
FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000
|
||||
FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x001000
|
||||
FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x001000
|
||||
|
||||
/* BANK 1 */
|
||||
FLASH_BANK1_SEC0 : origin = 0x090000, length = 0x001000
|
||||
FLASH_BANK1_SEC1 : origin = 0x091000, length = 0x001000
|
||||
FLASH_BANK1_SEC2 : origin = 0x092000, length = 0x001000
|
||||
FLASH_BANK1_SEC3 : origin = 0x093000, length = 0x001000
|
||||
FLASH_BANK1_SEC4 : origin = 0x094000, length = 0x001000
|
||||
FLASH_BANK1_SEC5 : origin = 0x095000, length = 0x001000
|
||||
FLASH_BANK1_SEC6 : origin = 0x096000, length = 0x001000
|
||||
FLASH_BANK1_SEC7 : origin = 0x097000, length = 0x001000
|
||||
FLASH_BANK1_SEC8 : origin = 0x098000, length = 0x001000
|
||||
FLASH_BANK1_SEC9 : origin = 0x099000, length = 0x001000
|
||||
FLASH_BANK1_SEC10 : origin = 0x09A000, length = 0x001000
|
||||
FLASH_BANK1_SEC11 : origin = 0x09B000, length = 0x001000
|
||||
FLASH_BANK1_SEC12 : origin = 0x09C000, length = 0x001000
|
||||
FLASH_BANK1_SEC13 : origin = 0x09D000, length = 0x001000
|
||||
FLASH_BANK1_SEC14 : origin = 0x09E000, length = 0x001000
|
||||
FLASH_BANK1_SEC15 : origin = 0x09F000, length = 0x001000
|
||||
|
||||
/* BANK 2 */
|
||||
FLASH_BANK2_SEC0 : origin = 0x0A0000, length = 0x001000
|
||||
FLASH_BANK2_SEC1 : origin = 0x0A1000, length = 0x001000
|
||||
FLASH_BANK2_SEC2 : origin = 0x0A2000, length = 0x001000
|
||||
FLASH_BANK2_SEC3 : origin = 0x0A3000, length = 0x001000
|
||||
FLASH_BANK2_SEC4 : origin = 0x0A4000, length = 0x001000
|
||||
FLASH_BANK2_SEC5 : origin = 0x0A5000, length = 0x001000
|
||||
FLASH_BANK2_SEC6 : origin = 0x0A6000, length = 0x001000
|
||||
FLASH_BANK2_SEC7 : origin = 0x0A7000, length = 0x001000
|
||||
FLASH_BANK2_SEC8 : origin = 0x0A8000, length = 0x001000
|
||||
FLASH_BANK2_SEC9 : origin = 0x0A9000, length = 0x001000
|
||||
FLASH_BANK2_SEC10 : origin = 0x0AA000, length = 0x001000
|
||||
FLASH_BANK2_SEC11 : origin = 0x0AB000, length = 0x001000
|
||||
FLASH_BANK2_SEC12 : origin = 0x0AC000, length = 0x001000
|
||||
FLASH_BANK2_SEC13 : origin = 0x0AD000, length = 0x001000
|
||||
FLASH_BANK2_SEC14 : origin = 0x0AE000, length = 0x001000
|
||||
FLASH_BANK2_SEC15 : origin = 0x0AF000, length = 0x000FF0
|
||||
|
||||
// FLASH_BANK0_SEC15_RSVD : origin = 0x0AFFF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN, ALIGN(8)
|
||||
.text : >> FLASH_BANK0_SEC2 | FLASH_BANK0_SEC3 | FLASH_BANK0_SEC4, ALIGN(8)
|
||||
.cinit : > FLASH_BANK0_SEC1, ALIGN(8)
|
||||
.switch : > FLASH_BANK0_SEC1, ALIGN(8)
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMM1
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.init_array : > FLASH_BANK0_SEC1, ALIGN(8)
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS3
|
||||
.bss:cio : > RAMLS0
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS5
|
||||
.const : > FLASH_BANK0_SEC4, ALIGN(8)
|
||||
#else
|
||||
.pinit : > FLASH_BANK0_SEC1, ALIGN(8)
|
||||
.ebss : > RAMLS5
|
||||
.esysmem : > RAMLS5
|
||||
.cio : > RAMLS0
|
||||
.econst : > FLASH_BANK0_SEC4, ALIGN(8)
|
||||
#endif
|
||||
|
||||
ramgs0 : > RAMGS0
|
||||
ramgs1 : > RAMGS0
|
||||
|
||||
/* Allocate IQ math areas: */
|
||||
IQmath : > FLASH_BANK0_SEC1, ALIGN(8)
|
||||
IQmathTables : > FLASH_BANK0_SEC2, ALIGN(8)
|
||||
|
||||
.TI.ramfunc : LOAD = FLASH_BANK0_SEC1,
|
||||
RUN = RAMLS0,
|
||||
LOAD_START(RamfuncsLoadStart),
|
||||
LOAD_SIZE(RamfuncsLoadSize),
|
||||
LOAD_END(RamfuncsLoadEnd),
|
||||
RUN_START(RamfuncsRunStart),
|
||||
RUN_SIZE(RamfuncsRunSize),
|
||||
RUN_END(RamfuncsRunEnd),
|
||||
ALIGN(8)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
MEMORY
|
||||
{
|
||||
BEGIN : origin = 0x00000000, length = 0x00000002
|
||||
BOOT_RSVD : origin = 0x00000002, length = 0x00000126
|
||||
|
||||
RAMM0 : origin = 0x00000128, length = 0x000002D8
|
||||
RAMM1 : origin = 0x00000400, length = 0x000003F8
|
||||
// RAMM1_RSVD : origin = 0x000007F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
RAMLS0 : origin = 0x00008000, length = 0x00000800
|
||||
RAMLS1 : origin = 0x00008800, length = 0x00000800
|
||||
RAMLS2 : origin = 0x00009000, length = 0x00000800
|
||||
RAMLS3 : origin = 0x00009800, length = 0x00000800
|
||||
RAMLS4 : origin = 0x0000A000, length = 0x00000800
|
||||
RAMLS5 : origin = 0x0000A800, length = 0x00000800
|
||||
RAMLS6_7 : origin = 0x0000B000, length = 0x00001000
|
||||
// RAMLS7 : origin = 0x0000B800, length = 0x00000800
|
||||
|
||||
RAMGS0 : origin = 0x0000C000, length = 0x00001000
|
||||
RAMGS1 : origin = 0x0000D000, length = 0x00001000
|
||||
RAMGS2 : origin = 0x0000E000, length = 0x00001000
|
||||
RAMGS3 : origin = 0x0000F000, length = 0x00000FF8
|
||||
// RAMGS3_RSVD : origin = 0x0000FFF8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
BOOTROM : origin = 0x003F8000, length = 0x00007FC0
|
||||
SECURE_ROM : origin = 0x003F2000, length = 0x00006000
|
||||
|
||||
|
||||
RESET : origin = 0x003FFFC0, length = 0x00000002
|
||||
|
||||
/* Flash sectors */
|
||||
/* BANK 0 */
|
||||
FLASH_BANK0_SEC0 : origin = 0x080002, length = 0x000FFE
|
||||
FLASH_BANK0_SEC1 : origin = 0x081000, length = 0x001000
|
||||
FLASH_BANK0_SEC2 : origin = 0x082000, length = 0x001000
|
||||
FLASH_BANK0_SEC3 : origin = 0x083000, length = 0x001000
|
||||
FLASH_BANK0_SEC4 : origin = 0x084000, length = 0x001000
|
||||
FLASH_BANK0_SEC5 : origin = 0x085000, length = 0x001000
|
||||
FLASH_BANK0_SEC6 : origin = 0x086000, length = 0x001000
|
||||
FLASH_BANK0_SEC7 : origin = 0x087000, length = 0x001000
|
||||
FLASH_BANK0_SEC8 : origin = 0x088000, length = 0x001000
|
||||
FLASH_BANK0_SEC9 : origin = 0x089000, length = 0x001000
|
||||
FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000
|
||||
FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000
|
||||
FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000
|
||||
FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000
|
||||
FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x001000
|
||||
FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x001000
|
||||
|
||||
/* BANK 1 */
|
||||
FLASH_BANK1_SEC0 : origin = 0x090000, length = 0x001000
|
||||
FLASH_BANK1_SEC1 : origin = 0x091000, length = 0x001000
|
||||
FLASH_BANK1_SEC2 : origin = 0x092000, length = 0x001000
|
||||
FLASH_BANK1_SEC3 : origin = 0x093000, length = 0x001000
|
||||
FLASH_BANK1_SEC4 : origin = 0x094000, length = 0x001000
|
||||
FLASH_BANK1_SEC5 : origin = 0x095000, length = 0x001000
|
||||
FLASH_BANK1_SEC6 : origin = 0x096000, length = 0x001000
|
||||
FLASH_BANK1_SEC7 : origin = 0x097000, length = 0x001000
|
||||
FLASH_BANK1_SEC8 : origin = 0x098000, length = 0x001000
|
||||
FLASH_BANK1_SEC9 : origin = 0x099000, length = 0x001000
|
||||
FLASH_BANK1_SEC10 : origin = 0x09A000, length = 0x001000
|
||||
FLASH_BANK1_SEC11 : origin = 0x09B000, length = 0x001000
|
||||
FLASH_BANK1_SEC12 : origin = 0x09C000, length = 0x001000
|
||||
FLASH_BANK1_SEC13 : origin = 0x09D000, length = 0x001000
|
||||
FLASH_BANK1_SEC14 : origin = 0x09E000, length = 0x001000
|
||||
FLASH_BANK1_SEC15 : origin = 0x09F000, length = 0x001000
|
||||
|
||||
/* BANK 2 */
|
||||
FLASH_BANK2_SEC0 : origin = 0x0A0000, length = 0x001000
|
||||
FLASH_BANK2_SEC1 : origin = 0x0A1000, length = 0x001000
|
||||
FLASH_BANK2_SEC2 : origin = 0x0A2000, length = 0x001000
|
||||
FLASH_BANK2_SEC3 : origin = 0x0A3000, length = 0x001000
|
||||
FLASH_BANK2_SEC4 : origin = 0x0A4000, length = 0x001000
|
||||
FLASH_BANK2_SEC5 : origin = 0x0A5000, length = 0x001000
|
||||
FLASH_BANK2_SEC6 : origin = 0x0A6000, length = 0x001000
|
||||
FLASH_BANK2_SEC7 : origin = 0x0A7000, length = 0x001000
|
||||
FLASH_BANK2_SEC8 : origin = 0x0A8000, length = 0x001000
|
||||
FLASH_BANK2_SEC9 : origin = 0x0A9000, length = 0x001000
|
||||
FLASH_BANK2_SEC10 : origin = 0x0AA000, length = 0x001000
|
||||
FLASH_BANK2_SEC11 : origin = 0x0AB000, length = 0x001000
|
||||
FLASH_BANK2_SEC12 : origin = 0x0AC000, length = 0x001000
|
||||
FLASH_BANK2_SEC13 : origin = 0x0AD000, length = 0x001000
|
||||
FLASH_BANK2_SEC14 : origin = 0x0AE000, length = 0x001000
|
||||
FLASH_BANK2_SEC15 : origin = 0x0AF000, length = 0x000FF0
|
||||
|
||||
// FLASH_BANK0_SEC15_RSVD : origin = 0x0AFFF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN
|
||||
.TI.ramfunc : > RAMM0
|
||||
.text : >> RAMLS0 | RAMLS1 | RAMLS2 | RAMLS3 | RAMLS4
|
||||
.cinit : > RAMM0 | RAMM1
|
||||
.switch : > RAMM0
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMM1
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS5
|
||||
.init_array : > RAMM0
|
||||
.const : > RAMLS5 | RAMLS4
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS5
|
||||
.bss:cio : > RAMLS0
|
||||
#else
|
||||
.pinit : > RAMM0
|
||||
.ebss : > RAMLS5
|
||||
.econst : > RAMLS5
|
||||
.esysmem : > RAMLS5
|
||||
.cio : > RAMLS0
|
||||
#endif
|
||||
|
||||
ramgs0 : > RAMGS0
|
||||
ramgs1 : > RAMGS1
|
||||
|
||||
/* The following section definition are for SDFM examples */
|
||||
Filter1_RegsFile : > RAMLS6_7
|
||||
Filter2_RegsFile : > RAMLS6_7
|
||||
Filter3_RegsFile : > RAMLS6_7
|
||||
Filter4_RegsFile : > RAMLS6_7
|
||||
|
||||
/* Allocate IQ math areas: */
|
||||
IQmath : > RAMLS6_7
|
||||
IQmathTables : > RAMLS6_7
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
|
||||
MEMORY
|
||||
{
|
||||
PAGE 0 :
|
||||
/* BEGIN is used for the "boot to Flash" bootloader mode */
|
||||
|
||||
BEGIN : origin = 0x080000, length = 0x000002
|
||||
RAMM0 : origin = 0x0000F6, length = 0x00030A
|
||||
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
|
||||
/* Flash sectors */
|
||||
/* BANK 0 */
|
||||
FLASH_BANK0_SEC0 : origin = 0x080002, length = 0x000FFE /* on-chip Flash */
|
||||
FLASH_BANK0_SEC1 : origin = 0x081000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC2_5 : origin = 0x082000, length = 0x004000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC3 : origin = 0x083000, length = 0x001000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC4 : origin = 0x084000, length = 0x001000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC5 : origin = 0x085000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC6 : origin = 0x086000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC7_10 : origin = 0x087000, length = 0x004000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC8 : origin = 0x088000, length = 0x001000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC9 : origin = 0x089000, length = 0x001000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x002000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x001000 /* on-chip Flash */
|
||||
|
||||
/* BANK 1 */
|
||||
FLASH_BANK1_SEC0 : origin = 0x090000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC1 : origin = 0x091000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC2 : origin = 0x092000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC3 : origin = 0x093000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC4 : origin = 0x094000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC5 : origin = 0x095000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC6 : origin = 0x096000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC7 : origin = 0x097000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC8 : origin = 0x098000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC9 : origin = 0x099000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC10 : origin = 0x09A000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC11 : origin = 0x09B000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC12 : origin = 0x09C000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC13 : origin = 0x09D000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC14 : origin = 0x09E000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC15 : origin = 0x09F000, length = 0x000FF0 /* on-chip Flash */
|
||||
|
||||
// FLASH_BANK1_SEC15_RSVD : origin = 0x09FFF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
PAGE 1 :
|
||||
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x0000F1 /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM1 : origin = 0x000400, length = 0x0003F8 /* on-chip RAM block M1 */
|
||||
// RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
RAMLS5 : origin = 0x00A800, length = 0x001000
|
||||
// RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
|
||||
RAMGS0 : origin = 0x00C000, length = 0x002000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x002000
|
||||
RAMGS2 : origin = 0x010000, length = 0x002000
|
||||
RAMGS3 : origin = 0x012000, length = 0x001FF8
|
||||
// RAMGS3_RSVD : origin = 0x013FF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN, PAGE = 0, ALIGN(4)
|
||||
.text : >> FLASH_BANK0_SEC2_5, PAGE = 0, ALIGN(4)
|
||||
.cinit : > FLASH_BANK0_SEC1, PAGE = 0, ALIGN(4)
|
||||
.switch : > FLASH_BANK0_SEC1, PAGE = 0, ALIGN(4)
|
||||
.reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMM1, PAGE = 1
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.init_array : > FLASH_BANK0_SEC1, PAGE = 0, ALIGN(4)
|
||||
.bss : > RAMLS7, PAGE = 1
|
||||
.bss:output : > RAMLS3, PAGE = 0
|
||||
.bss:cio : > RAMLS0, PAGE = 0
|
||||
.data : > RAMGS1, PAGE = 1
|
||||
.sysmem : > RAMGS2, PAGE = 1
|
||||
/* Initalized sections go in Flash */
|
||||
.const : > FLASH_BANK0_SEC7_10, PAGE = 0, ALIGN(4)
|
||||
#else
|
||||
.pinit : > FLASH_BANK0_SEC1, PAGE = 0, ALIGN(4)
|
||||
.ebss : > RAMLS5, PAGE = 1
|
||||
.esysmem : > RAMGS2, PAGE = 1
|
||||
.cio : > RAMLS0, PAGE = 0
|
||||
.econst : > FLASH_BANK0_SEC14, PAGE = 0, ALIGN(4)
|
||||
#endif
|
||||
|
||||
ramgs0 : > RAMGS0, PAGE = 1
|
||||
ramgs1 : > RAMGS1, PAGE = 1
|
||||
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.TI.ramfunc : LOAD = FLASH_BANK0_SEC1,
|
||||
RUN = RAMLS0,
|
||||
LOAD_START(RamfuncsLoadStart),
|
||||
LOAD_SIZE(RamfuncsLoadSize),
|
||||
LOAD_END(RamfuncsLoadEnd),
|
||||
RUN_START(RamfuncsRunStart),
|
||||
RUN_SIZE(RamfuncsRunSize),
|
||||
RUN_END(RamfuncsRunEnd),
|
||||
PAGE = 0, ALIGN(4)
|
||||
#else
|
||||
.TI.ramfunc : LOAD = FLASH_BANK0_SEC1,
|
||||
RUN = RAMLS0,
|
||||
LOAD_START(_RamfuncsLoadStart),
|
||||
LOAD_SIZE(_RamfuncsLoadSize),
|
||||
LOAD_END(_RamfuncsLoadEnd),
|
||||
RUN_START(_RamfuncsRunStart),
|
||||
RUN_SIZE(_RamfuncsRunSize),
|
||||
RUN_END(_RamfuncsRunEnd),
|
||||
PAGE = 0, ALIGN(4)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
@@ -0,0 +1,153 @@
|
||||
|
||||
MEMORY
|
||||
{
|
||||
PAGE 0 :
|
||||
|
||||
RAMM0 : origin = 0x0000F5, length = 0x00030B
|
||||
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x001600
|
||||
//RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
|
||||
#ifdef __TI_COMPILER_VERSION__
|
||||
#if __TI_COMPILER_VERSION__ >= 20012000
|
||||
GROUP { /* GROUP memory ranges for crc/checksum of entire flash */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* BEGIN is used for the "boot to Flash" bootloader mode */
|
||||
|
||||
BEGIN : origin = 0x080000, length = 0x000002
|
||||
/* Flash sectors */
|
||||
/* BANK 0 */
|
||||
FLASH_BANK0 : origin = 0x080002, length = 0x00FFFE
|
||||
//FLASH_BANK0_SEC0 : origin = 0x080002, length = 0x000FFE /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC1 : origin = 0x081000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC2 : origin = 0x082000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC3 : origin = 0x083000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC4 : origin = 0x084000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC5 : origin = 0x085000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC6 : origin = 0x086000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC7 : origin = 0x087000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC8 : origin = 0x088000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC9 : origin = 0x089000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x001000 /* on-chip Flash */
|
||||
//FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x001000 /* on-chip Flash */
|
||||
|
||||
|
||||
/* BANK 1 */
|
||||
FLASH_BANK1_SEC0 : origin = 0x090000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC1 : origin = 0x091000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC2 : origin = 0x092000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC3 : origin = 0x093000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC4 : origin = 0x094000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC5 : origin = 0x095000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC6 : origin = 0x096000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC7 : origin = 0x097000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC8 : origin = 0x098000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC9 : origin = 0x099000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC10 : origin = 0x09A000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC11 : origin = 0x09B000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC12 : origin = 0x09C000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC13 : origin = 0x09D000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC14 : origin = 0x09E000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC15 : origin = 0x09F000, length = 0x000FF0 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC15_DO_NOT_USE : origin = 0x09FFF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
|
||||
#ifdef __TI_COMPILER_VERSION__
|
||||
#if __TI_COMPILER_VERSION__ >= 20012000
|
||||
} crc(_ccs_flash_checksum, algorithm=C28_CHECKSUM_16)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PAGE 1 :
|
||||
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x0000F3 /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
|
||||
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
|
||||
RAMGS0 : origin = 0x00C000, length = 0x002000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x002000
|
||||
RAMGS2 : origin = 0x010000, length = 0x002000
|
||||
RAMGS3 : origin = 0x012000, length = 0x002000
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN, PAGE = 0, ALIGN(4)
|
||||
.text : > FLASH_BANK0, PAGE = 0, ALIGN(4)
|
||||
.pinit : > RAMGS2, PAGE = 1
|
||||
.switch : > RAMGS2, PAGE = 1
|
||||
.cinit : > FLASH_BANK0, PAGE = 0, ALIGN(8)
|
||||
.reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMGS1, PAGE = 1
|
||||
.bss : >> RAMLS5 | RAMGS0, PAGE = 1
|
||||
.sysmem : > RAMGS3 , PAGE = 1
|
||||
.const : >> RAMLS5 | RAMLS6 | RAMGS0, PAGE = 1
|
||||
.data : >> RAMLS0 | RAMLS1 | RAMLS2 | RAMLS3, PAGE = 0
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.init_array : > FLASH_BANK0, PAGE = 0, ALIGN(4)
|
||||
.bss : > RAMLS5, PAGE = 1
|
||||
.bss:output : > RAMLS3, PAGE = 0
|
||||
.bss:cio : > RAMLS0, PAGE = 0
|
||||
.data : > RAMLS5, PAGE = 1
|
||||
.sysmem : > RAMLS6 | RAMLS7, PAGE = 1
|
||||
/* Initalized sections go in Flash */
|
||||
.const : > FLASH_BANK1_SEC4, PAGE = 0, ALIGN(4)
|
||||
#else
|
||||
.pinit : > FLASH_BANK0, PAGE = 0, ALIGN(4)
|
||||
.ebss : > RAMLS5, PAGE = 1
|
||||
.esysmem : > RAMLS5, PAGE = 1
|
||||
.cio : > RAMLS0, PAGE = 0
|
||||
.econst : > FLASH_BANK1, PAGE = 0, ALIGN(4)
|
||||
#endif
|
||||
|
||||
ramgs0 : > RAMGS0, PAGE = 1
|
||||
ramgs1 : > RAMGS1, PAGE = 1
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.TI.ramfunc : LOAD = FLASH_BANK0,
|
||||
RUN = RAMLS0,
|
||||
LOAD_START(RamfuncsLoadStart),
|
||||
LOAD_SIZE(RamfuncsLoadSize),
|
||||
LOAD_END(RamfuncsLoadEnd),
|
||||
RUN_START(RamfuncsRunStart),
|
||||
RUN_SIZE(RamfuncsRunSize),
|
||||
RUN_END(RamfuncsRunEnd),
|
||||
PAGE = 0, ALIGN(4)
|
||||
#else
|
||||
.TI.ramfunc : LOAD = FLASH_BANK0_SEC1,
|
||||
RUN = RAMLS0,
|
||||
LOAD_START(_RamfuncsLoadStart),
|
||||
LOAD_SIZE(_RamfuncsLoadSize),
|
||||
LOAD_END(_RamfuncsLoadEnd),
|
||||
RUN_START(_RamfuncsRunStart),
|
||||
RUN_SIZE(_RamfuncsRunSize),
|
||||
RUN_END(_RamfuncsRunEnd),
|
||||
PAGE = 0, ALIGN(4)
|
||||
#endif
|
||||
|
||||
/* crc/checksum section configured as COPY section to avoid including in executable */
|
||||
.TI.memcrc : type = COPY
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
@@ -0,0 +1,133 @@
|
||||
|
||||
MEMORY
|
||||
{
|
||||
PAGE 0 :
|
||||
/* BEGIN is used for the "boot to Flash" bootloader mode */
|
||||
|
||||
BEGIN : origin = 0x080000, length = 0x000002
|
||||
RAMM0 : origin = 0x0000F6, length = 0x00030A
|
||||
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
|
||||
/* Flash sectors */
|
||||
/* BANK 0 */
|
||||
FLASH_BANK0_SEC0 : origin = 0x080002, length = 0x000FFE /* on-chip Flash */
|
||||
FLASH_BANK0_SEC1 : origin = 0x081000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC2_5 : origin = 0x082000, length = 0x004000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC3 : origin = 0x083000, length = 0x001000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC4 : origin = 0x084000, length = 0x001000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC5 : origin = 0x085000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC6 : origin = 0x086000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC7_10 : origin = 0x087000, length = 0x004000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC8 : origin = 0x088000, length = 0x001000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC9 : origin = 0x089000, length = 0x001000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x002000 /* on-chip Flash */
|
||||
// FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x001000 /* on-chip Flash */
|
||||
|
||||
/* BANK 1 */
|
||||
FLASH_BANK1_SEC0 : origin = 0x090000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC1 : origin = 0x091000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC2 : origin = 0x092000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC3 : origin = 0x093000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC4 : origin = 0x094000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC5 : origin = 0x095000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC6 : origin = 0x096000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC7 : origin = 0x097000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC8 : origin = 0x098000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC9 : origin = 0x099000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC10 : origin = 0x09A000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC11 : origin = 0x09B000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC12 : origin = 0x09C000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC13 : origin = 0x09D000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC14 : origin = 0x09E000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC15 : origin = 0x09F000, length = 0x000FF0 /* on-chip Flash */
|
||||
|
||||
// FLASH_BANK1_SEC15_RSVD : origin = 0x09FFF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
PAGE 1 :
|
||||
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x0000F1 /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM1 : origin = 0x000400, length = 0x0003F8 /* on-chip RAM block M1 */
|
||||
// RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
|
||||
RAMGS0 : origin = 0x00C000, length = 0x002000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x002000
|
||||
RAMGS2 : origin = 0x010000, length = 0x002000
|
||||
RAMGS3 : origin = 0x012000, length = 0x001FF8
|
||||
// RAMGS3_RSVD : origin = 0x013FF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN, PAGE = 0, ALIGN(4)
|
||||
.text : >> FLASH_BANK0_SEC2_5, PAGE = 0, ALIGN(4)
|
||||
.cinit : > FLASH_BANK0_SEC1, PAGE = 0, ALIGN(4)
|
||||
.switch : > FLASH_BANK0_SEC1, PAGE = 0, ALIGN(4)
|
||||
.reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMM1, PAGE = 1
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.init_array : > FLASH_BANK0_SEC1, PAGE = 0, ALIGN(4)
|
||||
.bss : > RAMLS5, PAGE = 1
|
||||
.bss:output : > RAMLS3, PAGE = 0
|
||||
.bss:cio : > RAMLS0, PAGE = 0
|
||||
.data : > RAMLS5, PAGE = 1
|
||||
.sysmem : > RAMLS5, PAGE = 1
|
||||
/* Initalized sections go in Flash */
|
||||
.const : > FLASH_BANK0_SEC7_10, PAGE = 0, ALIGN(4)
|
||||
#else
|
||||
.pinit : > FLASH_BANK0_SEC1, PAGE = 0, ALIGN(4)
|
||||
.ebss : > RAMLS5, PAGE = 1
|
||||
.esysmem : > RAMLS5, PAGE = 1
|
||||
.cio : > RAMLS0, PAGE = 0
|
||||
.econst : > FLASH_BANK0_SEC14, PAGE = 0, ALIGN(4)
|
||||
#endif
|
||||
|
||||
ramgs0 : > RAMGS0, PAGE = 1
|
||||
ramgs1 : > RAMGS1, PAGE = 1
|
||||
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.TI.ramfunc : LOAD = FLASH_BANK0_SEC1,
|
||||
RUN = RAMLS0,
|
||||
LOAD_START(RamfuncsLoadStart),
|
||||
LOAD_SIZE(RamfuncsLoadSize),
|
||||
LOAD_END(RamfuncsLoadEnd),
|
||||
RUN_START(RamfuncsRunStart),
|
||||
RUN_SIZE(RamfuncsRunSize),
|
||||
RUN_END(RamfuncsRunEnd),
|
||||
PAGE = 0, ALIGN(4)
|
||||
#else
|
||||
.TI.ramfunc : LOAD = FLASH_BANK0_SEC1,
|
||||
RUN = RAMLS0,
|
||||
LOAD_START(_RamfuncsLoadStart),
|
||||
LOAD_SIZE(_RamfuncsLoadSize),
|
||||
LOAD_END(_RamfuncsLoadEnd),
|
||||
RUN_START(_RamfuncsRunStart),
|
||||
RUN_SIZE(_RamfuncsRunSize),
|
||||
RUN_END(_RamfuncsRunEnd),
|
||||
PAGE = 0, ALIGN(4)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
@@ -0,0 +1,107 @@
|
||||
|
||||
MEMORY
|
||||
{
|
||||
PAGE 0 :
|
||||
/* BEGIN is used for the "boot to SARAM" bootloader mode */
|
||||
|
||||
BEGIN : origin = 0x000000, length = 0x000002
|
||||
RAMM0 : origin = 0x0000F6, length = 0x00030A
|
||||
|
||||
RAMLS0 : origin = 0x008000, length = 0x002800
|
||||
// RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
// RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
// RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
// RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
|
||||
/* Flash sectors: you can use FLASH for program memory when the RAM is filled up*/
|
||||
/* BANK 0 */
|
||||
FLASH_BANK0_SEC0 : origin = 0x080000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC1 : origin = 0x081000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC2 : origin = 0x082000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC3 : origin = 0x083000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC4 : origin = 0x084000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC5 : origin = 0x085000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC6 : origin = 0x086000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC7 : origin = 0x087000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC8 : origin = 0x088000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC9 : origin = 0x089000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC10 : origin = 0x08A000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC11 : origin = 0x08B000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC12 : origin = 0x08C000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC13 : origin = 0x08D000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC14 : origin = 0x08E000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK0_SEC15 : origin = 0x08F000, length = 0x001000 /* on-chip Flash */
|
||||
|
||||
/* BANK 1 */
|
||||
FLASH_BANK1_SEC0 : origin = 0x090000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC1 : origin = 0x091000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC2 : origin = 0x092000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC3 : origin = 0x093000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC4 : origin = 0x094000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC5 : origin = 0x095000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC6 : origin = 0x096000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC7 : origin = 0x097000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC8 : origin = 0x098000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC9 : origin = 0x099000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC10 : origin = 0x09A000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC11 : origin = 0x09B000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC12 : origin = 0x09C000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC13 : origin = 0x09D000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC14 : origin = 0x09E000, length = 0x001000 /* on-chip Flash */
|
||||
FLASH_BANK1_SEC15 : origin = 0x09F000, length = 0x001000 /* on-chip Flash */
|
||||
|
||||
PAGE 1 :
|
||||
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x0000F1 /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM1 : origin = 0x000400, length = 0x0003F8 /* on-chip RAM block M1 */
|
||||
// RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
|
||||
RAMGS0 : origin = 0x00C000, length = 0x002000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x004000
|
||||
// RAMGS2 : origin = 0x010000, length = 0x002000
|
||||
RAMGS3 : origin = 0x012000, length = 0x001FF8
|
||||
// RAMGS3_RSVD : origin = 0x013FF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
}
|
||||
|
||||
/*You can arrange the .text, .cinit, .const, .pinit, .switch and .econst to FLASH when RAM is filled up.*/
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN, PAGE = 0
|
||||
.TI.ramfunc : > RAMM0, PAGE = 0
|
||||
.text : >> RAMGS1, PAGE = 1
|
||||
.cinit : > RAMM0, PAGE = 0
|
||||
.switch : > RAMM0, PAGE = 0
|
||||
.reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMM1, PAGE = 1
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.bss : > RAMLS5, PAGE = 1
|
||||
.bss:output : > RAMLS5, PAGE = 1
|
||||
.init_array : > RAMM0, PAGE = 0
|
||||
.const : > RAMLS0, PAGE = 0
|
||||
.data : > RAMLS5, PAGE = 1
|
||||
.sysmem : > RAMGS3, PAGE = 1
|
||||
.bss:cio : > RAMLS0, PAGE = 0
|
||||
#else
|
||||
.pinit : > RAMM0, PAGE = 0
|
||||
.ebss : > RAMLS5, PAGE = 1
|
||||
.econst : > RAMLS5, PAGE = 1
|
||||
.esysmem : > RAMLS5, PAGE = 1
|
||||
.cio : > RAMLS0, PAGE = 0
|
||||
#endif
|
||||
|
||||
ramgs0 : > RAMGS0, PAGE = 1
|
||||
ramgs1 : > RAMGS1, PAGE = 1
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
@@ -0,0 +1,109 @@
|
||||
MEMORY
|
||||
{
|
||||
/* BEGIN is used for the "boot to SARAM" bootloader mode */
|
||||
BEGIN : origin = 0x000000, length = 0x000002
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x0001AF /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM0 : origin = 0x0001B1, length = 0x00024F
|
||||
RAMM1 : origin = 0x000400, length = 0x0003F8 /* on-chip RAM block M1 */
|
||||
// RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
RAMD0 : origin = 0x00C000, length = 0x000800
|
||||
RAMD1 : origin = 0x00C800, length = 0x000800
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RAMLS5 : origin = 0x00A800, length = 0x001800
|
||||
RAMGS0 : origin = 0x00D000, length = 0x001000
|
||||
RAMGS1 : origin = 0x00E000, length = 0x001000
|
||||
RAMGS2 : origin = 0x00F000, length = 0x001000
|
||||
RAMGS3 : origin = 0x010000, length = 0x001000
|
||||
RAMGS4 : origin = 0x011000, length = 0x001000
|
||||
RAMGS5 : origin = 0x012000, length = 0x001000
|
||||
RAMGS6 : origin = 0x013000, length = 0x001000
|
||||
RAMGS7 : origin = 0x014000, length = 0x001000
|
||||
RAMGS8 : origin = 0x015000, length = 0x001000
|
||||
RAMGS9 : origin = 0x016000, length = 0x001000
|
||||
RAMGS10 : origin = 0x017000, length = 0x001000
|
||||
RAMGS11 : origin = 0x018000, length = 0x001000
|
||||
RAMGS12 : origin = 0x019000, length = 0x001000
|
||||
RAMGS13 : origin = 0x01A000, length = 0x001000
|
||||
RAMGS14 : origin = 0x01B000, length = 0x001000
|
||||
RAMGS15 : origin = 0x01C000, length = 0x000FF8
|
||||
// RAMGS15_RSVD : origin = 0x01CFF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
/* Flash sectors */
|
||||
FLASH0 : origin = 0x080000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH1 : origin = 0x082000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH2 : origin = 0x084000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH3 : origin = 0x086000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH4 : origin = 0x088000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH5 : origin = 0x090000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH6 : origin = 0x098000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH7 : origin = 0x0A0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH8 : origin = 0x0A8000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH9 : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
|
||||
FLASH10 : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH11 : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH12 : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */
|
||||
FLASH13 : origin = 0x0BE000, length = 0x002000 /* on-chip Flash */
|
||||
CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000800
|
||||
CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000800
|
||||
|
||||
CPUTOCMRAM : origin = 0x039000, length = 0x000800
|
||||
CMTOCPURAM : origin = 0x038000, length = 0x000800
|
||||
|
||||
CANA_MSG_RAM : origin = 0x049000, length = 0x000800
|
||||
CANB_MSG_RAM : origin = 0x04B000, length = 0x000800
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN
|
||||
.text : >> RAMD0 | RAMD1 | RAMLS0 | RAMLS1 | RAMLS2 | RAMLS3
|
||||
.cinit : > RAMM0
|
||||
.switch : > RAMM0
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMM1
|
||||
#if defined(__TI_EABI__)
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS3
|
||||
.init_array : > RAMM0
|
||||
.const : > RAMLS5
|
||||
.data : > RAMLS5
|
||||
.sysmem : > RAMLS4
|
||||
#else
|
||||
.pinit : > RAMM0
|
||||
.ebss : >> RAMLS5 | RAMLS6
|
||||
.econst : > RAMLS5
|
||||
.esysmem : > RAMLS5
|
||||
#endif
|
||||
|
||||
ramgs0 : > RAMGS0, type=NOINIT
|
||||
ramgs1 : > RAMGS1, type=NOINIT
|
||||
|
||||
MSGRAM_CPU1_TO_CPU2 > CPU1TOCPU2RAM, type=NOINIT
|
||||
MSGRAM_CPU2_TO_CPU1 > CPU2TOCPU1RAM, type=NOINIT
|
||||
MSGRAM_CPU_TO_CM > CPUTOCMRAM, type=NOINIT
|
||||
MSGRAM_CM_TO_CPU > CMTOCPURAM, type=NOINIT
|
||||
|
||||
/* The following section definition are for SDFM examples */
|
||||
Filter_RegsFile : > RAMGS0
|
||||
Filter1_RegsFile : > RAMGS1, fill=0x1111
|
||||
Filter2_RegsFile : > RAMGS2, fill=0x2222
|
||||
Filter3_RegsFile : > RAMGS3, fill=0x3333
|
||||
Filter4_RegsFile : > RAMGS4, fill=0x4444
|
||||
Difference_RegsFile : >RAMGS5, fill=0x3333
|
||||
|
||||
.TI.ramfunc : {} > RAMM0
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
@@ -0,0 +1,131 @@
|
||||
MEMORY
|
||||
{
|
||||
|
||||
BOOT_RSVD : origin = 0x000002, length = 0x0001AF /* Part of M0, BOOT rom will use this for stack */
|
||||
RAMM0 : origin = 0x0001B1, length = 0x00024F
|
||||
RAMM1 : origin = 0x00000400, length = 0x000003F8 /* on-chip RAM block M1 */
|
||||
// RAMM1_RSVD : origin = 0x000007F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
|
||||
|
||||
RAMD0 : origin = 0x00C000, length = 0x002000
|
||||
RAMD1 : origin = 0x00E000, length = 0x002000
|
||||
RAMD2 : origin = 0x01A000, length = 0x002000 // Can be mapped to either CPU1 or CPU2. When configured to CPU2, use the address 0x8000. User should comment/uncomment based on core selection
|
||||
RAMD3 : origin = 0x01C000, length = 0x002000 // Can be mapped to either CPU1 or CPU2. When configured to CPU2, use the address 0xA000. User should comment/uncomment based on core selection
|
||||
RAMD4 : origin = 0x01E000, length = 0x002000 // Can be mapped to either CPU1 or CPU2. When configured to CPU2, use the address 0xC000. User should comment/uncomment based on core selection
|
||||
RAMD5 : origin = 0x020000, length = 0x002000 // Can be mapped to either CPU1 or CPU2. When configured to CPU2, use the address 0xE000. User should comment/uncomment based on core selection
|
||||
|
||||
RAMLS0 : origin = 0x008000, length = 0x000800
|
||||
RAMLS1 : origin = 0x008800, length = 0x000800
|
||||
RAMLS2 : origin = 0x009000, length = 0x000800
|
||||
RAMLS3 : origin = 0x009800, length = 0x000800
|
||||
RAMLS4 : origin = 0x00A000, length = 0x000800
|
||||
RAMLS5 : origin = 0x00A800, length = 0x000800
|
||||
RAMLS6 : origin = 0x00B000, length = 0x000800
|
||||
RAMLS7 : origin = 0x00B800, length = 0x000800
|
||||
RAMLS8 : origin = 0x022000, length = 0x002000 // When configured as CLA program use the address 0x4000
|
||||
RAMLS9 : origin = 0x024000, length = 0x002000 // When configured as CLA program use the address 0x6000
|
||||
|
||||
// RAMLS8_CLA : origin = 0x004000, length = 0x002000 // Use only if configured as CLA program memory
|
||||
// RAMLS9_CLA : origin = 0x006000, length = 0x002000 // Use only if configured as CLA program memory
|
||||
|
||||
RAMGS0 : origin = 0x010000, length = 0x00A000
|
||||
//RAMGS1 : origin = 0x012000, length = 0x002000
|
||||
//RAMGS2 : origin = 0x014000, length = 0x002000
|
||||
//RAMGS3 : origin = 0x016000, length = 0x004000
|
||||
//RAMGS4 : origin = 0x018000, length = 0x002000
|
||||
|
||||
CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000400
|
||||
CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000400
|
||||
|
||||
CLATOCPURAM : origin = 0x001480, length = 0x000080
|
||||
CPUTOCPURAM : origin = 0x001500, length = 0x000080
|
||||
CLATODMARAM : origin = 0x001680, length = 0x000080
|
||||
DMATOCLARAM : origin = 0x001700, length = 0x000080
|
||||
ETHERCAT_RAM : origin = 0x030800, length = 0x002000
|
||||
USB_RAM : origin = 0x041000, length = 0x000800
|
||||
|
||||
CANA_MSG_RAM : origin = 0x049000, length = 0x000800
|
||||
CANB_MSG_RAM : origin = 0x04B000, length = 0x000800
|
||||
RESET : origin = 0x3FFFC0, length = 0x000002
|
||||
|
||||
|
||||
#ifdef __TI_COMPILER_VERSION__
|
||||
#if __TI_COMPILER_VERSION__ >= 20012000
|
||||
GROUP { /* GROUP memory ranges for crc/checksum of entire flash */
|
||||
#endif
|
||||
#endif
|
||||
/* BEGIN is used for the "boot to Flash" bootloader mode */
|
||||
|
||||
BEGIN : origin = 0x080000, length = 0x000002 // Update the codestart location as needed
|
||||
/* Flash Banks (128 sectors each) */
|
||||
FLASH_BANK0 : origin = 0x080002, length = 0x1FFFE // Can be mapped to either CPU1 or CPU2. User should comment/uncomment based on core selection
|
||||
FLASH_BANK1 : origin = 0x0A0000, length = 0x20000 // Can be mapped to either CPU1 or CPU2. User should comment/uncomment based on core selection
|
||||
FLASH_BANK2 : origin = 0x0C0000, length = 0x20000 // Can be mapped to either CPU1 or CPU2. User should comment/uncomment based on core selection
|
||||
FLASH_BANK3 : origin = 0x0E0000, length = 0x20000 // Can be mapped to either CPU1 or CPU2. User should comment/uncomment based on core selection
|
||||
FLASH_BANK4 : origin = 0x100000, length = 0x20000 // Can be mapped to either CPU1 or CPU2. User should comment/uncomment based on core selection
|
||||
|
||||
#ifdef __TI_COMPILER_VERSION__
|
||||
#if __TI_COMPILER_VERSION__ >= 20012000
|
||||
} crc(_ccs_flash_checksum, algorithm=C28_CHECKSUM_16)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
codestart : > BEGIN
|
||||
.text : >> FLASH_BANK0 | FLASH_BANK1, ALIGN(8)
|
||||
.cinit : > FLASH_BANK0, ALIGN(8)
|
||||
.switch : > FLASH_BANK0, ALIGN(8)
|
||||
.reset : > RESET, TYPE = DSECT /* not used, */
|
||||
|
||||
.stack : > RAMD0
|
||||
#if defined(__TI_EABI__)
|
||||
.bss : > RAMLS5
|
||||
.bss:output : > RAMLS3
|
||||
.init_array : > FLASH_BANK0, ALIGN(8)
|
||||
.const : > FLASH_BANK0, ALIGN(8)
|
||||
.data : > RAMGS0
|
||||
.sysmem : > RAMD1, ALIGN(8)
|
||||
#else
|
||||
.pinit : > FLASH_BANK0, ALIGN(8)
|
||||
.ebss : >> RAMLS5 | RAMLS6
|
||||
.econst : > FLASH_BANK0, ALIGN(8)
|
||||
.esysmem : > RAMGS0 , ALIGN(8)
|
||||
#endif
|
||||
|
||||
ramgs0 : > RAMGS0, type=NOINIT
|
||||
//ramgs1 : > RAMGS1, type=NOINIT
|
||||
|
||||
#if defined(__TI_EABI__)
|
||||
.TI.ramfunc : {} LOAD = FLASH_BANK0,
|
||||
RUN = RAMLS0,
|
||||
LOAD_START(RamfuncsLoadStart),
|
||||
LOAD_SIZE(RamfuncsLoadSize),
|
||||
LOAD_END(RamfuncsLoadEnd),
|
||||
RUN_START(RamfuncsRunStart),
|
||||
RUN_SIZE(RamfuncsRunSize),
|
||||
RUN_END(RamfuncsRunEnd),
|
||||
ALIGN(8)
|
||||
#else
|
||||
.TI.ramfunc : {} LOAD = FLASH_BANK0,
|
||||
RUN = RAMLS0,
|
||||
LOAD_START(_RamfuncsLoadStart),
|
||||
LOAD_SIZE(_RamfuncsLoadSize),
|
||||
LOAD_END(_RamfuncsLoadEnd),
|
||||
RUN_START(_RamfuncsRunStart),
|
||||
RUN_SIZE(_RamfuncsRunSize),
|
||||
RUN_END(_RamfuncsRunEnd),
|
||||
ALIGN(8)
|
||||
#endif
|
||||
/* crc/checksum section configured as COPY section to avoid including in executable */
|
||||
.TI.memcrc : type = COPY
|
||||
}
|
||||
|
||||
/*
|
||||
//===========================================================================
|
||||
// End of file.
|
||||
//===========================================================================
|
||||
*/
|
||||
@@ -0,0 +1,259 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: aes_ex11_cbc_packed.c
|
||||
//
|
||||
// TITLE: AES CBC
|
||||
//
|
||||
//! \addtogroup library_example_c28x_list
|
||||
//! <h1>AES CBC Example</h1>
|
||||
//!
|
||||
//! This example encrypts block cipher-text using AES in CBC mode with 16-bit
|
||||
//! packed input plaintext and key.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b errCountGlobal - Error Counter. It should be zero.
|
||||
//! - \b testStatusGlobal - Test status. It should be equal to PASS.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <aes_cbc.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TEST_PASS 0xABCDABCD
|
||||
#define TEST_FAIL 0xDEADDEAD
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Global error counter & status
|
||||
//
|
||||
uint16_t errCountGlobal = 0;
|
||||
uint32_t testStatusGlobal;
|
||||
|
||||
//
|
||||
// Structure for AES CBC tests
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
uint16_t keyArray[32];
|
||||
uint16_t initVector[16];
|
||||
uint16_t dataLength;
|
||||
uint16_t plainText[64];
|
||||
uint16_t cipherText[64];
|
||||
} testVectorCBC;
|
||||
|
||||
|
||||
//
|
||||
// Test Cases
|
||||
//
|
||||
testVectorCBC testVectorCBCArray[] =
|
||||
{
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_ENCRYPT,
|
||||
|
||||
.keyArray = {0x2b7e, 0x1516, 0x28ae, 0xd2a6,
|
||||
0xabf7, 0x1588, 0x09cf, 0x4f3c},
|
||||
|
||||
.initVector = {0x0001, 0x0203, 0x0405, 0x0607,
|
||||
0x0809, 0x0A0B, 0x0C0D, 0x0E0F},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x6bc1, 0xbee2, 0x2e40, 0x9f96,
|
||||
0xe93d, 0x7e11, 0x7393, 0x172a,
|
||||
0xae2d, 0x8a57, 0x1e03, 0xac9c,
|
||||
0x9eb7, 0x6fac, 0x45af, 0x8e51,
|
||||
0x30c8, 0x1c46, 0xa35c, 0xe411,
|
||||
0xe5fb, 0xc119, 0x1a0a, 0x52ef,
|
||||
0xf69f, 0x2445, 0xdf4f, 0x9b17,
|
||||
0xad2b, 0x417b, 0xe66c, 0x3710},
|
||||
|
||||
.cipherText = {0x7649, 0xabac, 0x8119, 0xb246,
|
||||
0xcee9, 0x8e9b, 0x12e9, 0x197d,
|
||||
0x5086, 0xcb9b, 0x5072, 0x19ee,
|
||||
0x95db, 0x113a, 0x9176, 0x78b2,
|
||||
0x73be, 0xd6b8, 0xe3c1, 0x743b,
|
||||
0x7116, 0xe69e, 0x2222, 0x9516,
|
||||
0x3ff1, 0xcaa1, 0x681f, 0xac09,
|
||||
0x120e, 0xca30, 0x7586, 0xe1a7}
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case #2
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_DECRYPT,
|
||||
|
||||
.keyArray = {0x2b7e, 0x1516, 0x28ae, 0xd2a6,
|
||||
0xabf7, 0x1588, 0x09cf, 0x4f3c},
|
||||
|
||||
.initVector = {0x0001, 0x0203, 0x0405, 0x0607,
|
||||
0x0809, 0x0A0B, 0x0C0D, 0x0E0F},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x7649, 0xabac, 0x8119, 0xb246,
|
||||
0xcee9, 0x8e9b, 0x12e9, 0x197d,
|
||||
0x5086, 0xcb9b, 0x5072, 0x19ee,
|
||||
0x95db, 0x113a, 0x9176, 0x78b2,
|
||||
0x73be, 0xd6b8, 0xe3c1, 0x743b,
|
||||
0x7116, 0xe69e, 0x2222, 0x9516,
|
||||
0x3ff1, 0xcaa1, 0x681f, 0xac09,
|
||||
0x120e, 0xca30, 0x7586, 0xe1a7},
|
||||
|
||||
.cipherText = {0x6bc1, 0xbee2, 0x2e40, 0x9f96,
|
||||
0xe93d, 0x7e11, 0x7393, 0x172a,
|
||||
0xae2d, 0x8a57, 0x1e03, 0xac9c,
|
||||
0x9eb7, 0x6fac, 0x45af, 0x8e51,
|
||||
0x30c8, 0x1c46, 0xa35c, 0xe411,
|
||||
0xe5fb, 0xc119, 0x1a0a, 0x52ef,
|
||||
0xf69f, 0x2445, 0xdf4f, 0x9b17,
|
||||
0xad2b, 0x417b, 0xe66c, 0x3710}
|
||||
}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errCountLocal, cnt;
|
||||
uint16_t *keyArray, *initVector, dataLength;
|
||||
uint16_t *expCipherTextArray, *plainTextArray;
|
||||
uint16_t vectorCnt;
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
|
||||
//
|
||||
// Loop through all the given vectors.
|
||||
//
|
||||
for(vectorCnt = 0;
|
||||
(vectorCnt < (sizeof(testVectorCBCArray) /
|
||||
sizeof(testVectorCBCArray[0]))); vectorCnt++)
|
||||
{
|
||||
//
|
||||
// Get the current vector's data members.
|
||||
//
|
||||
keySize = testVectorCBCArray[vectorCnt].keySize;
|
||||
opMode = testVectorCBCArray[vectorCnt].opMode;
|
||||
keyArray = testVectorCBCArray[vectorCnt].keyArray;
|
||||
initVector = testVectorCBCArray[vectorCnt].initVector;
|
||||
dataLength = testVectorCBCArray[vectorCnt].dataLength;
|
||||
plainTextArray = testVectorCBCArray[vectorCnt].plainText;
|
||||
expCipherTextArray = testVectorCBCArray[vectorCnt].cipherText;
|
||||
|
||||
//
|
||||
// Perform AES-CBC
|
||||
//
|
||||
AES_performCBCFast(plainTextArray, dataLength, keyArray, keySize, opMode,
|
||||
initVector);
|
||||
|
||||
//
|
||||
// Check the results
|
||||
//
|
||||
for(cnt = 0; cnt < (dataLength * 8U); cnt++)
|
||||
{
|
||||
if(plainTextArray[cnt] != expCipherTextArray[cnt])
|
||||
{
|
||||
errCountLocal++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update the global error counter.
|
||||
//
|
||||
if(errCountLocal > 0)
|
||||
{
|
||||
errCountGlobal++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the local error counter.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Update test status variable
|
||||
//
|
||||
if(errCountGlobal == 0)
|
||||
{
|
||||
testStatusGlobal = TEST_PASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
testStatusGlobal = TEST_FAIL;
|
||||
}
|
||||
|
||||
//
|
||||
// Infinite Loop to keep the core running
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,249 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: aes_ex1_ecb.c
|
||||
//
|
||||
// TITLE: AES ECB
|
||||
//
|
||||
//! \addtogroup library_example_c28x_list
|
||||
//! <h1>AES ECB Example</h1>
|
||||
//!
|
||||
//! This example encrypts block cipher-text using AES in ECB mode.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b errCountGlobal - Error Counter. It should be zero.
|
||||
//! - \b testStatusGlobal - Test status. It should be equal to PASS.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <aes_ecb.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TEST_PASS 0xABCDABCD
|
||||
#define TEST_FAIL 0xDEADDEAD
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Global error counter & status
|
||||
//
|
||||
uint16_t errCountGlobal = 0;
|
||||
uint32_t testStatusGlobal;
|
||||
|
||||
//
|
||||
// Structure for AES ECB tests
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
uint16_t keyArray[32];
|
||||
uint16_t dataLength;
|
||||
uint16_t plainText[64];
|
||||
uint16_t cipherText[64];
|
||||
} testVectorECB;
|
||||
|
||||
|
||||
//
|
||||
// Test Cases
|
||||
//
|
||||
testVectorECB testVectorECBArray[] =
|
||||
{
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_ENCRYPT,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
|
||||
0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A,
|
||||
0xAE, 0x2D, 0x8A, 0x57, 0x1E, 0x03, 0xAC, 0x9C,
|
||||
0x9E, 0xB7, 0x6F, 0xAC, 0x45, 0xAF, 0x8E, 0x51,
|
||||
0x30, 0xC8, 0x1C, 0x46, 0xA3, 0x5C, 0xE4, 0x11,
|
||||
0xE5, 0xFB, 0xC1, 0x19, 0x1A, 0x0A, 0x52, 0xEF,
|
||||
0xF6, 0x9F, 0x24, 0x45, 0xDF, 0x4F, 0x9B, 0x17,
|
||||
0xAD, 0x2B, 0x41, 0x7B, 0xE6, 0x6C, 0x37, 0x10},
|
||||
|
||||
.cipherText = {0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
|
||||
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
|
||||
0xf5, 0xd3, 0xd5, 0x85, 0x03, 0xb9, 0x69, 0x9d,
|
||||
0xe7, 0x85, 0x89, 0x5a, 0x96, 0xfd, 0xba, 0xaf,
|
||||
0x43, 0xb1, 0xcd, 0x7f, 0x59, 0x8e, 0xce, 0x23,
|
||||
0x88, 0x1b, 0x00, 0xe3, 0xed, 0x03, 0x06, 0x88,
|
||||
0x7b, 0x0c, 0x78, 0x5e, 0x27, 0xe8, 0xad, 0x3f,
|
||||
0x82, 0x23, 0x20, 0x71, 0x04, 0x72, 0x5d, 0xd4}
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case #2
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_DECRYPT,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
|
||||
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
|
||||
0xf5, 0xd3, 0xd5, 0x85, 0x03, 0xb9, 0x69, 0x9d,
|
||||
0xe7, 0x85, 0x89, 0x5a, 0x96, 0xfd, 0xba, 0xaf,
|
||||
0x43, 0xb1, 0xcd, 0x7f, 0x59, 0x8e, 0xce, 0x23,
|
||||
0x88, 0x1b, 0x00, 0xe3, 0xed, 0x03, 0x06, 0x88,
|
||||
0x7b, 0x0c, 0x78, 0x5e, 0x27, 0xe8, 0xad, 0x3f,
|
||||
0x82, 0x23, 0x20, 0x71, 0x04, 0x72, 0x5d, 0xd4},
|
||||
|
||||
.cipherText = {0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
|
||||
0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A,
|
||||
0xAE, 0x2D, 0x8A, 0x57, 0x1E, 0x03, 0xAC, 0x9C,
|
||||
0x9E, 0xB7, 0x6F, 0xAC, 0x45, 0xAF, 0x8E, 0x51,
|
||||
0x30, 0xC8, 0x1C, 0x46, 0xA3, 0x5C, 0xE4, 0x11,
|
||||
0xE5, 0xFB, 0xC1, 0x19, 0x1A, 0x0A, 0x52, 0xEF,
|
||||
0xF6, 0x9F, 0x24, 0x45, 0xDF, 0x4F, 0x9B, 0x17,
|
||||
0xAD, 0x2B, 0x41, 0x7B, 0xE6, 0x6C, 0x37, 0x10}
|
||||
}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errCountLocal, cnt;
|
||||
uint16_t *keyArray, dataLength;
|
||||
uint16_t *expCipherTextArray, *plainTextArray;
|
||||
uint16_t vectorCnt;
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
|
||||
//
|
||||
// Loop through all the given vectors.
|
||||
//
|
||||
for(vectorCnt = 0;
|
||||
(vectorCnt < (sizeof(testVectorECBArray) /
|
||||
sizeof(testVectorECBArray[0]))); vectorCnt++)
|
||||
{
|
||||
//
|
||||
// Get the current vector's data members.
|
||||
//
|
||||
keySize = testVectorECBArray[vectorCnt].keySize;
|
||||
opMode = testVectorECBArray[vectorCnt].opMode;
|
||||
keyArray = testVectorECBArray[vectorCnt].keyArray;
|
||||
dataLength = testVectorECBArray[vectorCnt].dataLength;
|
||||
plainTextArray = testVectorECBArray[vectorCnt].plainText;
|
||||
expCipherTextArray = testVectorECBArray[vectorCnt].cipherText;
|
||||
|
||||
//
|
||||
// Perform AES-ECB
|
||||
//
|
||||
AES_performECB(plainTextArray, dataLength, keyArray, keySize, opMode);
|
||||
|
||||
//
|
||||
// Check the results
|
||||
//
|
||||
for(cnt = 0; cnt < (dataLength * 16U); cnt++)
|
||||
{
|
||||
if(plainTextArray[cnt] != expCipherTextArray[cnt])
|
||||
{
|
||||
errCountLocal++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update the global error counter.
|
||||
//
|
||||
if(errCountLocal > 0)
|
||||
{
|
||||
errCountGlobal++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the local error counter.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Update test status variable
|
||||
//
|
||||
if(errCountGlobal == 0)
|
||||
{
|
||||
testStatusGlobal = TEST_PASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
testStatusGlobal = TEST_FAIL;
|
||||
}
|
||||
|
||||
//
|
||||
// Infinite Loop to keep the core running
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,258 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: aes_ex2_cbc.c
|
||||
//
|
||||
// TITLE: AES CBC
|
||||
//
|
||||
//! \addtogroup library_example_c28x_list
|
||||
//! <h1>AES CBC Example</h1>
|
||||
//!
|
||||
//! This example encrypts block cipher-text using AES in CBC mode.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b errCountGlobal - Error Counter. It should be zero.
|
||||
//! - \b testStatusGlobal - Test status. It should be equal to PASS.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <aes_cbc.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TEST_PASS 0xABCDABCD
|
||||
#define TEST_FAIL 0xDEADDEAD
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Global error counter & status
|
||||
//
|
||||
uint16_t errCountGlobal = 0;
|
||||
uint32_t testStatusGlobal;
|
||||
|
||||
//
|
||||
// Structure for AES CBC tests
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
uint16_t keyArray[32];
|
||||
uint16_t initVector[16];
|
||||
uint16_t dataLength;
|
||||
uint16_t plainText[64];
|
||||
uint16_t cipherText[64];
|
||||
} testVectorCBC;
|
||||
|
||||
|
||||
//
|
||||
// Test Cases
|
||||
//
|
||||
testVectorCBC testVectorCBCArray[] =
|
||||
{
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_ENCRYPT,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.initVector = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
||||
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
||||
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
||||
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
||||
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
||||
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
|
||||
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
|
||||
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10},
|
||||
|
||||
.cipherText = {0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46,
|
||||
0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d,
|
||||
0x50, 0x86, 0xcb, 0x9b, 0x50, 0x72, 0x19, 0xee,
|
||||
0x95, 0xdb, 0x11, 0x3a, 0x91, 0x76, 0x78, 0xb2,
|
||||
0x73, 0xbe, 0xd6, 0xb8, 0xe3, 0xc1, 0x74, 0x3b,
|
||||
0x71, 0x16, 0xe6, 0x9e, 0x22, 0x22, 0x95, 0x16,
|
||||
0x3f, 0xf1, 0xca, 0xa1, 0x68, 0x1f, 0xac, 0x09,
|
||||
0x12, 0x0e, 0xca, 0x30, 0x75, 0x86, 0xe1, 0xa7}
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case #2
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_DECRYPT,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.initVector = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46,
|
||||
0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d,
|
||||
0x50, 0x86, 0xcb, 0x9b, 0x50, 0x72, 0x19, 0xee,
|
||||
0x95, 0xdb, 0x11, 0x3a, 0x91, 0x76, 0x78, 0xb2,
|
||||
0x73, 0xbe, 0xd6, 0xb8, 0xe3, 0xc1, 0x74, 0x3b,
|
||||
0x71, 0x16, 0xe6, 0x9e, 0x22, 0x22, 0x95, 0x16,
|
||||
0x3f, 0xf1, 0xca, 0xa1, 0x68, 0x1f, 0xac, 0x09,
|
||||
0x12, 0x0e, 0xca, 0x30, 0x75, 0x86, 0xe1, 0xa7},
|
||||
|
||||
.cipherText = {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
||||
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
||||
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
||||
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
||||
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
||||
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
|
||||
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
|
||||
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10}
|
||||
}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errCountLocal, cnt;
|
||||
uint16_t *keyArray, *initVector, dataLength;
|
||||
uint16_t *expCipherTextArray, *plainTextArray;
|
||||
uint16_t vectorCnt;
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
|
||||
//
|
||||
// Loop through all the given vectors.
|
||||
//
|
||||
for(vectorCnt = 0;
|
||||
(vectorCnt < (sizeof(testVectorCBCArray) /
|
||||
sizeof(testVectorCBCArray[0]))); vectorCnt++)
|
||||
{
|
||||
//
|
||||
// Get the current vector's data members.
|
||||
//
|
||||
keySize = testVectorCBCArray[vectorCnt].keySize;
|
||||
opMode = testVectorCBCArray[vectorCnt].opMode;
|
||||
keyArray = testVectorCBCArray[vectorCnt].keyArray;
|
||||
initVector = testVectorCBCArray[vectorCnt].initVector;
|
||||
dataLength = testVectorCBCArray[vectorCnt].dataLength;
|
||||
plainTextArray = testVectorCBCArray[vectorCnt].plainText;
|
||||
expCipherTextArray = testVectorCBCArray[vectorCnt].cipherText;
|
||||
|
||||
//
|
||||
// Perform AES-CBC
|
||||
//
|
||||
AES_performCBC(plainTextArray, dataLength, keyArray, keySize, opMode,
|
||||
initVector);
|
||||
|
||||
//
|
||||
// Check the results
|
||||
//
|
||||
for(cnt = 0; cnt < (dataLength * 16U); cnt++)
|
||||
{
|
||||
if(plainTextArray[cnt] != expCipherTextArray[cnt])
|
||||
{
|
||||
errCountLocal++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update the global error counter.
|
||||
//
|
||||
if(errCountLocal > 0)
|
||||
{
|
||||
errCountGlobal++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the local error counter.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Update test status variable
|
||||
//
|
||||
if(errCountGlobal == 0)
|
||||
{
|
||||
testStatusGlobal = TEST_PASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
testStatusGlobal = TEST_FAIL;
|
||||
}
|
||||
|
||||
//
|
||||
// Infinite Loop to keep the core running
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,258 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: aes_ex3_ctr.c
|
||||
//
|
||||
// TITLE: AES CTR
|
||||
//
|
||||
//! \addtogroup library_example_c28x_list
|
||||
//! <h1>AES CTR Example</h1>
|
||||
//!
|
||||
//! This example encrypts block cipher-text using AES in CTR mode.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b errCountGlobal - Error Counter. It should be zero.
|
||||
//! - \b testStatusGlobal - Test status. It should be equal to PASS.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <aes_ctr.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TEST_PASS 0xABCDABCD
|
||||
#define TEST_FAIL 0xDEADDEAD
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Global error counter & status
|
||||
//
|
||||
uint16_t errCountGlobal = 0;
|
||||
uint32_t testStatusGlobal;
|
||||
|
||||
//
|
||||
// Structure for AES CTR tests
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
uint16_t keyArray[32];
|
||||
uint16_t nonceCtr[16];
|
||||
uint16_t dataLength;
|
||||
uint16_t plainText[64];
|
||||
uint16_t cipherText[64];
|
||||
} testVectorCTR;
|
||||
|
||||
|
||||
//
|
||||
// Test Cases
|
||||
//
|
||||
testVectorCTR testVectorCTRArray[] =
|
||||
{
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_ENCRYPT,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.nonceCtr = {0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
|
||||
0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
||||
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
||||
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
||||
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
||||
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
||||
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
|
||||
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
|
||||
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10},
|
||||
|
||||
.cipherText = {0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26,
|
||||
0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce,
|
||||
0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff,
|
||||
0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff,
|
||||
0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e,
|
||||
0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab,
|
||||
0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1,
|
||||
0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee}
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case #2
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_DECRYPT,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.nonceCtr = {0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
|
||||
0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26,
|
||||
0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce,
|
||||
0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff,
|
||||
0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff,
|
||||
0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e,
|
||||
0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab,
|
||||
0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1,
|
||||
0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee},
|
||||
|
||||
.cipherText = {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
||||
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
||||
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
||||
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
||||
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
||||
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
|
||||
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
|
||||
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10}
|
||||
}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errCountLocal, cnt;
|
||||
uint16_t *keyArray, *nonceCtr, dataLength;
|
||||
uint16_t *expCipherTextArray, *plainTextArray;
|
||||
uint16_t vectorCnt;
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
|
||||
//
|
||||
// Loop through all the given vectors.
|
||||
//
|
||||
for(vectorCnt = 0;
|
||||
(vectorCnt < (sizeof(testVectorCTRArray) /
|
||||
sizeof(testVectorCTRArray[0]))); vectorCnt++)
|
||||
{
|
||||
//
|
||||
// Get the current vector's data members.
|
||||
//
|
||||
keySize = testVectorCTRArray[vectorCnt].keySize;
|
||||
opMode = testVectorCTRArray[vectorCnt].opMode;
|
||||
keyArray = testVectorCTRArray[vectorCnt].keyArray;
|
||||
nonceCtr = testVectorCTRArray[vectorCnt].nonceCtr;
|
||||
dataLength = testVectorCTRArray[vectorCnt].dataLength;
|
||||
plainTextArray = testVectorCTRArray[vectorCnt].plainText;
|
||||
expCipherTextArray = testVectorCTRArray[vectorCnt].cipherText;
|
||||
|
||||
//
|
||||
// Perform AES-CTR
|
||||
//
|
||||
AES_performCTR(plainTextArray, dataLength, keyArray, keySize,
|
||||
opMode, nonceCtr);
|
||||
|
||||
//
|
||||
// Check the results
|
||||
//
|
||||
for(cnt = 0; cnt < (dataLength * 16U); cnt++)
|
||||
{
|
||||
if(plainTextArray[cnt] != expCipherTextArray[cnt])
|
||||
{
|
||||
errCountLocal++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update the global error counter.
|
||||
//
|
||||
if(errCountLocal > 0)
|
||||
{
|
||||
errCountGlobal++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the local error counter.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Update test status variable
|
||||
//
|
||||
if(errCountGlobal == 0)
|
||||
{
|
||||
testStatusGlobal = TEST_PASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
testStatusGlobal = TEST_FAIL;
|
||||
}
|
||||
|
||||
//
|
||||
// Infinite Loop to keep the core running
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,234 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: aes_ex4_cmac.c
|
||||
//
|
||||
// TITLE: AES CMAC
|
||||
//
|
||||
//! \addtogroup library_example_c28x_list
|
||||
//! <h1>AES CMAC Example</h1>
|
||||
//!
|
||||
//! This example encrypts block cipher-text using AES in CMAC mode to generate
|
||||
//! a message authentication code.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b errCountGlobal - Error Counter. It should be zero.
|
||||
//! - \b testStatusGlobal - Test status. It should be equal to PASS.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <aes_cmac.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TEST_PASS 0xABCDABCD
|
||||
#define TEST_FAIL 0xDEADDEAD
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Global error counter & status
|
||||
//
|
||||
uint16_t errCountGlobal = 0;
|
||||
uint32_t testStatusGlobal;
|
||||
|
||||
//
|
||||
// Structure for AES CMAC tests
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
AES_KeySize keySize;
|
||||
uint16_t keyArray[32];
|
||||
uint16_t dataLength;
|
||||
uint16_t plainText[64];
|
||||
uint16_t tag[16];
|
||||
} testVectorCMAC;
|
||||
|
||||
|
||||
//
|
||||
// Test Cases
|
||||
//
|
||||
testVectorCMAC testVectorCMACArray[] =
|
||||
{
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
||||
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
||||
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
||||
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
||||
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
||||
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
|
||||
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
|
||||
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10},
|
||||
|
||||
.tag = {0x51, 0xf0, 0xbe, 0xbf, 0x7e, 0x3b, 0x9d, 0x92,
|
||||
0xfc, 0x49, 0x74, 0x17, 0x79, 0x36, 0x3c, 0xfe}
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.keySize = AES_256,
|
||||
|
||||
.keyArray = {0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
|
||||
0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
|
||||
0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
|
||||
0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
|
||||
0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A,
|
||||
0xAE, 0x2D, 0x8A, 0x57, 0x1E, 0x03, 0xAC, 0x9C,
|
||||
0x9E, 0xB7, 0x6F, 0xAC, 0x45, 0xAF, 0x8E, 0x51,
|
||||
0x30, 0xC8, 0x1C, 0x46, 0xA3, 0x5C, 0xE4, 0x11,
|
||||
0xE5, 0xFB, 0xC1, 0x19, 0x1A, 0x0A, 0x52, 0xEF,
|
||||
0xF6, 0x9F, 0x24, 0x45, 0xDF, 0x4F, 0x9B, 0x17,
|
||||
0xAD, 0x2B, 0x41, 0x7B, 0xE6, 0x6C, 0x37, 0x10},
|
||||
|
||||
.tag = {0xe1, 0x99, 0x21, 0x90, 0x54, 0x9f, 0x6e, 0xd5,
|
||||
0x69, 0x6a, 0x2c, 0x05, 0x6c, 0x31, 0x54, 0x10}
|
||||
}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errCountLocal, cnt;
|
||||
uint16_t *keyArray, dataLength;
|
||||
uint16_t *expTag, *plainTextArray;
|
||||
uint16_t vectorCnt;
|
||||
AES_KeySize keySize;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
|
||||
//
|
||||
// Loop through all the given vectors.
|
||||
//
|
||||
for(vectorCnt = 0;
|
||||
(vectorCnt < (sizeof(testVectorCMACArray) /
|
||||
sizeof(testVectorCMACArray[0]))); vectorCnt++)
|
||||
{
|
||||
//
|
||||
// Get the current vector's data members.
|
||||
//
|
||||
keySize = testVectorCMACArray[vectorCnt].keySize;
|
||||
keyArray = testVectorCMACArray[vectorCnt].keyArray;
|
||||
dataLength = testVectorCMACArray[vectorCnt].dataLength;
|
||||
plainTextArray = testVectorCMACArray[vectorCnt].plainText;
|
||||
expTag = testVectorCMACArray[vectorCnt].tag;
|
||||
|
||||
//
|
||||
// Perform AES-CMAC
|
||||
//
|
||||
uint16_t *tag = AES_performCMAC(plainTextArray, dataLength, keyArray,
|
||||
keySize);
|
||||
|
||||
//
|
||||
// Check the results
|
||||
//
|
||||
for(cnt = 0; cnt < 16U; cnt++)
|
||||
{
|
||||
if(tag[cnt] != expTag[cnt])
|
||||
{
|
||||
errCountLocal++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update the global error counter.
|
||||
//
|
||||
if(errCountLocal > 0)
|
||||
{
|
||||
errCountGlobal++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the local error counter.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Update test status variable
|
||||
//
|
||||
if(errCountGlobal == 0)
|
||||
{
|
||||
testStatusGlobal = TEST_PASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
testStatusGlobal = TEST_FAIL;
|
||||
}
|
||||
|
||||
//
|
||||
// Infinite Loop to keep the core running
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,251 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: aes_ex5_ecb_fast.c
|
||||
//
|
||||
// TITLE: AES ECB fast
|
||||
//
|
||||
//! \addtogroup library_example_c28x_list
|
||||
//! <h1>AES ECB fast Example</h1>
|
||||
//!
|
||||
//! This example encrypts block cipher-text using AES fast implementation in
|
||||
//! ECB mode.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b errCountGlobal - Error Counter. It should be zero.
|
||||
//! - \b testStatusGlobal - Test status. It should be equal to PASS.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <aes_ecb.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TEST_PASS 0xABCDABCD
|
||||
#define TEST_FAIL 0xDEADDEAD
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Global error counter & status
|
||||
//
|
||||
uint16_t errCountGlobal = 0;
|
||||
uint32_t testStatusGlobal;
|
||||
|
||||
//
|
||||
// Structure for AES ECB tests
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
uint16_t keyArray[32];
|
||||
uint16_t dataLength;
|
||||
uint16_t plainText[64];
|
||||
uint16_t cipherText[64];
|
||||
} testVectorECB;
|
||||
|
||||
|
||||
//
|
||||
// Test Cases
|
||||
//
|
||||
testVectorECB testVectorECBArray[] =
|
||||
{
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_ENCRYPT,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
|
||||
0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A,
|
||||
0xAE, 0x2D, 0x8A, 0x57, 0x1E, 0x03, 0xAC, 0x9C,
|
||||
0x9E, 0xB7, 0x6F, 0xAC, 0x45, 0xAF, 0x8E, 0x51,
|
||||
0x30, 0xC8, 0x1C, 0x46, 0xA3, 0x5C, 0xE4, 0x11,
|
||||
0xE5, 0xFB, 0xC1, 0x19, 0x1A, 0x0A, 0x52, 0xEF,
|
||||
0xF6, 0x9F, 0x24, 0x45, 0xDF, 0x4F, 0x9B, 0x17,
|
||||
0xAD, 0x2B, 0x41, 0x7B, 0xE6, 0x6C, 0x37, 0x10},
|
||||
|
||||
.cipherText = {0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
|
||||
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
|
||||
0xf5, 0xd3, 0xd5, 0x85, 0x03, 0xb9, 0x69, 0x9d,
|
||||
0xe7, 0x85, 0x89, 0x5a, 0x96, 0xfd, 0xba, 0xaf,
|
||||
0x43, 0xb1, 0xcd, 0x7f, 0x59, 0x8e, 0xce, 0x23,
|
||||
0x88, 0x1b, 0x00, 0xe3, 0xed, 0x03, 0x06, 0x88,
|
||||
0x7b, 0x0c, 0x78, 0x5e, 0x27, 0xe8, 0xad, 0x3f,
|
||||
0x82, 0x23, 0x20, 0x71, 0x04, 0x72, 0x5d, 0xd4}
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case #2
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_DECRYPT,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x3a, 0xd7, 0x7b, 0xb4, 0x0d, 0x7a, 0x36, 0x60,
|
||||
0xa8, 0x9e, 0xca, 0xf3, 0x24, 0x66, 0xef, 0x97,
|
||||
0xf5, 0xd3, 0xd5, 0x85, 0x03, 0xb9, 0x69, 0x9d,
|
||||
0xe7, 0x85, 0x89, 0x5a, 0x96, 0xfd, 0xba, 0xaf,
|
||||
0x43, 0xb1, 0xcd, 0x7f, 0x59, 0x8e, 0xce, 0x23,
|
||||
0x88, 0x1b, 0x00, 0xe3, 0xed, 0x03, 0x06, 0x88,
|
||||
0x7b, 0x0c, 0x78, 0x5e, 0x27, 0xe8, 0xad, 0x3f,
|
||||
0x82, 0x23, 0x20, 0x71, 0x04, 0x72, 0x5d, 0xd4},
|
||||
|
||||
.cipherText = {0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
|
||||
0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A,
|
||||
0xAE, 0x2D, 0x8A, 0x57, 0x1E, 0x03, 0xAC, 0x9C,
|
||||
0x9E, 0xB7, 0x6F, 0xAC, 0x45, 0xAF, 0x8E, 0x51,
|
||||
0x30, 0xC8, 0x1C, 0x46, 0xA3, 0x5C, 0xE4, 0x11,
|
||||
0xE5, 0xFB, 0xC1, 0x19, 0x1A, 0x0A, 0x52, 0xEF,
|
||||
0xF6, 0x9F, 0x24, 0x45, 0xDF, 0x4F, 0x9B, 0x17,
|
||||
0xAD, 0x2B, 0x41, 0x7B, 0xE6, 0x6C, 0x37, 0x10}
|
||||
}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errCountLocal, cnt;
|
||||
uint16_t *keyArray, dataLength;
|
||||
uint16_t *expCipherTextArray, *plainTextArray;
|
||||
uint16_t vectorCnt;
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
|
||||
//
|
||||
// Loop through all the given vectors.
|
||||
//
|
||||
for(vectorCnt = 0;
|
||||
(vectorCnt < (sizeof(testVectorECBArray) /
|
||||
sizeof(testVectorECBArray[0]))); vectorCnt++)
|
||||
{
|
||||
//
|
||||
// Get the current vector's data members.
|
||||
//
|
||||
keySize = testVectorECBArray[vectorCnt].keySize;
|
||||
opMode = testVectorECBArray[vectorCnt].opMode;
|
||||
keyArray = testVectorECBArray[vectorCnt].keyArray;
|
||||
dataLength = testVectorECBArray[vectorCnt].dataLength;
|
||||
plainTextArray = testVectorECBArray[vectorCnt].plainText;
|
||||
expCipherTextArray = testVectorECBArray[vectorCnt].cipherText;
|
||||
|
||||
//
|
||||
// Perform AES-ECB fast
|
||||
//
|
||||
AES_performECBFast(plainTextArray, dataLength, keyArray,
|
||||
keySize, opMode);
|
||||
|
||||
//
|
||||
// Check the results
|
||||
//
|
||||
for(cnt = 0; cnt < (dataLength * 16U); cnt++)
|
||||
{
|
||||
if(plainTextArray[cnt] != expCipherTextArray[cnt])
|
||||
{
|
||||
errCountLocal++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update the global error counter.
|
||||
//
|
||||
if(errCountLocal > 0)
|
||||
{
|
||||
errCountGlobal++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the local error counter.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Update test status variable
|
||||
//
|
||||
if(errCountGlobal == 0)
|
||||
{
|
||||
testStatusGlobal = TEST_PASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
testStatusGlobal = TEST_FAIL;
|
||||
}
|
||||
|
||||
//
|
||||
// Infinite Loop to keep the core running
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,259 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: aes_ex6_cbc_fast.c
|
||||
//
|
||||
// TITLE: AES CBC fast
|
||||
//
|
||||
//! \addtogroup library_example_c28x_list
|
||||
//! <h1>AES CBC fast Example</h1>
|
||||
//!
|
||||
//! This example encrypts block cipher-text using AES fast implementation in
|
||||
//! CBC mode.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b errCountGlobal - Error Counter. It should be zero.
|
||||
//! - \b testStatusGlobal - Test status. It should be equal to PASS.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <aes_cbc.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TEST_PASS 0xABCDABCD
|
||||
#define TEST_FAIL 0xDEADDEAD
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Global error counter & status
|
||||
//
|
||||
uint16_t errCountGlobal = 0;
|
||||
uint32_t testStatusGlobal;
|
||||
|
||||
//
|
||||
// Structure for AES CBC tests
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
uint16_t keyArray[32];
|
||||
uint16_t initVector[16];
|
||||
uint16_t dataLength;
|
||||
uint16_t plainText[64];
|
||||
uint16_t cipherText[64];
|
||||
} testVectorCBC;
|
||||
|
||||
|
||||
//
|
||||
// Test Cases
|
||||
//
|
||||
testVectorCBC testVectorCBCArray[] =
|
||||
{
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_ENCRYPT,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.initVector = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
||||
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
||||
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
||||
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
||||
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
||||
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
|
||||
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
|
||||
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10},
|
||||
|
||||
.cipherText = {0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46,
|
||||
0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d,
|
||||
0x50, 0x86, 0xcb, 0x9b, 0x50, 0x72, 0x19, 0xee,
|
||||
0x95, 0xdb, 0x11, 0x3a, 0x91, 0x76, 0x78, 0xb2,
|
||||
0x73, 0xbe, 0xd6, 0xb8, 0xe3, 0xc1, 0x74, 0x3b,
|
||||
0x71, 0x16, 0xe6, 0x9e, 0x22, 0x22, 0x95, 0x16,
|
||||
0x3f, 0xf1, 0xca, 0xa1, 0x68, 0x1f, 0xac, 0x09,
|
||||
0x12, 0x0e, 0xca, 0x30, 0x75, 0x86, 0xe1, 0xa7}
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case #2
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_DECRYPT,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.initVector = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46,
|
||||
0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d,
|
||||
0x50, 0x86, 0xcb, 0x9b, 0x50, 0x72, 0x19, 0xee,
|
||||
0x95, 0xdb, 0x11, 0x3a, 0x91, 0x76, 0x78, 0xb2,
|
||||
0x73, 0xbe, 0xd6, 0xb8, 0xe3, 0xc1, 0x74, 0x3b,
|
||||
0x71, 0x16, 0xe6, 0x9e, 0x22, 0x22, 0x95, 0x16,
|
||||
0x3f, 0xf1, 0xca, 0xa1, 0x68, 0x1f, 0xac, 0x09,
|
||||
0x12, 0x0e, 0xca, 0x30, 0x75, 0x86, 0xe1, 0xa7},
|
||||
|
||||
.cipherText = {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
||||
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
||||
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
||||
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
||||
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
||||
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
|
||||
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
|
||||
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10}
|
||||
}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errCountLocal, cnt;
|
||||
uint16_t *keyArray, *initVector, dataLength;
|
||||
uint16_t *expCipherTextArray, *plainTextArray;
|
||||
uint16_t vectorCnt;
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
|
||||
//
|
||||
// Loop through all the given vectors.
|
||||
//
|
||||
for(vectorCnt = 0;
|
||||
(vectorCnt < (sizeof(testVectorCBCArray) /
|
||||
sizeof(testVectorCBCArray[0]))); vectorCnt++)
|
||||
{
|
||||
//
|
||||
// Get the current vector's data members.
|
||||
//
|
||||
keySize = testVectorCBCArray[vectorCnt].keySize;
|
||||
opMode = testVectorCBCArray[vectorCnt].opMode;
|
||||
keyArray = testVectorCBCArray[vectorCnt].keyArray;
|
||||
initVector = testVectorCBCArray[vectorCnt].initVector;
|
||||
dataLength = testVectorCBCArray[vectorCnt].dataLength;
|
||||
plainTextArray = testVectorCBCArray[vectorCnt].plainText;
|
||||
expCipherTextArray = testVectorCBCArray[vectorCnt].cipherText;
|
||||
|
||||
//
|
||||
// Perform AES-CBC
|
||||
//
|
||||
AES_performCBCFast(plainTextArray, dataLength, keyArray, keySize,
|
||||
opMode, initVector);
|
||||
|
||||
//
|
||||
// Check the results
|
||||
//
|
||||
for(cnt = 0; cnt < (dataLength * 16U); cnt++)
|
||||
{
|
||||
if(plainTextArray[cnt] != expCipherTextArray[cnt])
|
||||
{
|
||||
errCountLocal++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update the global error counter.
|
||||
//
|
||||
if(errCountLocal > 0)
|
||||
{
|
||||
errCountGlobal++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the local error counter.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Update test status variable
|
||||
//
|
||||
if(errCountGlobal == 0)
|
||||
{
|
||||
testStatusGlobal = TEST_PASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
testStatusGlobal = TEST_FAIL;
|
||||
}
|
||||
|
||||
//
|
||||
// Infinite Loop to keep the core running
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,259 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: aes_ex7_ctr_fast.c
|
||||
//
|
||||
// TITLE: AES CTR fast
|
||||
//
|
||||
//! \addtogroup library_example_c28x_list
|
||||
//! <h1>AES CTR fast Example</h1>
|
||||
//!
|
||||
//! This example encrypts block cipher-text using AES fast implementation in
|
||||
//! CTR mode.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b errCountGlobal - Error Counter. It should be zero.
|
||||
//! - \b testStatusGlobal - Test status. It should be equal to PASS.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <aes_ctr.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TEST_PASS 0xABCDABCD
|
||||
#define TEST_FAIL 0xDEADDEAD
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Global error counter & status
|
||||
//
|
||||
uint16_t errCountGlobal = 0;
|
||||
uint32_t testStatusGlobal;
|
||||
|
||||
//
|
||||
// Structure for AES CTR tests
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
uint16_t keyArray[32];
|
||||
uint16_t nonceCtr[16];
|
||||
uint16_t dataLength;
|
||||
uint16_t plainText[64];
|
||||
uint16_t cipherText[64];
|
||||
} testVectorCTR;
|
||||
|
||||
|
||||
//
|
||||
// Test Cases
|
||||
//
|
||||
testVectorCTR testVectorCTRArray[] =
|
||||
{
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_ENCRYPT,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.nonceCtr = {0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
|
||||
0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
||||
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
||||
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
||||
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
||||
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
||||
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
|
||||
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
|
||||
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10},
|
||||
|
||||
.cipherText = {0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26,
|
||||
0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce,
|
||||
0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff,
|
||||
0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff,
|
||||
0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e,
|
||||
0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab,
|
||||
0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1,
|
||||
0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee}
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case #2
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.opMode = AES_OPMODE_DECRYPT,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.nonceCtr = {0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
|
||||
0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26,
|
||||
0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce,
|
||||
0x98, 0x06, 0xf6, 0x6b, 0x79, 0x70, 0xfd, 0xff,
|
||||
0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff,
|
||||
0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e,
|
||||
0x5b, 0x4f, 0x09, 0x02, 0x0d, 0xb0, 0x3e, 0xab,
|
||||
0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1,
|
||||
0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee},
|
||||
|
||||
.cipherText = {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
||||
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
||||
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
||||
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
||||
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
||||
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
|
||||
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
|
||||
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10}
|
||||
}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errCountLocal, cnt;
|
||||
uint16_t *keyArray, *nonceCtr, dataLength;
|
||||
uint16_t *expCipherTextArray, *plainTextArray;
|
||||
uint16_t vectorCnt;
|
||||
AES_KeySize keySize;
|
||||
AES_OperationMode opMode;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
|
||||
//
|
||||
// Loop through all the given vectors.
|
||||
//
|
||||
for(vectorCnt = 0;
|
||||
(vectorCnt < (sizeof(testVectorCTRArray) /
|
||||
sizeof(testVectorCTRArray[0]))); vectorCnt++)
|
||||
{
|
||||
//
|
||||
// Get the current vector's data members.
|
||||
//
|
||||
keySize = testVectorCTRArray[vectorCnt].keySize;
|
||||
opMode = testVectorCTRArray[vectorCnt].opMode;
|
||||
keyArray = testVectorCTRArray[vectorCnt].keyArray;
|
||||
nonceCtr = testVectorCTRArray[vectorCnt].nonceCtr;
|
||||
dataLength = testVectorCTRArray[vectorCnt].dataLength;
|
||||
plainTextArray = testVectorCTRArray[vectorCnt].plainText;
|
||||
expCipherTextArray = testVectorCTRArray[vectorCnt].cipherText;
|
||||
|
||||
//
|
||||
// Perform AES-CTR
|
||||
//
|
||||
AES_performCTRFast(plainTextArray, dataLength, keyArray, keySize,
|
||||
opMode, nonceCtr);
|
||||
|
||||
//
|
||||
// Check the results
|
||||
//
|
||||
for(cnt = 0; cnt < (dataLength * 16U); cnt++)
|
||||
{
|
||||
if(plainTextArray[cnt] != expCipherTextArray[cnt])
|
||||
{
|
||||
errCountLocal++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update the global error counter.
|
||||
//
|
||||
if(errCountLocal > 0)
|
||||
{
|
||||
errCountGlobal++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the local error counter.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Update test status variable
|
||||
//
|
||||
if(errCountGlobal == 0)
|
||||
{
|
||||
testStatusGlobal = TEST_PASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
testStatusGlobal = TEST_FAIL;
|
||||
}
|
||||
|
||||
//
|
||||
// Infinite Loop to keep the core running
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,234 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: aes_ex8_cmac_fast.c
|
||||
//
|
||||
// TITLE: AES CMAC_fast
|
||||
//
|
||||
//! \addtogroup library_example_c28x_list
|
||||
//! <h1>AES CMAC fast Example</h1>
|
||||
//!
|
||||
//! This example encrypts block cipher-text using AES fast implementation in
|
||||
//! CMAC mode to generate a message authentication code.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b errCountGlobal - Error Counter. It should be zero.
|
||||
//! - \b testStatusGlobal - Test status. It should be equal to PASS.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <aes_cmac.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TEST_PASS 0xABCDABCD
|
||||
#define TEST_FAIL 0xDEADDEAD
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Global error counter & status
|
||||
//
|
||||
uint16_t errCountGlobal = 0;
|
||||
uint32_t testStatusGlobal;
|
||||
|
||||
//
|
||||
// Structure for AES CMAC tests
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
AES_KeySize keySize;
|
||||
uint16_t keyArray[32];
|
||||
uint16_t dataLength;
|
||||
uint16_t plainText[64];
|
||||
uint16_t tag[16];
|
||||
} testVectorCMAC;
|
||||
|
||||
|
||||
//
|
||||
// Test Cases
|
||||
//
|
||||
testVectorCMAC testVectorCMACArray[] =
|
||||
{
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.keySize = AES_128,
|
||||
|
||||
.keyArray = {0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
|
||||
0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96,
|
||||
0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a,
|
||||
0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
|
||||
0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51,
|
||||
0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11,
|
||||
0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
|
||||
0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17,
|
||||
0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10},
|
||||
|
||||
.tag = {0x51, 0xf0, 0xbe, 0xbf, 0x7e, 0x3b, 0x9d, 0x92,
|
||||
0xfc, 0x49, 0x74, 0x17, 0x79, 0x36, 0x3c, 0xfe}
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.keySize = AES_256,
|
||||
|
||||
.keyArray = {0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
|
||||
0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
|
||||
0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
|
||||
0x2d, 0x98, 0x10, 0xa3, 0x09, 0x14, 0xdf, 0xf4},
|
||||
|
||||
.dataLength = 4U,
|
||||
|
||||
.plainText = {0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
|
||||
0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A,
|
||||
0xAE, 0x2D, 0x8A, 0x57, 0x1E, 0x03, 0xAC, 0x9C,
|
||||
0x9E, 0xB7, 0x6F, 0xAC, 0x45, 0xAF, 0x8E, 0x51,
|
||||
0x30, 0xC8, 0x1C, 0x46, 0xA3, 0x5C, 0xE4, 0x11,
|
||||
0xE5, 0xFB, 0xC1, 0x19, 0x1A, 0x0A, 0x52, 0xEF,
|
||||
0xF6, 0x9F, 0x24, 0x45, 0xDF, 0x4F, 0x9B, 0x17,
|
||||
0xAD, 0x2B, 0x41, 0x7B, 0xE6, 0x6C, 0x37, 0x10},
|
||||
|
||||
.tag = {0xe1, 0x99, 0x21, 0x90, 0x54, 0x9f, 0x6e, 0xd5,
|
||||
0x69, 0x6a, 0x2c, 0x05, 0x6c, 0x31, 0x54, 0x10}
|
||||
}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errCountLocal, cnt;
|
||||
uint16_t *keyArray, dataLength;
|
||||
uint16_t *expTag, *plainTextArray;
|
||||
uint16_t vectorCnt;
|
||||
AES_KeySize keySize;
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
|
||||
//
|
||||
// Loop through all the given vectors.
|
||||
//
|
||||
for(vectorCnt = 0;
|
||||
(vectorCnt < (sizeof(testVectorCMACArray) /
|
||||
sizeof(testVectorCMACArray[0]))); vectorCnt++)
|
||||
{
|
||||
//
|
||||
// Get the current vector's data members.
|
||||
//
|
||||
keySize = testVectorCMACArray[vectorCnt].keySize;
|
||||
keyArray = testVectorCMACArray[vectorCnt].keyArray;
|
||||
dataLength = testVectorCMACArray[vectorCnt].dataLength;
|
||||
plainTextArray = testVectorCMACArray[vectorCnt].plainText;
|
||||
expTag = testVectorCMACArray[vectorCnt].tag;
|
||||
|
||||
//
|
||||
// Perform AES-CMAC fast
|
||||
//
|
||||
uint16_t *tag = AES_performCMACFast(plainTextArray, dataLength,
|
||||
keyArray,keySize);
|
||||
|
||||
//
|
||||
// Check the results
|
||||
//
|
||||
for(cnt = 0; cnt < 16U; cnt++)
|
||||
{
|
||||
if(tag[cnt] != expTag[cnt])
|
||||
{
|
||||
errCountLocal++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update the global error counter.
|
||||
//
|
||||
if(errCountLocal > 0)
|
||||
{
|
||||
errCountGlobal++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the local error counter.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Update test status variable
|
||||
//
|
||||
if(errCountGlobal == 0)
|
||||
{
|
||||
testStatusGlobal = TEST_PASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
testStatusGlobal = TEST_FAIL;
|
||||
}
|
||||
|
||||
//
|
||||
// Infinite Loop to keep the core running
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="aes_ex11_cbc_packed"
|
||||
device="TMS320F280049C"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f28004x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f28004x -I${PROJECT_ROOT}/f28004x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --tmu_support=tmu0 --define=CPU1 --define=_FLASH --define=MEM_PACKED_SPEED_OPT --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f28004x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f28004x -I${PROJECT_ROOT}/f28004x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --tmu_support=tmu0 --define=CPU1 --define=MEM_PACKED_SPEED_OPT --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="AES_ROOT" path="../../aes" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="AES_ROOT/source/aes_cbc.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/source/aes_common.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_cbc.h" targetDirectory="inc" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_common.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/aes_ex11_cbc_packed.c" targetDirectory="" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/28004x_generic_ram_lnk.cmd" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/28004x_generic_flash_lnk.cmd" targetDirectory="f28004x" applicableConfigurations="f28004x_FLASH" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f28004x f28004x f28004x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/include/driverlib.h" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/include/device.h" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/source/device.c" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/source/f28004x_codestartbranch.asm" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f28004x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/targetConfigs/TMS320F280049C.ccxml" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f28004x/driverlib/" targetDirectory="f28004x" excludeFromBuild="True" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="aes_ex1_ecb"
|
||||
device="Generic C28xx Device"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f2838x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --define=_FLASH -g --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f2838x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 -g --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="AES_ROOT" path="../../aes" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="AES_ROOT/source/aes_ecb.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/source/aes_common.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_ecb.h" targetDirectory="inc" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_common.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/aes_ex1_ecb.c" targetDirectory="" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f2838x f2838x f2838x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="f2838x" excludeFromBuild="True" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="aes_ex2_cbc"
|
||||
device="Generic C28xx Device"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f2838x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f2838x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="AES_ROOT" path="../../aes" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="AES_ROOT/source/aes_cbc.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/source/aes_common.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_cbc.h" targetDirectory="inc" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_common.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/aes_ex2_cbc.c" targetDirectory="" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f2838x f2838x f2838x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="f2838x" excludeFromBuild="True" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="aes_ex3_ctr"
|
||||
device="Generic C28xx Device"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f2838x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f2838x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="AES_ROOT" path="../../aes" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="AES_ROOT/source/aes_ctr.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/source/aes_common.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_ctr.h" targetDirectory="inc" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_common.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/aes_ex3_ctr.c" targetDirectory="" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f2838x f2838x f2838x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="f2838x" excludeFromBuild="True" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="aes_ex4_cmac"
|
||||
device="Generic C28xx Device"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f2838x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f2838x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="AES_ROOT" path="../../aes" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="AES_ROOT/source/aes_cmac.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/source/aes_common.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_cmac.h" targetDirectory="inc" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_common.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/aes_ex4_cmac.c" targetDirectory="" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f2838x f2838x f2838x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_RAM_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="f2838x" excludeFromBuild="True" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="aes_ex5_ecb_fast"
|
||||
device="Generic C28xx Device"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f2838x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f2838x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="AES_ROOT" path="../../aes" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="AES_ROOT/source/aes_ecb.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/source/aes_common.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_ecb.h" targetDirectory="inc" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_common.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/aes_ex5_ecb_fast.c" targetDirectory="" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f2838x f2838x f2838x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/2838x_RAM_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="f2838x" excludeFromBuild="True" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="aes_ex6_cbc_fast"
|
||||
device="Generic C28xx Device"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f2838x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f2838x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="AES_ROOT" path="../../aes" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="AES_ROOT/source/aes_cbc.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/source/aes_common.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_cbc.h" targetDirectory="inc" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_common.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/aes_ex6_cbc_fast.c" targetDirectory="" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f2838x f2838x f2838x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/2838x_RAM_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="f2838x" excludeFromBuild="True" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="aes_ex7_ctr_fast"
|
||||
device="Generic C28xx Device"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f2838x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f2838x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="AES_ROOT" path="../../aes" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="AES_ROOT/source/aes_ctr.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/source/aes_common.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_ctr.h" targetDirectory="inc" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_common.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/aes_ex7_ctr_fast.c" targetDirectory="" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f2838x f2838x f2838x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/2838x_RAM_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="f2838x" excludeFromBuild="True" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,42 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="aes_ex8_cmac_fast"
|
||||
device="Generic C28xx Device"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f2838x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f2838x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="AES_ROOT" path="../../aes" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="AES_ROOT/source/aes_cmac.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/source/aes_common.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_cmac.h" targetDirectory="inc" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_common.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/aes_ex8_cmac_fast.c" targetDirectory="" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f2838x f2838x f2838x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/2838x_RAM_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="f2838x" excludeFromBuild="True" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="rsassapkcs1_v1_5_ex15"
|
||||
device="TMS320F28P650DK9"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="SHA256_RSA_2048_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${COM_TI_C2000WARE_SOFTWARE_PACKAGE_INSTALL_DIR}/libraries/security/crypto/c28/sha/include -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f28004x -I${PROJECT_ROOT}/f28004x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --tmu_support=tmu0 --define=SHA_256 --define=CPU1 --define=RSA_2048 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x2000 --heap_size=0x2000 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="SHA256_RSA_3072_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${COM_TI_C2000WARE_SOFTWARE_PACKAGE_INSTALL_DIR}/libraries/security/crypto/c28/sha/include -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f28004x -I${PROJECT_ROOT}/f28004x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --tmu_support=tmu0 --define=SHA_256 --define=CPU1 --define=RSA_3072 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x2000 --heap_size=0x2000 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="SHA384_RSA_2048_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${COM_TI_C2000WARE_SOFTWARE_PACKAGE_INSTALL_DIR}/libraries/security/crypto/c28/sha/include -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f28004x -I${PROJECT_ROOT}/f28004x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --tmu_support=tmu0 --define=SHA_384 --define=CPU1 --define=RSA_2048 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x2000 --heap_size=0x2000 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="SHA384_RSA_3072_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${COM_TI_C2000WARE_SOFTWARE_PACKAGE_INSTALL_DIR}/libraries/security/crypto/c28/sha/include -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f28004x -I${PROJECT_ROOT}/f28004x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --tmu_support=tmu0 --define=SHA_384 --define=CPU1 --define=RSA_3072 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x2000 --heap_size=0x2000 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="AES_ROOT" path="../../aes" scope="project" />
|
||||
<pathVariable name="SHA_ROOT" path="../../sha" scope="project" />
|
||||
<pathVariable name="RSA_ROOT" path="../../rsa" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="SHA_ROOT/source/sha256.c" targetDirectory="src" />
|
||||
<file action="copy" path="SHA_ROOT/source/sha256_casm_C28.asm" targetDirectory="src" />
|
||||
<file action="copy" path="SHA_ROOT/source/sha384_casm_C28.asm" targetDirectory="src" />
|
||||
<file action="copy" path="SHA_ROOT/include/sha256.h" targetDirectory="inc" />
|
||||
<file action="copy" path="SHA_ROOT/source/sha384.c" targetDirectory="src" />
|
||||
<file action="copy" path="SHA_ROOT/include/sha384.h" targetDirectory="inc" />
|
||||
<file action="copy" path="AES_ROOT/source/aes_common.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_common.h" targetDirectory="inc" />
|
||||
<file action="copy" path="AES_ROOT/source/aes_ctr.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_ctr.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/source/emsa_pkcs1_v1_5.c" targetDirectory="src" />
|
||||
<file action="copy" path="RSA_ROOT/include/emsa_pkcs1_v1_5.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/source/mpi.c" targetDirectory="src" />
|
||||
<file action="copy" path="RSA_ROOT/include/mpi.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/source/rsassa_pkcs1_v1_5.c" targetDirectory="src" />
|
||||
<file action="copy" path="RSA_ROOT/include/rsassa_pkcs1_v1_5.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/source/yarrow.c" targetDirectory="src" />
|
||||
<file action="copy" path="RSA_ROOT/include/yarrow.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/include/logtab.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/include/mpi-config.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/include/mpi-types.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/rsassa_pkcs1_v1_5_ex15.c" targetDirectory="" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/28p65x_generic_flash_lnk_cpu1.cmd" targetDirectory="" applicableConfigurations="SHA256_RSA_2048_FLASH, SHA256_RSA_3072_FLASH, SHA384_RSA_2048_FLASH, SHA384_RSA_3072_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,59 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="rsassapss_ex14"
|
||||
device="TMS320F280049C"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f28004x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f28004x -I${PROJECT_ROOT}/f28004x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --tmu_support=tmu0 --define=CPU1 --define=RSA_3072 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x3f8 --heap_size=0x2000 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f28004x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f28004x -I${PROJECT_ROOT}/f28004x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --tmu_support=tmu0 --define=CPU1 --define=RSA_3072 --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x3f8 --heap_size=0x2000 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="AES_ROOT" path="../../aes" scope="project" />
|
||||
<pathVariable name="SHA_ROOT" path="../../sha" scope="project" />
|
||||
<pathVariable name="RSA_ROOT" path="../../rsa" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="SHA_ROOT/source/sha256.c" targetDirectory="src" />
|
||||
<file action="copy" path="SHA_ROOT/source/sha256_casm_C28.asm" targetDirectory="src" />
|
||||
<file action="copy" path="SHA_ROOT/source/sha384_casm_C28.asm" targetDirectory="src" />
|
||||
<file action="copy" path="SHA_ROOT/include/sha256.h" targetDirectory="inc" />
|
||||
<file action="copy" path="AES_ROOT/source/aes_common.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_common.h" targetDirectory="inc" />
|
||||
<file action="copy" path="AES_ROOT/source/aes_ctr.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/aes_ctr.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/source/emsa_pss.c" targetDirectory="src" />
|
||||
<file action="copy" path="RSA_ROOT/include/emsa_pss.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/source/mpi.c" targetDirectory="src" />
|
||||
<file action="copy" path="RSA_ROOT/include/mpi.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/source/rsassa_pss.c" targetDirectory="src" />
|
||||
<file action="copy" path="RSA_ROOT/include/rsassa_pss.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/source/yarrow.c" targetDirectory="src" />
|
||||
<file action="copy" path="RSA_ROOT/include/yarrow.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/include/logtab.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/include/mpi-config.h" targetDirectory="inc" />
|
||||
<file action="copy" path="RSA_ROOT/include/mpi-types.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/rsassapss_ex14.c" targetDirectory="" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/280049M_RAM_lnk.cmd" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/280049M_FLASH_lnk.cmd" targetDirectory="f28004x" applicableConfigurations="f28004x_FLASH" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f28004x f28004x f28004x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/include/driverlib.h" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/include/device.h" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/source/device.c" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/source/f28004x_codestartbranch.asm" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f28004x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/targetConfigs/TMS320F280049C.ccxml" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f28004x/driverlib/" targetDirectory="f28004x" excludeFromBuild="True" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,41 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="sha256_ex10_wordwise"
|
||||
device="Generic C28xx Device"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f2838x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f2838x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="AES_ROOT" path="../../sha" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="AES_ROOT/source/sha256.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/source/sha256_casm_C28.asm" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/sha256.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/sha256_ex10_wordwise.c" targetDirectory="" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f2838x f2838x f2838x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_RAM_lnk_SHA_combined.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="f2838x" excludeFromBuild="True" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,41 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="sha256_ex9_bytewise"
|
||||
device="Generic C28xx Device"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f2838x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --define=_FLASH --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f2838x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f2838x -I${PROJECT_ROOT}/f2838x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --float_support=fpu64 --tmu_support=tmu0 --define=CPU1 --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="AES_ROOT" path="../../sha" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="AES_ROOT/source/sha256_casm_C28.asm" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/source/sha256.c" targetDirectory="src" />
|
||||
<file action="copy" path="AES_ROOT/include/sha256.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/sha256_ex9_bytewise.c" targetDirectory="" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f2838x f2838x f2838x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/driverlib.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/include/device.h" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/device.c" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/source/f2838x_codestartbranch.asm" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/targetConfigs/TMS320F28388D.ccxml" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_RAM_lnk_SHA_combined.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_RAM" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f2838x/common/cmd/2838x_FLASH_lnk_cpu1.cmd" targetDirectory="f2838x" applicableConfigurations="f2838x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f2838x/driverlib/" targetDirectory="f2838x" excludeFromBuild="True" applicableConfigurations="f2838x_RAM,f2838x_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,40 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="sha384_ex12_bytewise"
|
||||
device="TMS320F280049C"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f28004x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f28004x -I${PROJECT_ROOT}/f28004x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --tmu_support=tmu0 --define=CPU1 --define=_FLASH --define=MEM_PACKED_SPEED_OPT --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f28004x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f28004x -I${PROJECT_ROOT}/f28004x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --tmu_support=tmu0 --define=CPU1 --define=MEM_PACKED_SPEED_OPT --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="SHA_ROOT" path="../../sha" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="SHA_ROOT/source/sha384.c" targetDirectory="src" />
|
||||
<file action="copy" path="SHA_ROOT/source/sha384_casm_C28.asm" targetDirectory="src" />
|
||||
<file action="copy" path="SHA_ROOT/include/sha384.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/sha384_ex12_bytewise.c" targetDirectory="" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/cmd/28004x_RAM_lnk_SHA_combined.cmd" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/28004x_generic_flash_lnk.cmd" targetDirectory="f28004x" applicableConfigurations="f28004x_FLASH" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f28004x f28004x f28004x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/include/driverlib.h" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/include/device.h" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/source/device.c" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/source/f28004x_codestartbranch.asm" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f28004x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/targetConfigs/TMS320F280049C.ccxml" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f28004x/driverlib/" targetDirectory="f28004x" excludeFromBuild="True" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,41 @@
|
||||
<projectSpec>
|
||||
<project
|
||||
name="sha384_ex13_wordwise"
|
||||
device="TMS320F280049C"
|
||||
cgtVersion="21.6.0.LTS"
|
||||
products="C2000WARE"
|
||||
launchWizard="False"
|
||||
linkerCommandFile=""
|
||||
>
|
||||
|
||||
<configuration name="f28004x_FLASH" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f28004x -I${PROJECT_ROOT}/f28004x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --tmu_support=tmu0 --define=CPU1 --define=_FLASH --define=MEM_PACKED_SPEED_OPT --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
<configuration name="f28004x_RAM" compilerBuildOptions="-Ooff --opt_for_speed=2 --fp_mode=relaxed -I${PROJECT_ROOT} -I${PROJECT_ROOT}/inc -I${PROJECT_ROOT}/f28004x -I${PROJECT_ROOT}/f28004x/driverlib -I${CG_TOOL_ROOT}/include -v28 -ml -mt --cla_support=cla2 --tmu_support=tmu0 --define=CPU1 --define=MEM_PACKED_SPEED_OPT --diag_warning=225 --diag_wrap=off --gen_func_subsections=on --abi=eabi" linkerBuildOptions="--stack_size=0x200 --heap_size=0x200 --define=CPU1 -I${CG_TOOL_ROOT}/include -I${CG_TOOL_ROOT}/lib" />
|
||||
|
||||
<pathVariable name="C2000WARE_DEVICE_SUPPORT_ROOT" path="../../../../../../device_support/" scope="project" />
|
||||
<pathVariable name="C2000WARE_DLIB_ROOT" path="../../../../../../driverlib/" scope="project" />
|
||||
<pathVariable name="SHA_ROOT" path="../../sha" scope="project" />
|
||||
<pathVariable name="EXAMPLE_ROOT" path="../" scope="project" />
|
||||
|
||||
<file action="copy" path="SHA_ROOT/source/sha384.c" targetDirectory="src" />
|
||||
<file action="copy" path="SHA_ROOT/source/sha384_casm_C28.asm" targetDirectory="src" />
|
||||
<file action="copy" path="SHA_ROOT/include/sha384.h" targetDirectory="inc" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/sha384_ex13_wordwise.c" targetDirectory="" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/cmd/28004x_RAM_lnk_SHA_combined.cmd" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM" />
|
||||
<file action="copy" path="EXAMPLE_ROOT/28004x_generic_flash_lnk.cmd" targetDirectory="f28004x" applicableConfigurations="f28004x_FLASH" />
|
||||
|
||||
<!-- DRIVERLIB -->
|
||||
<!-- f28004x f28004x f28004x -->
|
||||
<!-- DRIVERLIB -->
|
||||
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/include/driverlib.h" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/include/device.h" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/source/device.c" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/source/f28004x_codestartbranch.asm" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="link" path="C2000WARE_DLIB_ROOT/f28004x/driverlib/ccs/Debug/driverlib.lib" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DEVICE_SUPPORT_ROOT/f28004x/common/targetConfigs/TMS320F280049C.ccxml" targetDirectory="f28004x" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
<file action="copy" path="C2000WARE_DLIB_ROOT/f28004x/driverlib/" targetDirectory="f28004x" excludeFromBuild="True" applicableConfigurations="f28004x_RAM,f28004x_FLASH" />
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
</projectSpec>
|
||||
@@ -0,0 +1,239 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: rsassapkcs1_v1_5_ex15.c
|
||||
//
|
||||
// TITLE: RSASSA-PKCS1 Example
|
||||
//
|
||||
//###########################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2022 Texas Instruments Incorporated - http://www.ti.com
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "emsa_pkcs1_v1_5.h"
|
||||
#include "rsassa_pkcs1_v1_5.h"
|
||||
#include "sha256.h"
|
||||
#include "sha384.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "stdio.h"
|
||||
|
||||
#ifdef SHA_384
|
||||
#define DIGEST_SIZE 6
|
||||
#define SHA_hashByteWise SHA384_hashByteWise
|
||||
#define SHA_ObjectByteWise SHA384_ObjectByteWise
|
||||
typedef uint64_t tDigest;
|
||||
#endif
|
||||
|
||||
#ifdef SHA_256
|
||||
#define DIGEST_SIZE 8
|
||||
#define SHA_hashByteWise SHA256_hashByteWise
|
||||
#define SHA_ObjectByteWise SHA256_ObjectByteWise
|
||||
typedef uint32_t tDigest;
|
||||
#endif
|
||||
|
||||
typedef const unsigned char cuChar;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SHA object for hashing the message
|
||||
//
|
||||
//*****************************************************************************
|
||||
SHA_ObjectByteWise md;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// RSA-SSA PKCS Parameters
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef RSA_2048
|
||||
cuChar n[] = "c5062b58d8539c765e1e5dbaf14cf75dd56c2e13105fecfd1a930bbb5948ff328f126abe779359ca59bca752c308d281573bc6178b6c0fef7dc445e4f826430437b9f9d790581de5749c2cb9cb26d42b2fee15b6b26f09c99670336423b86bc5bec71113157be2d944d7ff3eebffb28413143ea36755db0ae62ff5b724eecb3d316b6bac67e89cacd8171937e2ab19bd353a89acea8c36f81c89a620d5fd2effea896601c7f9daca7f033f635a3a943331d1b1b4f5288790b53af352f1121ca1bef205f40dc012c412b40bdd27585b946466d75f7ee0a7f9d549b4bece6f43ac3ee65fe7fd37123359d9f1a850ad450aaf5c94eb11dea3fc0fc6e9856b1805ef";
|
||||
cuChar e[] = "86c94f";
|
||||
cuChar d[] = "49e5786bb4d332f94586327bde088875379b75d128488f08e574ab4715302a87eea52d4c4a23d8b97af7944804337c5f55e16ba9ffafc0c9fd9b88eca443f39b7967170ddb8ce7ddb93c6087c8066c4a95538a441b9dc80dc9f7810054fd1e5c9d0250c978bb2d748abe1e9465d71a8165d3126dce5db2adacc003e9062ba37a54b63e5f49a4eafebd7e4bf5b0a796c2b3a950fa09c798d3fa3e86c4b62c33ba9365eda054e5fe74a41f21b595026acf1093c90a8c71722f91af1ed29a41a2449a320fc7ba3120e3e8c3e4240c04925cc698ecd66c7c906bdf240adad972b4dff4869d400b5d13e33eeba38e075e872b0ed3e91cc9c283867a4ffc3901d2069f";
|
||||
cuChar msg[] = "dfc22604b95d15328059745c6c98eb9dfb347cf9f170aff19deeec555f22285a6706c4ecbf0fb1458c60d9bf913fbae6f4c554d245d946b4bc5f34aec2ac6be8b33dc8e0e3a9d601dfd53678f5674443f67df78a3a9e0933e5f158b169ac8d1c4cd0fb872c14ca8e001e542ea0f9cfda88c42dcad8a74097a00c22055b0bd41f";
|
||||
#endif
|
||||
|
||||
#ifdef RSA_3072
|
||||
cuChar n[] = "a7a1882a7fb896786034d07fb1b9f6327c27bdd7ce6fe39c285ae3b6c34259adc0dc4f7b9c7dec3ca4a20d3407339eedd7a12a421da18f5954673cac2ff059156ecc73c6861ec761e6a0f2a5a033a6768c6a42d8b459e1b4932349e84efd92df59b45935f3d0e30817c66201aa99d07ae36c5d74f408d69cc08f044151ff4960e531360cb19077833adf7bce77ecfaa133c0ccc63c93b856814569e0b9884ee554061b9a20ab46c38263c094dae791aa61a17f8d16f0e85b7e5ce3b067ece89e20bc4e8f1ae814b276d234e04f4e766f501da74ea7e3817c24ea35d016676cece652b823b051625573ca92757fc720d254ecf1dcbbfd21d98307561ecaab545480c7c52ad7e9fa6b597f5fe550559c2fe923205ac1761a99737ca02d7b19822e008a8969349c87fb874c81620e38f613c8521f0381fe5ba55b74827dad3e1cf2aa29c6933629f2b286ad11be88fa6436e7e3f64a75e3595290dc0d1cd5eee7aaac54959cc53bd5a934a365e72dd81a2bd4fb9a67821bffedf2ef2bd94913de8b";
|
||||
cuChar e[] = "1415a7";
|
||||
cuChar d[] = "073a5fc4cd642f6113dffc4f84035cee3a2b8acc549703751a1d6a5eaa13487229a58ef7d7a522bb9f4f25510f1aa0f74c6a8fc8a5c5be8b91a674ede50e92f7e34a90a3c9da999fffb1d695e4588f451256c163484c151350cb9c7825a7d910845ee5cf826fecf9a7c0fbbbba22bb4a531c131d2e7761ba898f002ebef8ab87218511f81d3266e1ec07a7ca8622514c6dfdc86c67679a2c8f5f031de9a0c22b5a88060b46ee0c64d3b9af3c0a379bcd9c6a1b51cf6480456d3fd6def94cd2a6c171dd3f010e3c9d662bc857208248c94ebcb9fd997b9ff4a7e5fd95558569906525e741d78344f6f6cfdbd59d4faa52ee3fa964fb7cccb2d6be1935d211fe1498217716273939a946081fd8509913fd47747c5c2f03efd4d6fc9c6fcfd8402e9f40a0a5b3de3ca2b3c0fac9456938faa6cf2c20e3912e5981c9876d8ca1ff29b87a15eeae0ccce3f8a8f1e405091c083b98bcc5fe0d0deaae33c67c0394437f0eccb385b7efb17aeebba8afaecca30a2f63eac8f0ac8f1eacad85bbcaf3960b";
|
||||
cuChar msg[] = "3b8a68da11b61b5fee1c2ca00a6aa35bbfdbdd42855b284320ec8d0c1848edcf6ac850427d8479eb57bcbe9a11771637886974bd561a5387014592cb717e8364a8183fd4ad463c89c980215ff629d867956ee5e75f71f7a19ea7bd589d7efb915d44dd9789448bc1ac32fdf7a2c911734db2dbc589a83c1a61dab6bd83907ede";
|
||||
#endif
|
||||
|
||||
#define HASH_LEN (DIGEST_SIZE * sizeof(tDigest) * 2)
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Data structures to work with
|
||||
//
|
||||
//*****************************************************************************
|
||||
rsa_PublicKey key_pub;
|
||||
rsa_PrivateKey key_pvt;
|
||||
rsa_Modulus modulus;
|
||||
rsa_Signature sign;
|
||||
int16_t verified = -1;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Main function
|
||||
//
|
||||
//*****************************************************************************
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Application locals
|
||||
//
|
||||
uint16_t i, j;
|
||||
char temp[3]= {0};
|
||||
uint16_t *hash = NULL;
|
||||
uint16_t msg_data[256] = {0};
|
||||
tDigest digest[DIGEST_SIZE] = {0};
|
||||
volatile char *strSignature = NULL;
|
||||
uint16_t datalen = strlen((char *)msg)/2;
|
||||
|
||||
//convert message character string to a uint16_t byte array.
|
||||
for(i=0; i<strlen((char *)msg); i+=2)
|
||||
{
|
||||
temp[0] = msg[i];
|
||||
temp[1] = msg[i+1];
|
||||
msg_data[i/2] = strtol(temp,NULL,16);
|
||||
}
|
||||
|
||||
//Compute the hash digest
|
||||
SHA_hashByteWise(&md, msg_data, datalen, digest);
|
||||
|
||||
//
|
||||
// Initialize RSASSA-PKCS parameters
|
||||
//
|
||||
rsa_init_pvtkey(&key_pvt);
|
||||
rsa_init_pubkey(&key_pub);
|
||||
rsa_init_modulus(&modulus);
|
||||
rsa_init_modulus(&sign);
|
||||
|
||||
//
|
||||
// Set RSASSA-PKCS parameters with values from hex strings
|
||||
//
|
||||
rsa_set_pvtkey_from_hex(&key_pvt, (unsigned char*)d);
|
||||
rsa_set_pubkey_from_hex(&key_pub, (unsigned char*)e);
|
||||
rsa_set_modulus_from_hex(&modulus, (unsigned char*)n);
|
||||
|
||||
//
|
||||
// Create the hash stream from the digest data
|
||||
//
|
||||
hash = (uint16_t*)calloc(HASH_LEN,1);
|
||||
|
||||
if(!hash)
|
||||
{
|
||||
asm(" ESTOP0");
|
||||
|
||||
//hash allocation failed. Loop forever.
|
||||
while(1);
|
||||
}
|
||||
|
||||
//create a serialized uint16_t type hash based on the digest
|
||||
for (i=0; i < HASH_LEN; i++)
|
||||
{
|
||||
int index = i / (sizeof(tDigest) * 2);
|
||||
hash[i] = (uint16_t) (digest[index] >> ((sizeof(tDigest) * 16) - 8 - (8 * i))) & 0x00FF;
|
||||
}
|
||||
|
||||
//
|
||||
// Generate the signature
|
||||
//
|
||||
rsassa_pkcs1_v1_5_sign(&key_pvt, &modulus, &sign, hash, HASH_LEN);
|
||||
|
||||
//Release private Key Memory
|
||||
mp_clear(&key_pvt);
|
||||
|
||||
//
|
||||
// Convert Signature to a string
|
||||
//
|
||||
uint16_t sign_len = sign.used * 2;
|
||||
uint16_t* sign_str = (uint16_t*)malloc(sign_len);
|
||||
|
||||
if(sign_str != NULL)
|
||||
{
|
||||
rsa_signature_to_mem(&sign, sign_str, sign_len);
|
||||
|
||||
strSignature = (char*)calloc((sign_len * 2) + 1, 1);
|
||||
|
||||
for(i=0, j=0; i<sign_len; i++, j+=2)
|
||||
{
|
||||
ltoa(sign_str[i], (char*)strSignature + j, 16);
|
||||
if(strSignature[j+1] == 0x0000)
|
||||
{
|
||||
strSignature[j+1] = strSignature[j];
|
||||
strSignature[j] = '0';
|
||||
}
|
||||
}
|
||||
|
||||
free(sign_str);
|
||||
mp_clear(&sign);
|
||||
}
|
||||
|
||||
|
||||
//***************************************************
|
||||
// strSignature now holds the
|
||||
// string format of the signature.
|
||||
//***************************************************
|
||||
|
||||
|
||||
//===================================================
|
||||
// VERIFICATION OF SIGNATURE
|
||||
//===================================================
|
||||
int mod_len = strlen((char*)n) * 4;
|
||||
|
||||
rsa_Signature signVerify;
|
||||
rsa_init_modulus(&signVerify);
|
||||
rsa_set_modulus_from_hex(&signVerify, (unsigned char*)strSignature);
|
||||
|
||||
|
||||
//Free the signature mem
|
||||
free((void*)strSignature);
|
||||
|
||||
//
|
||||
//
|
||||
// Verify the generated signature
|
||||
// if verified == 1, then successful
|
||||
// if verified == 0, then signature incorrect
|
||||
// if verified == -1, then verification incomplete
|
||||
//
|
||||
rsassa_pkcs1_v1_5_verify(&signVerify, hash, HASH_LEN, mod_len, &key_pub, &modulus, &verified);
|
||||
|
||||
mp_clear(&key_pub);
|
||||
mp_clear(&modulus);
|
||||
mp_clear(&signVerify);
|
||||
|
||||
while (1);
|
||||
}
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,188 @@
|
||||
//###########################################################################
|
||||
//
|
||||
// FILE: rsassapss_ex14.c
|
||||
//
|
||||
// TITLE: RSASSA-PSS Example
|
||||
//
|
||||
//###########################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//###########################################################################
|
||||
|
||||
#include "emsa_pss.h"
|
||||
#include "rsassa_pss.h"
|
||||
#include "sha256.h"
|
||||
#include "yarrow.h"
|
||||
#include <time.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define HASH_SIZE 32
|
||||
|
||||
void runTest(void);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// SHA-256 object for hashing the message
|
||||
//
|
||||
//*****************************************************************************
|
||||
SHA256_ObjectByteWise md;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// RSA-SSA PSS Parameters
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef RSA_2048
|
||||
unsigned char n[] = "c5062b58d8539c765e1e5dbaf14cf75dd56c2e13105fecfd1a930bbb5948ff328f126abe779359ca59bca752c308d281573bc6178b6c0fef7dc445e4f826430437b9f9d790581de5749c2cb9cb26d42b2fee15b6b26f09c99670336423b86bc5bec71113157be2d944d7ff3eebffb28413143ea36755db0ae62ff5b724eecb3d316b6bac67e89cacd8171937e2ab19bd353a89acea8c36f81c89a620d5fd2effea896601c7f9daca7f033f635a3a943331d1b1b4f5288790b53af352f1121ca1bef205f40dc012c412b40bdd27585b946466d75f7ee0a7f9d549b4bece6f43ac3ee65fe7fd37123359d9f1a850ad450aaf5c94eb11dea3fc0fc6e9856b1805ef";
|
||||
unsigned char e[] = "86c94f";
|
||||
unsigned char d[] = "49e5786bb4d332f94586327bde088875379b75d128488f08e574ab4715302a87eea52d4c4a23d8b97af7944804337c5f55e16ba9ffafc0c9fd9b88eca443f39b7967170ddb8ce7ddb93c6087c8066c4a95538a441b9dc80dc9f7810054fd1e5c9d0250c978bb2d748abe1e9465d71a8165d3126dce5db2adacc003e9062ba37a54b63e5f49a4eafebd7e4bf5b0a796c2b3a950fa09c798d3fa3e86c4b62c33ba9365eda054e5fe74a41f21b595026acf1093c90a8c71722f91af1ed29a41a2449a320fc7ba3120e3e8c3e4240c04925cc698ecd66c7c906bdf240adad972b4dff4869d400b5d13e33eeba38e075e872b0ed3e91cc9c283867a4ffc3901d2069f";
|
||||
unsigned char msg[] = "dfc22604b95d15328059745c6c98eb9dfb347cf9f170aff19deeec555f22285a6706c4ecbf0fb1458c60d9bf913fbae6f4c554d245d946b4bc5f34aec2ac6be8b33dc8e0e3a9d601dfd53678f5674443f67df78a3a9e0933e5f158b169ac8d1c4cd0fb872c14ca8e001e542ea0f9cfda88c42dcad8a74097a00c22055b0bd41f";
|
||||
#endif
|
||||
|
||||
#ifdef RSA_3072
|
||||
unsigned char n[] = "a7a1882a7fb896786034d07fb1b9f6327c27bdd7ce6fe39c285ae3b6c34259adc0dc4f7b9c7dec3ca4a20d3407339eedd7a12a421da18f5954673cac2ff059156ecc73c6861ec761e6a0f2a5a033a6768c6a42d8b459e1b4932349e84efd92df59b45935f3d0e30817c66201aa99d07ae36c5d74f408d69cc08f044151ff4960e531360cb19077833adf7bce77ecfaa133c0ccc63c93b856814569e0b9884ee554061b9a20ab46c38263c094dae791aa61a17f8d16f0e85b7e5ce3b067ece89e20bc4e8f1ae814b276d234e04f4e766f501da74ea7e3817c24ea35d016676cece652b823b051625573ca92757fc720d254ecf1dcbbfd21d98307561ecaab545480c7c52ad7e9fa6b597f5fe550559c2fe923205ac1761a99737ca02d7b19822e008a8969349c87fb874c81620e38f613c8521f0381fe5ba55b74827dad3e1cf2aa29c6933629f2b286ad11be88fa6436e7e3f64a75e3595290dc0d1cd5eee7aaac54959cc53bd5a934a365e72dd81a2bd4fb9a67821bffedf2ef2bd94913de8b";
|
||||
unsigned char e[] = "1415a7";
|
||||
unsigned char d[] = "073a5fc4cd642f6113dffc4f84035cee3a2b8acc549703751a1d6a5eaa13487229a58ef7d7a522bb9f4f25510f1aa0f74c6a8fc8a5c5be8b91a674ede50e92f7e34a90a3c9da999fffb1d695e4588f451256c163484c151350cb9c7825a7d910845ee5cf826fecf9a7c0fbbbba22bb4a531c131d2e7761ba898f002ebef8ab87218511f81d3266e1ec07a7ca8622514c6dfdc86c67679a2c8f5f031de9a0c22b5a88060b46ee0c64d3b9af3c0a379bcd9c6a1b51cf6480456d3fd6def94cd2a6c171dd3f010e3c9d662bc857208248c94ebcb9fd997b9ff4a7e5fd95558569906525e741d78344f6f6cfdbd59d4faa52ee3fa964fb7cccb2d6be1935d211fe1498217716273939a946081fd8509913fd47747c5c2f03efd4d6fc9c6fcfd8402e9f40a0a5b3de3ca2b3c0fac9456938faa6cf2c20e3912e5981c9876d8ca1ff29b87a15eeae0ccce3f8a8f1e405091c083b98bcc5fe0d0deaae33c67c0394437f0eccb385b7efb17aeebba8afaecca30a2f63eac8f0ac8f1eacad85bbcaf3960b";
|
||||
unsigned char msg[] = "3b8a68da11b61b5fee1c2ca00a6aa35bbfdbdd42855b284320ec8d0c1848edcf6ac850427d8479eb57bcbe9a11771637886974bd561a5387014592cb717e8364a8183fd4ad463c89c980215ff629d867956ee5e75f71f7a19ea7bd589d7efb915d44dd9789448bc1ac32fdf7a2c911734db2dbc589a83c1a61dab6bd83907ede";
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Data structures to work with
|
||||
//
|
||||
//*****************************************************************************
|
||||
rsa_PublicKey key_pub;
|
||||
rsa_PrivateKey key_pvt;
|
||||
rsa_Modulus modulus;
|
||||
rsa_Signature sign;
|
||||
int16_t verified = -1;
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Main function
|
||||
//
|
||||
//*****************************************************************************
|
||||
void main(void)
|
||||
{
|
||||
//
|
||||
// Device initialize
|
||||
//
|
||||
Device_init();
|
||||
|
||||
uint16_t i, j;
|
||||
|
||||
//
|
||||
// Yarrow PRNG handler to generate random salt
|
||||
//
|
||||
yarrow_prng prng;
|
||||
|
||||
//
|
||||
// Initialize RSASSA-PSS parameters
|
||||
//
|
||||
rsa_init_pvtkey(&key_pvt);
|
||||
rsa_init_pubkey(&key_pub);
|
||||
rsa_init_modulus(&modulus);
|
||||
|
||||
//
|
||||
// Set RSASSA-PSS parameters with values from hex strings
|
||||
//
|
||||
rsa_set_pvtkey_from_hex(&key_pvt, d);
|
||||
rsa_set_pubkey_from_hex(&key_pub, e);
|
||||
rsa_set_modulus_from_hex(&modulus, n);
|
||||
|
||||
//
|
||||
// Place the message for which the signature has to be generated
|
||||
// in memory
|
||||
//
|
||||
uint16_t datalen = strlen((char *)msg)/2;
|
||||
uint16_t *msg_data = (uint16_t *)malloc(datalen);
|
||||
rsa_hex_to_data(msg, msg_data);
|
||||
|
||||
//
|
||||
// Hashing the message
|
||||
//
|
||||
uint32_t digest[8];
|
||||
SHA256_hashByteWise(&md, msg_data, datalen, digest);
|
||||
uint16_t hash[40];
|
||||
for (i = 0, j = 0; i < 8 && j < 32; i++)
|
||||
{
|
||||
hash[j++] = (digest[i] >> 24) & 255;
|
||||
hash[j++] = (digest[i] >> 16) & 255;
|
||||
hash[j++] = (digest[i] >> 8) & 255;
|
||||
hash[j++] = (digest[i]) & 255;
|
||||
}
|
||||
|
||||
//
|
||||
// Free the memory used up for holding the message. It is not needed anymore
|
||||
//
|
||||
free(msg_data);
|
||||
|
||||
//
|
||||
// Initialize the Yarrow PRNG handler
|
||||
//
|
||||
uc nounce[16] = {0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
|
||||
0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF};
|
||||
yarrow_init_with_nounce(&prng, nounce);
|
||||
yarrow_add_entropy("abcd", 4U, &prng);
|
||||
yarrow_ready(&prng);
|
||||
|
||||
//
|
||||
// Generate the signature
|
||||
//
|
||||
int mod_len = strlen((char *)n)*4;
|
||||
int saltlen = 20; /* Desired random salt length */
|
||||
rsassa_pss_sign(hash, HASH_SIZE, saltlen, &key_pvt, &modulus, mod_len, &prng, &sign);
|
||||
|
||||
//
|
||||
// Extract the generated signature into a byte string
|
||||
//
|
||||
uint16_t sign_len = strlen((char *)n)/2;
|
||||
uint16_t *sign_str = (uint16_t *)malloc(sign_len);
|
||||
rsa_signature_to_mem(&sign, sign_str, sign_len);
|
||||
|
||||
//
|
||||
//
|
||||
// Verify the generated signature
|
||||
// if verified == 1, then successful
|
||||
// if verified == 0, then signature incorrect
|
||||
// if verified == -1, then verification incomplete
|
||||
//
|
||||
rsassa_pss_verify(&sign, hash, HASH_SIZE, saltlen, &key_pub, &modulus, mod_len, &verified);
|
||||
|
||||
while(1);
|
||||
}
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,221 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sha_256_ex9_wordwise.c
|
||||
//
|
||||
// TITLE: SHA-256 word-wise
|
||||
//
|
||||
//! \addtogroup library_example_c28x_list
|
||||
//! <h1>SHA256 wordwise Example</h1>
|
||||
//!
|
||||
//! This example hashes message and produces message digest using SHA256
|
||||
//! algorithm by taking in the message to be hashed wordwise.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b errCountGlobal - Error Counter. It should be zero.
|
||||
//! - \b testStatusGlobal - Test status. It should be equal to PASS.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <sha256.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TEST_PASS 0xABCDABCD
|
||||
#define TEST_FAIL 0xDEADDEAD
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Global error counter & status
|
||||
//
|
||||
uint16_t errCountGlobal = 0;
|
||||
uint32_t testStatusGlobal;
|
||||
|
||||
//
|
||||
// SHA-256 word-wise handle
|
||||
//
|
||||
SHA256_ObjectWordWise SHA256_Obj;
|
||||
SHA256_HandleWordWise handle = &SHA256_Obj;
|
||||
|
||||
//
|
||||
// Structure for SHA-256 tests
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
uint16_t dataLength;
|
||||
uint32_t plainText[16];
|
||||
uint32_t digest[8];
|
||||
} testVectorSHA256;
|
||||
|
||||
|
||||
//
|
||||
// Test Cases
|
||||
//
|
||||
testVectorSHA256 testVectorSHA256Array[] =
|
||||
{
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.dataLength = 4U,
|
||||
|
||||
//
|
||||
// String "abcd"
|
||||
//
|
||||
.plainText = {0x61626364},
|
||||
|
||||
.digest = { 0x88d4266f, 0xd4e6338d, 0x13b845fc,
|
||||
0xf289579d, 0x209c8978, 0x23b9217d,
|
||||
0xa3e16193, 0x6f031589 }
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case #2
|
||||
//
|
||||
{
|
||||
.dataLength = 56U,
|
||||
|
||||
.plainText = {0x61626364, 0x62636465, 0x63646566, 0x64656667,
|
||||
0x65666768, 0x66676869, 0x6768696a, 0x68696a6b,
|
||||
0x696a6b6c, 0x6a6b6c6d, 0x6b6c6d6e, 0x6c6d6e6f,
|
||||
0x6d6e6f70, 0x6e6f7071},
|
||||
|
||||
.digest = { 0x248D6A61, 0xD20638B8, 0xE5C02693,
|
||||
0x0C3E6039, 0xA33CE459, 0x64FF2167,
|
||||
0xF6ECEDD4, 0x19DB06C1 }
|
||||
}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errCountLocal, cnt;
|
||||
uint16_t dataLength;
|
||||
uint32_t *expDigest, *plainTextArray;
|
||||
uint16_t vectorCnt;
|
||||
uint32_t digest[8];
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
|
||||
//
|
||||
// Loop through all the given vectors.
|
||||
//
|
||||
for(vectorCnt = 0;
|
||||
(vectorCnt < (sizeof(testVectorSHA256Array) /
|
||||
sizeof(testVectorSHA256Array[0]))); vectorCnt++)
|
||||
{
|
||||
//
|
||||
// Get the current vector's data members.
|
||||
//
|
||||
dataLength = testVectorSHA256Array[vectorCnt].dataLength;
|
||||
plainTextArray = testVectorSHA256Array[vectorCnt].plainText;
|
||||
expDigest = testVectorSHA256Array[vectorCnt].digest;
|
||||
|
||||
//
|
||||
// Perform SHA-256
|
||||
// Note : For wordwise implementation, dataLength should always
|
||||
// be a multiple of 4
|
||||
//
|
||||
uint16_t retval = SHA256_hashWordWise(handle,
|
||||
(uint32_t *)plainTextArray,
|
||||
dataLength, digest);
|
||||
|
||||
//
|
||||
// Check the results
|
||||
//
|
||||
for(cnt = 0; cnt < 8U; cnt++)
|
||||
{
|
||||
if(digest[cnt] != expDigest[cnt])
|
||||
{
|
||||
errCountLocal++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update the global error counter.
|
||||
//
|
||||
if(errCountLocal > 0)
|
||||
{
|
||||
errCountGlobal++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the local error counter.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Update test status variable
|
||||
//
|
||||
if(errCountGlobal == 0)
|
||||
{
|
||||
testStatusGlobal = TEST_PASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
testStatusGlobal = TEST_FAIL;
|
||||
}
|
||||
|
||||
//
|
||||
// Infinite Loop to keep the core running
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,214 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sha_256_ex9_bytewise.c
|
||||
//
|
||||
// TITLE: SHA-256 bytewise
|
||||
//
|
||||
//! \addtogroup library_example_c28x_list
|
||||
//! <h1>SHA256 bytewise Example</h1>
|
||||
//!
|
||||
//! This example hashes message and produces message digest using SHA256
|
||||
//! algorithm by taking in the message to be hashed bytewise.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b errCountGlobal - Error Counter. It should be zero.
|
||||
//! - \b testStatusGlobal - Test status. It should be equal to PASS.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <sha256.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TEST_PASS 0xABCDABCD
|
||||
#define TEST_FAIL 0xDEADDEAD
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Global error counter & status
|
||||
//
|
||||
uint16_t errCountGlobal = 0;
|
||||
uint32_t testStatusGlobal;
|
||||
|
||||
//
|
||||
// SHA-256 byte-wise handle
|
||||
//
|
||||
SHA256_ObjectByteWise SHA256_Obj;
|
||||
SHA256_HandleByteWise handle = &SHA256_Obj;
|
||||
|
||||
//
|
||||
// Structure for SHA-256 tests
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
uint16_t dataLength;
|
||||
char plainText[64];
|
||||
uint32_t digest[8];
|
||||
} testVectorSHA256;
|
||||
|
||||
|
||||
//
|
||||
// Test Cases
|
||||
//
|
||||
testVectorSHA256 testVectorSHA256Array[] =
|
||||
{
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.dataLength = 3U,
|
||||
|
||||
.plainText = "abc",
|
||||
|
||||
.digest = { 0xBA7816BF, 0x8F01CFEA, 0x414140DE,
|
||||
0x5DAE2223, 0xB00361A3, 0x96177A9C,
|
||||
0xB410FF61, 0xF20015AD }
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case #2
|
||||
//
|
||||
{
|
||||
.dataLength = 56U,
|
||||
|
||||
.plainText = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
|
||||
|
||||
.digest = { 0x248D6A61, 0xD20638B8, 0xE5C02693,
|
||||
0x0C3E6039, 0xA33CE459, 0x64FF2167,
|
||||
0xF6ECEDD4, 0x19DB06C1 }
|
||||
}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errCountLocal, cnt;
|
||||
uint16_t dataLength;
|
||||
uint32_t *expDigest;
|
||||
char *plainTextArray;
|
||||
uint16_t vectorCnt;
|
||||
uint32_t digest[8];
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
|
||||
//
|
||||
// Loop through all the given vectors.
|
||||
//
|
||||
for(vectorCnt = 0;
|
||||
(vectorCnt < (sizeof(testVectorSHA256Array) /
|
||||
sizeof(testVectorSHA256Array[0]))); vectorCnt++)
|
||||
{
|
||||
//
|
||||
// Get the current vector's data members.
|
||||
//
|
||||
dataLength = testVectorSHA256Array[vectorCnt].dataLength;
|
||||
plainTextArray = testVectorSHA256Array[vectorCnt].plainText;
|
||||
expDigest = testVectorSHA256Array[vectorCnt].digest;
|
||||
|
||||
//
|
||||
// Perform SHA-256
|
||||
//
|
||||
uint16_t retval = SHA256_hashByteWise(handle,
|
||||
(uint16_t *)plainTextArray,
|
||||
dataLength, digest);
|
||||
|
||||
//
|
||||
// Check the results
|
||||
//
|
||||
for(cnt = 0; cnt < 8U; cnt++)
|
||||
{
|
||||
if(digest[cnt] != expDigest[cnt])
|
||||
{
|
||||
errCountLocal++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update the global error counter.
|
||||
//
|
||||
if(errCountLocal > 0)
|
||||
{
|
||||
errCountGlobal++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the local error counter.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Update test status variable
|
||||
//
|
||||
if(errCountGlobal == 0)
|
||||
{
|
||||
testStatusGlobal = TEST_PASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
testStatusGlobal = TEST_FAIL;
|
||||
}
|
||||
|
||||
//
|
||||
// Infinite Loop to keep the core running
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,227 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sha_384_ex12_bytewise.c
|
||||
//
|
||||
// TITLE: SHA-384 bytewise
|
||||
//
|
||||
//! \addtogroup library_example_c28x_list
|
||||
//! <h1>SHA384 bytewise Example</h1>
|
||||
//!
|
||||
//! This example hashes message and produces message digest using SHA384
|
||||
//! algorithm by taking in the message to be hashed bytewise.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b errCountGlobal - Error Counter. It should be zero.
|
||||
//! - \b testStatusGlobal - Test status. It should be equal to PASS.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <sha384.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TEST_PASS 0xABCDABCD
|
||||
#define TEST_FAIL 0xDEADDEAD
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Global error counter & status
|
||||
//
|
||||
uint16_t errCountGlobal = 0;
|
||||
uint32_t testStatusGlobal;
|
||||
|
||||
//
|
||||
// SHA-384 byte-wise handle
|
||||
//
|
||||
SHA384_ObjectByteWise SHA384_Obj;
|
||||
SHA384_HandleByteWise handle = &SHA384_Obj;
|
||||
|
||||
//
|
||||
// Structure for SHA-384 tests
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
uint16_t dataLength;
|
||||
char plainText[128];
|
||||
uint64_t digest[6];
|
||||
} testVectorSHA384;
|
||||
|
||||
|
||||
//
|
||||
// Test Cases
|
||||
//
|
||||
testVectorSHA384 testVectorSHA384Array[] =
|
||||
{
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.dataLength = 3U,
|
||||
|
||||
.plainText = "abc",
|
||||
|
||||
.digest = {0xCB00753F45A35E8B, 0xB5A03D699AC65007, 0x272C32AB0EDED163,
|
||||
0x1A8B605A43FF5BED, 0x8086072BA1E7CC23, 0x58BAECA134C825A7}
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case #2
|
||||
//
|
||||
{
|
||||
.dataLength = 128U,
|
||||
|
||||
.plainText = { 0x3b, 0xf5, 0x2c, 0xc5, 0xee, 0x86, 0xb9, 0xa0,
|
||||
0x19, 0x0f, 0x39, 0x0a, 0x5c, 0x03, 0x66, 0xa5,
|
||||
0x60, 0xb5, 0x57, 0x00, 0x0d, 0xbe, 0x51, 0x15,
|
||||
0xfd, 0x9e, 0xe1, 0x16, 0x30, 0xa6, 0x27, 0x69,
|
||||
0x01, 0x15, 0x75, 0xf1, 0x58, 0x81, 0x19, 0x8f,
|
||||
0x22, 0x78, 0x76, 0xe8, 0xfe, 0x68, 0x5a, 0x69,
|
||||
0x39, 0xbc, 0x8b, 0x89, 0xfd, 0x48, 0xa3, 0x4e,
|
||||
0xc5, 0xe7, 0x1e, 0x13, 0x14, 0x62, 0xb2, 0x88,
|
||||
0x67, 0x94, 0xdf, 0xfa, 0x68, 0xcc, 0xc6, 0xd5,
|
||||
0x64, 0x73, 0x3e, 0x67, 0xff, 0xef, 0x25, 0xe6,
|
||||
0x27, 0xc6, 0xf4, 0xb5, 0x46, 0x07, 0x96, 0xe3,
|
||||
0xbc, 0xe6, 0x7b, 0xf5, 0x8c, 0xa6, 0xe8, 0xe5,
|
||||
0x55, 0xbc, 0x91, 0x6a, 0x85, 0x31, 0x69, 0x7a,
|
||||
0xc9, 0x48, 0xb9, 0x0d, 0xc8, 0x61, 0x6f, 0x25,
|
||||
0x10, 0x1d, 0xb9, 0x0b, 0x50, 0xc3, 0xd3, 0xdb,
|
||||
0xc9, 0xe2, 0x1e, 0x42, 0xff, 0x38, 0x71, 0x87 },
|
||||
|
||||
.digest = { 0x12b6cb35eda92ee3, 0x7356ddee77781a17, 0xb3d90e563824a984,
|
||||
0xfaffc6fdd1693bd7, 0x626039635563cfc3, 0xb9a2b00f9c65eefd }
|
||||
}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errCountLocal, cnt;
|
||||
uint16_t dataLength;
|
||||
uint64_t *expDigest;
|
||||
uint16_t *plainTextArray;
|
||||
uint16_t vectorCnt;
|
||||
uint64_t digest[6];
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
|
||||
//
|
||||
// Loop through all the given vectors.
|
||||
//
|
||||
for(vectorCnt = 0;
|
||||
(vectorCnt < (sizeof(testVectorSHA384Array) /
|
||||
sizeof(testVectorSHA384Array[0]))); vectorCnt++)
|
||||
{
|
||||
//
|
||||
// Get the current vector's data members.
|
||||
//
|
||||
dataLength = testVectorSHA384Array[vectorCnt].dataLength;
|
||||
plainTextArray = (uint16_t *)testVectorSHA384Array[vectorCnt].plainText;
|
||||
expDigest = testVectorSHA384Array[vectorCnt].digest;
|
||||
|
||||
//
|
||||
// Perform SHA-384
|
||||
//
|
||||
uint16_t retval = SHA384_hashByteWise(handle,
|
||||
(uint16_t *)plainTextArray,
|
||||
dataLength, digest);
|
||||
|
||||
//
|
||||
// Check the results
|
||||
//
|
||||
for(cnt = 0; cnt < 6U; cnt++)
|
||||
{
|
||||
if(digest[cnt] != expDigest[cnt])
|
||||
{
|
||||
errCountLocal++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update the global error counter.
|
||||
//
|
||||
if(errCountLocal > 0)
|
||||
{
|
||||
errCountGlobal++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the local error counter.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Update test status variable
|
||||
//
|
||||
if(errCountGlobal == 0)
|
||||
{
|
||||
testStatusGlobal = TEST_PASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
testStatusGlobal = TEST_FAIL;
|
||||
}
|
||||
|
||||
//
|
||||
// Infinite Loop to keep the core running
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
@@ -0,0 +1,232 @@
|
||||
//#############################################################################
|
||||
//
|
||||
// FILE: sha_384_ex13_wordwise.c
|
||||
//
|
||||
// TITLE: SHA-384 word-wise
|
||||
//
|
||||
//! \addtogroup library_example_c28x_list
|
||||
//! <h1>SHA384 wordwise Example</h1>
|
||||
//!
|
||||
//! This example hashes message and produces message digest using SHA384
|
||||
//! algorithm by taking in the message to be hashed wordwise.
|
||||
//!
|
||||
//! \b External \b Connections \n
|
||||
//! - None
|
||||
//!
|
||||
//! \b Watch \b Variables \n
|
||||
//! - \b errCountGlobal - Error Counter. It should be zero.
|
||||
//! - \b testStatusGlobal - Test status. It should be equal to PASS.
|
||||
//!
|
||||
//
|
||||
//#############################################################################
|
||||
// $Copyright:
|
||||
// Copyright (C) 2024 Texas Instruments Incorporated - http://www.ti.com/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
//
|
||||
// Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
//
|
||||
// Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||
// its contributors may be used to endorse or promote products derived
|
||||
// from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// $
|
||||
//#############################################################################
|
||||
|
||||
//
|
||||
// Included Files
|
||||
//
|
||||
#include <sha384.h>
|
||||
#include "driverlib.h"
|
||||
#include "device.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
//
|
||||
#define TEST_PASS 0xABCDABCD
|
||||
#define TEST_FAIL 0xDEADDEAD
|
||||
|
||||
//
|
||||
// Global Variables
|
||||
//
|
||||
|
||||
//
|
||||
// Global error counter & status
|
||||
//
|
||||
uint16_t errCountGlobal = 0;
|
||||
uint32_t testStatusGlobal;
|
||||
|
||||
//
|
||||
// SHA-384 word-wise handle
|
||||
//
|
||||
SHA384_ObjectWordWise SHA384_Obj;
|
||||
SHA384_HandleWordWise handle = &SHA384_Obj;
|
||||
|
||||
//
|
||||
// Structure for SHA-384 tests
|
||||
//
|
||||
typedef struct
|
||||
{
|
||||
uint16_t dataLength;
|
||||
uint32_t plainText[32];
|
||||
uint64_t digest[6];
|
||||
} testVectorSHA384;
|
||||
|
||||
|
||||
//
|
||||
// Test Cases
|
||||
//
|
||||
testVectorSHA384 testVectorSHA384Array[] =
|
||||
{
|
||||
//
|
||||
// Test Case #1
|
||||
//
|
||||
{
|
||||
.dataLength = 4U,
|
||||
|
||||
//
|
||||
// String "abcd"
|
||||
//
|
||||
.plainText = {0x61626364},
|
||||
|
||||
.digest = {0x1165b3406ff0b52a, 0x3d24721f785462ca, 0x2276c9f454a116c2,
|
||||
0xb2ba20171a7905ea, 0x5a026682eb659c4d, 0x5f115c363aa3c79b}
|
||||
},
|
||||
|
||||
//
|
||||
// Test Case #2
|
||||
//
|
||||
{
|
||||
.dataLength = 128U,
|
||||
|
||||
.plainText = { 0x3bf52cc5, 0xee86b9a0,
|
||||
0x190f390a, 0x5c0366a5,
|
||||
0x60b55700, 0x0dbe5115,
|
||||
0xfd9ee116, 0x30a62769,
|
||||
0x011575f1, 0x5881198f,
|
||||
0x227876e8, 0xfe685a69,
|
||||
0x39bc8b89, 0xfd48a34e,
|
||||
0xc5e71e13, 0x1462b288,
|
||||
0x6794dffa, 0x68ccc6d5,
|
||||
0x64733e67, 0xffef25e6,
|
||||
0x27c6f4b5, 0x460796e3,
|
||||
0xbce67bf5, 0x8ca6e8e5,
|
||||
0x55bc916a, 0x8531697a,
|
||||
0xc948b90d, 0xc8616f25,
|
||||
0x101db90b, 0x50c3d3db,
|
||||
0xc9e21e42, 0xff387187 },
|
||||
|
||||
.digest = { 0x12b6cb35eda92ee3, 0x7356ddee77781a17, 0xb3d90e563824a984,
|
||||
0xfaffc6fdd1693bd7, 0x626039635563cfc3, 0xb9a2b00f9c65eefd}
|
||||
}
|
||||
};
|
||||
|
||||
void main(void)
|
||||
{
|
||||
uint16_t errCountLocal, cnt;
|
||||
uint16_t dataLength;
|
||||
uint64_t *expDigest;
|
||||
uint32_t *plainTextArray;
|
||||
uint16_t vectorCnt;
|
||||
uint64_t digest[6];
|
||||
|
||||
//
|
||||
// Initialize device clock and peripherals
|
||||
//
|
||||
Device_init();
|
||||
|
||||
//
|
||||
// Initialize local variables.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
|
||||
//
|
||||
// Loop through all the given vectors.
|
||||
//
|
||||
for(vectorCnt = 0;
|
||||
(vectorCnt < (sizeof(testVectorSHA384Array) /
|
||||
sizeof(testVectorSHA384Array[0]))); vectorCnt++)
|
||||
{
|
||||
//
|
||||
// Get the current vector's data members.
|
||||
//
|
||||
dataLength = testVectorSHA384Array[vectorCnt].dataLength;
|
||||
plainTextArray = testVectorSHA384Array[vectorCnt].plainText;
|
||||
expDigest = testVectorSHA384Array[vectorCnt].digest;
|
||||
|
||||
//
|
||||
// Perform SHA-384
|
||||
// Note : For wordwise implementation, dataLength should always
|
||||
// be a multiple of 4
|
||||
//
|
||||
uint16_t retval = SHA384_hashWordWise(handle,
|
||||
(uint32_t *)plainTextArray,
|
||||
dataLength, digest);
|
||||
|
||||
//
|
||||
// Check the results
|
||||
//
|
||||
for(cnt = 0; cnt < 6U; cnt++)
|
||||
{
|
||||
if(digest[cnt] != expDigest[cnt])
|
||||
{
|
||||
errCountLocal++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Update the global error counter.
|
||||
//
|
||||
if(errCountLocal > 0)
|
||||
{
|
||||
errCountGlobal++;
|
||||
}
|
||||
|
||||
//
|
||||
// Clear the local error counter.
|
||||
//
|
||||
errCountLocal = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Update test status variable
|
||||
//
|
||||
if(errCountGlobal == 0)
|
||||
{
|
||||
testStatusGlobal = TEST_PASS;
|
||||
}
|
||||
else
|
||||
{
|
||||
testStatusGlobal = TEST_FAIL;
|
||||
}
|
||||
|
||||
//
|
||||
// Infinite Loop to keep the core running
|
||||
//
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End of file
|
||||
//
|
||||
Reference in new issue
Block a user