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 students 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.
To achieve this goal, SeseLab 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.
SeseLab is distributed 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 ofvalindst;not dst val: writes the bitwise negation ofvalindst;and dst val1 val2: writes the bitwise logical and ofval1andval2indst;orr dst val1 val2: writes the bitwise logical or ofval1andval2indst;xor dst val1 val2: writes the bitwise exclusive or ofval1andval2indst;lsl dst val1 val2: writesval1shifted byval2bits to the left indst;lsr dst val1 val2: writesval1shifted byval2bits to the right indst;min dst val1 val2: writes the smallest ofval1andval2indst;max dst val1 val2: writes the bigest ofval1andval2indst;add dst val1 val2: writes the sum ofval1andval2indst;sub dst val1 val2: writes the difference ofval1andval2indst;mul dst val1 val2: writes the product ofval1andval2indst;div dst val1 val2: writes the quotient ofval1devided byval2indst;mod dst val1 val2: writes the remainder ofval1devided byval2indst;ret: jumps to the instruction pointed to by registerr31;cal addr: write next instruction index inr31then jumps toaddr;cmp dst val1 val2: writes 1 indstifval1<val2, -1 ifval1>val2, 0 otherwise;jmp addr: jumps toaddrbeq addr val1 val2: jumps toaddrifval1=val2;bne addr val1 val2: jumps toaddrifval1≠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 addressaddrand 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!#93is 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.
An adress (addr) is either a value, in which case it corresponds 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 immediately follows the label definition.
There are two additional instructions:
.use bignumwhich loads the packaged bignum library;.include file.asmwhich loadsfile.asm.
Metadata
Release files for seselab 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| seselab-0.1.2.tar.gz | 11.4 kB | Without provenance | Details |
Release files / seselab-0.1.2.tar.gz
| Download URL | seselab-0.1.2.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4938d24799757eb86cb76c59efc7e2d52aea4bc9ca06b7deca8a80b36097e937
|
|
BLAKE2b-256 checksum How to use checksums |
1703bd440b70a3863cd942aecfc92e5969c51f277d7b96eda98cc521f29e81f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for seselab 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.