No description
Find a file
Faure Paul dd7370c784 Clean
2022-06-27 21:48:52 +02:00
Compilateur@3a897af896 Clean 2022-06-27 21:48:52 +02:00
CrossAssembleur@475fb8dbba Ajout ecran, clavier, chaine de caractères, reste a tester et a faire la version non securisée 2021-07-13 17:27:44 +02:00
Interpreteur@25efac091c Clean 2022-06-27 21:48:52 +02:00
InterpreteurRegistres@510d9c2d6c Clean 2022-06-27 21:48:52 +02:00
Processeur@e46d1700b3 Clean 2022-06-27 21:48:52 +02:00
.gitignore Makefile global + clean CA + clean Proc 2021-06-10 18:42:10 +02:00
.gitmodules Version fonctionnelle processeur sécurisé 2021-06-21 14:09:37 +02:00
Makefile Clean 2022-06-27 21:48:52 +02:00
prog_vulnerable.c Clean 2022-06-27 21:48:52 +02:00
ReadMe.md Clean 2022-06-27 21:48:52 +02:00

Secured processor

This repository gathers the different components allowing to execute a program written in a language derived from C on a processor secured against the hijacking of the execution flow by buffer overflow.

The built and execution process is divided into 5 steps, 3 mandatory and 2 optional.

  • Build the program thanks to the Compilateur module, this will generate a first assembly code without registers.
  • Optional: Interpret this assembly code with the Interpreteur module to check the behaviour of the program.
  • Add registers management into the assembly code with the CrossAssembleur module.
  • Optional: Interpret this assembly code with the InterpreteurRegistres module to check the behaviour of the program
  • Run the program into the processor designed in VHDL

Technologies :

- Development OS : Ubuntu 20.04.4 LTS

- Compilateur (Compiler) : Lex Yacc (flex et bison), C (gcc), Makefile (make)
- Interpreteur (Interpreter) : Lex Yacc (flex et bison), C (gcc), Makefile (make)
- CrossAssembleur (CrossAssembler) : Lex Yacc (flex et bison), C (gcc), Makefile (make)
- InterpreteurRegistres (InterpreterRegisters) : Lex Yacc (flex et bison), C (gcc), Makefile (make)
- Processeur (Processor) : Digilent FPGA Basys3 Artix7, Vivado (2018.2)

Key words :

Security, Secured, BufferOverflow, BOF, Processor, Compiler, FPGA; Basys3.

Usage

To clone the project including submodules, use:

git clone --recurse-submodules https://git.etud.insa-toulouse.fr/pfaure/PSI.git

If you have cloned the repository in the "classic" way, to download submodules use:

git submodule init
git submodule update

A Makefile has been included to simplify build and usage of the project.

Versions

Please note that there are two versions of the project, one with the security implemented, and one without. Be careful to have all modules in the same version. The best way is to use the following commands to change the version:

make secure

or

make unsecure

Building the project

Building the whole project at once:

make build WHAT="all"

Building compiler only:

make build WHAT="compilater"

Building interpreter only:

make build WHAT="interpreter"

Building CrossAssembler only:

make compile WHAT="cross_assembler"

Building interpreter registers only:

make build WHAT="interpreter_registers"

Using the project

Build, crossassemble and load program at once:

make exec WHAT="all" SOURCE="program_file_without_extension"

This will build program_file_without_extension.c, generate the assembly and binary files, and modify the processor code to load the program. (Does not perform the optional steps)

Build program only:

make exec WHAT="compile" SOURCE="program_file_without_extension"

This will build program_file_without_extension.c and generate the memory-oriented assembly file prefixe_file.memasm

Interpret a memory-oriented assembly program:

make exec WHAT="interprete" SOURCE="program_file_without_extension"

This will interpret the program_file_without_extension.memasm

CrossAssemble a memory-oriented assembly program:

make exec WHAT="cross_assemble" SOURCE="program_file_without_extension"

This will transform program_file_without_extension.memasm into program_file_without_extension.regasm adding registers management

Interpret a registers-oriented assembly program:

make exec WHAT="interprete_registers" SOURCE="program_file_without_extension"

This will interpret the program_file_without_extension.regasm

Load binary program into the processor:

make exec WHAT="load" SOURCE="program_file_without_extension"

This will add binary file program_file_without_extension.bin into the processor's instructions memory