-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replicate files from enterprise repo
- Loading branch information
1 parent
2a620ef
commit 4ff16f8
Showing
721 changed files
with
212,339 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
/* | ||
* University of Bristol – Open Access Software Licence | ||
* Copyright (c) 2016, The University of Bristol, a chartered | ||
* corporation having Royal Charter number RC000648 and a charity | ||
* (number X1121) and its place of administration being at Senate | ||
* House, Tyndall Avenue, Bristol, BS8 1TH, United Kingdom. | ||
* All rights reserved | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* | ||
* 2. 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. | ||
* | ||
* 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 HOLDER 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. | ||
* | ||
* Any use of the software for scientific publications or commercial | ||
* purposes should be reported to the University of Bristol | ||
* (OSI-notifications@bristol.ac.uk and quote reference 2668). This is | ||
* for impact and usage monitoring purposes only. | ||
* | ||
* Enquiries about further applications and development opportunities | ||
* are welcome. Please contact elisabeth.oswald@bristol.ac.uk | ||
*/ | ||
/* | ||
* This file was based on files that are part of the libopencm3 project. | ||
* See below for licecning information. | ||
* | ||
* Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de> | ||
* Copyright (C) 2011 Stephen Caudle <scaudle@doceme.com> | ||
* | ||
* This library is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/* Linker script for ST STM32F0DISCOVERY (STM32F051R8T6, 64K flash, 8K RAM). */ | ||
|
||
/* Define memory regions. */ | ||
MEMORY | ||
{ | ||
rom (rx) : ORIGIN = 0x08000000, LENGTH = 64K | ||
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 8K | ||
} | ||
|
||
/* Generic linker script for STM32 targets using libopencm3. */ | ||
|
||
/* Memory regions must be defined in the ld script which includes this one. */ | ||
|
||
/* Enforce emmition of the vector table. */ | ||
EXTERN (vector_table) | ||
|
||
/* Define the entry point of the output file. */ | ||
ENTRY(reset_handler) | ||
|
||
/* Define sections. */ | ||
SECTIONS | ||
{ | ||
.text : { | ||
*(.vectors) /* Vector table */ | ||
*(.text*) /* Program code */ | ||
. = ALIGN(4); | ||
*(.rodata*) /* Read-only data */ | ||
. = ALIGN(4); | ||
} >rom | ||
|
||
/* C++ Static constructors/destructors, also used for __attribute__ | ||
* ((constructor)) and the likes */ | ||
.preinit_array : { | ||
. = ALIGN(4); | ||
__preinit_array_start = .; | ||
KEEP (*(.preinit_array)) | ||
__preinit_array_end = .; | ||
} >rom | ||
.init_array : { | ||
. = ALIGN(4); | ||
__init_array_start = .; | ||
KEEP (*(SORT(.init_array.*))) | ||
KEEP (*(.init_array)) | ||
__init_array_end = .; | ||
} >rom | ||
.fini_array : { | ||
. = ALIGN(4); | ||
__fini_array_start = .; | ||
KEEP (*(.fini_array)) | ||
KEEP (*(SORT(.fini_array.*))) | ||
__fini_array_end = .; | ||
} >rom | ||
|
||
/* | ||
* Another section used by C++ stuff, appears when using newlib with | ||
* 64bit (long long) printf support | ||
*/ | ||
.ARM.extab : { | ||
*(.ARM.extab*) | ||
} >rom | ||
.ARM.exidx : { | ||
__exidx_start = .; | ||
*(.ARM.exidx*) | ||
__exidx_end = .; | ||
} >rom | ||
|
||
. = ALIGN(4); | ||
_etext = .; | ||
|
||
.data : { | ||
_data = .; | ||
*(.data*) /* Read-write initialized data */ | ||
. = ALIGN(4); | ||
_edata = .; | ||
} >ram AT >rom | ||
_data_loadaddr = LOADADDR(.data); | ||
|
||
.bss : { | ||
*(.bss*) /* Read-write zero initialized data */ | ||
*(COMMON) | ||
. = ALIGN(4); | ||
_ebss = .; | ||
} >ram | ||
|
||
/* | ||
* The .eh_frame section appears to be used for C++ exception handling. | ||
* You may need to fix this if you're using C++. | ||
*/ | ||
/DISCARD/ : { *(.eh_frame) } | ||
|
||
. = ALIGN(4); | ||
end = .; | ||
} | ||
|
||
PROVIDE(_stack = ORIGIN(ram) + LENGTH(ram)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* | ||
This file is part of the ChipWhisperer Example Targets | ||
Copyright (C) 2012-2015 NewAE Technology Inc. | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "hal.h" | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
|
||
#define IDLE 0 | ||
#define KEY 1 | ||
#define PLAIN 2 | ||
|
||
#define BUFLEN 64 | ||
|
||
uint8_t memory[BUFLEN]; | ||
uint8_t tmp[BUFLEN]; | ||
char asciibuf[BUFLEN]; | ||
uint8_t pt[16]; | ||
|
||
static void delay_2_ms(void); | ||
|
||
|
||
void my_puts(char *c) | ||
{ | ||
do { | ||
putch(*c); | ||
|
||
} while (*++c); | ||
} | ||
|
||
static void delay_2_ms() | ||
{ | ||
for (volatile unsigned int i=0; i < 0xfff; i++ ){ | ||
; | ||
} | ||
} | ||
|
||
void my_read(char *buf, int len) | ||
{ | ||
for(int i = 0; i < len; i++) { | ||
while (buf[i] = getch(), buf[i] == '\0'); | ||
|
||
if (buf[i] == '\n') { | ||
buf[i] = '\0'; | ||
return; | ||
} | ||
} | ||
buf[len - 1] = '\0'; | ||
} | ||
|
||
int main(void) | ||
{ | ||
platform_init(); | ||
init_uart(); | ||
trigger_setup(); | ||
|
||
char passwd[32]; | ||
char correct_passwd[] = "h0px3"; | ||
|
||
while(1){ | ||
|
||
my_puts("*****Safe-o-matic 3000 Booting...\n"); | ||
//Print some fancy-sounding stuff so that attackers | ||
//will get scared and leave us alone | ||
my_puts("Aligning bits........[DONE]\n"); | ||
delay_2_ms(); | ||
my_puts("Checking Cesium RNG..[DONE]\n"); | ||
delay_2_ms(); | ||
my_puts("Masquerading flash...[DONE]\n"); | ||
delay_2_ms(); | ||
my_puts("Decrypting database..[DONE]\n"); | ||
delay_2_ms(); | ||
my_puts("\n\n"); | ||
|
||
//Give them one last warning | ||
my_puts("WARNING: UNAUTHORIZED ACCESS WILL BE PUNISHED\n"); | ||
|
||
trigger_low(); | ||
|
||
//Get password | ||
my_puts("Please enter password to continue: "); | ||
my_read(passwd, 32); | ||
|
||
uint8_t passbad = 0; | ||
|
||
trigger_high(); | ||
|
||
for(uint8_t i = 0; i < sizeof(correct_passwd); i++){ | ||
if (correct_passwd[i] != passwd[i]){ | ||
passbad = 1; | ||
break; | ||
} | ||
} | ||
|
||
if (passbad){ | ||
//Stop them fancy timing attacks | ||
int wait = rand() % 100000; //% 100000 can be removed for xmega | ||
for(volatile int i = 0; i < wait; i++){ | ||
; | ||
} | ||
delay_2_ms(); | ||
delay_2_ms(); | ||
my_puts("PASSWORD FAIL\n"); | ||
led_error(1); | ||
} else { | ||
my_puts("Access granted, Welcome!\n"); | ||
led_ok(1); | ||
} | ||
|
||
//All done; | ||
while(1); | ||
} | ||
|
||
return 1; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"_comment": "shiftrows.c", | ||
"c_tmpl_files": | ||
[ | ||
"simple.c" | ||
], | ||
"c_files" : | ||
[ | ||
"main.c", "byte_mask_aes.c", "random.c", "rosita_vars.c" | ||
], | ||
"asm_files" : | ||
[ | ||
|
||
], | ||
"cxx_files" : | ||
[ | ||
|
||
], | ||
"obj_files" : | ||
[ | ||
"vector.o", "elmoasmfunctions.o" | ||
], | ||
"reserve_register" : "r7", | ||
"reserve_register_in_files" : | ||
[ | ||
], | ||
"reserve_register_cflags" : "-ffixed-r7", | ||
"cflags" : " -g -Os -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -MD -Wall -Wundef -mthumb -mcpu=cortex-m0 -msoft-float -masm-syntax-unified -ffixed-r7 -c $file", | ||
"reserve_register_cxxflags" : "-ffixed-r7", | ||
"cxxflags" : "", | ||
"ldflags" : "--static -nostartfiles -TMBedAES.ld -Wl,-Map=.map -Wl,--gc-sections -mthumb -mcpu=cortex-m0 -msoft-float $files -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group" | ||
} |
Oops, something went wrong.