SeseLab: a software platform for teaching physical attacks
Project description
SeseLab: a software platform for teaching physical attacks
Anyone following computer security related news will agree that it is important to teach a minimum of security to computer science students, and that at least the existence of side channel attacks is part of this strict minimum that they should be aware of.
The toolset required for carrying out a side channel attack is costly and bulky, and its usage requires specific training that most computer science student do not have.
SeseLab is a software platform that can be used in any computer room where Python 3 is installed. It allows students to simulate physical attacks (e.g., Simple Power Analysis and BellCoRe) on cryptographic implementations.
For that it simulates a simple CPU (e.g., there is no cache) that uses a simplified assembly language which can be learned and used over the course of a lab session.
It comes with a bignum library written in this assembly language which can be used to implement cryptographic primitive such as a square-and-multiply algorithm for modular exponentiation.
Installation
You can either install SeseLab from PyPI using pip with the following command:
$ pip3 install seselab
Or you can download its source code and run the following command in the root directory of the repository:
$ pip3 install .
Usage
You can call the seselab
tool either directly or with python3 -m seselab
.
SeseLab assembly language
An 8-bits Harvard architecture is simulated.
There are 32 registers and 1M memory cells.
Register 31 is used for return address, and register 30 is used for stack pointer.
There are 25 instructions:
nop
: does nothing;mov dst val
: copies the value ofval
indst
;not dst val
: writes the bitwise negation ofval
indst
;and dst val1 val2
: writes the bitwise logical and ofval1
andval2
indst
;orr dst val1 val2
: writes the bitwise logical or ofval1
andval2
indst
;xor dst val1 val2
: writes the bitwise exclusive or ofval1
andval2
indst
;lsl dst val1 val2
: writesval1
shifted byval2
bits to the left indst
;lsr dst val1 val2
: writesval1
shifted byval2
bits to the right indst
;min dst val1 val2
: writes the smallest ofval1
andval2
indst
;max dst val1 val2
: writes the bigest ofval1
andval2
indst
;add dst val1 val2
: writes the sum ofval1
andval2
indst
;sub dst val1 val2
: writes the difference ofval1
andval2
indst
;mul dst val1 val2
: writes the product ofval1
andval2
indst
;div dst val1 val2
: writes the quotient ofval1
devided byval2
indst
;mod dst val1 val2
: writes the remainder ofval1
devided byval2
indst
;ret
: jumps to the instruction pointed to by registerr31
;cal addr
: write next instruction index inr31
then jumps toaddr
;cmp dst val1 val2
: writes 1 indst
ifval1
<val2
, -1 ifval1
>val2
, 0 otherwise;jmp addr
: jumps toaddr
beq addr val1 val2
: jumps toaddr
ifval1
=val2
;bne addr val1 val2
: jumps toaddr
ifval1
≠val2
;prn val
: prints the decimal value ofval
;prx val
: prints the hexadecimal value ofval
;prc val
: prints the ASCII character of valueval
;prs addr val
: prints the string starting at addressaddr
and of lengthval
.
The values (val
, val1
, val2
) are either :
- an immediate value, written
#N
:#13
,#42
,#51
, etc. ; - a register, written
rN
:r0
,r1
, …,r31
; - a memory cell, written
@N
: (@0
,@1
, etc. ; - a dereferenced pointer, written
!val
:!r2
,!@100
, etc. (note that!#93
is the same as@93
) ; - this last notation also accept an offset, written after a comma:
!r12,\#-3
,!r12,r2
, etc.
Valid destinations (dst
) are writable values, i.e., any of the above except for immediate values.
Adresses (addr
) are given either as values in which case they correspond to the instruction index in the code, or as a label.
Labels can be defined anywhere using the label:
syntax and their value is the index of the instruction that immidiately follow them.
There are two additional instructions:
.use bignum
which loads the packaged bignum library;.include file.asm
which loadsfile.asm
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file seselab-0.1.tar.gz
.
File metadata
- Download URL: seselab-0.1.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e595dac99ceb8f80a6c4c29015ddda06335c4d9c5be0c2b34ece1d42c77ba127 |
|
MD5 | 36a333053a7a7867294be24490c0847b |
|
BLAKE2b-256 | 0ec0590957808786e0fbf6c3d0debc0fadf63bb005dec3c82b46c0ee69f2276c |
File details
Details for the file seselab-0.1-py3-none-any.whl
.
File metadata
- Download URL: seselab-0.1-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e7f60f82daaa8b0578a9e2a3a0e25ed030773eb1343bc2d055292f3e9f92f6b |
|
MD5 | ff6e5cee6733375857f7cd41c9ae99a0 |
|
BLAKE2b-256 | ed0997cfd31395375f2feb1d1cf9437dc6a8bf8979d7f100da853eaaf5c97573 |