pyecsca [pɪɛtska]¶
Python Elliptic Curve cryptography Side-Channel Analysis toolkit.
pyecsca aims to fill a gap in SCA tooling for Elliptic Curve Cryptography, it focuses on black-box implementations of ECC and presents a way to extract implementation information about a black-box implementation of ECC through side-channels. The main goal of pyecsca is to be able to reverse engineer the curve model, coordinate system, addition formulas, scalar multiplier and even finite-field implementation details.
It currently provides:
Enumeration of millions of possible ECC implementation configurations (see Configuration space)
Simulation and execution tracing of key generation, ECDH and ECDSA (see Simulation)
Synthesis of C implementations of ECC for embedded devices, given any implementation configuration (see Code generation), CPU-level emulation of implementations (see Emulation and leakage simulation)
Trace acquisition using PicoScope/ChipWhisperer oscilloscopes (see Measurement)
Trace processing capabilities, e.g. signal-processing, filtering, averaging, cutting, aligning (pyecsca.sca package)
Trace visualization using holoviews and datashader (see Visualization)
Communication via PCSC/LEIA with a smartcard target (see Smartcards)
pyecsca consists of three repositories:
Notebooks¶
The notebooks below contain a showcase of what is possible using pyecsca and are the best source of documentation on how to use pyecsca.
API reference¶
- pyecsca.ec package
- pyecsca.ec.formula package
- pyecsca.ec.formula.base module
- pyecsca.ec.formula.code module
- pyecsca.ec.formula.efd module
- pyecsca.ec.formula.expand module
- pyecsca.ec.formula.fake module
- pyecsca.ec.formula.fliparoo module
- pyecsca.ec.formula.graph module
- pyecsca.ec.formula.metrics module
- pyecsca.ec.formula.partitions module
- pyecsca.ec.formula.switch_sign module
- pyecsca.ec.formula.unroll module
- pyecsca.ec.mult package
- pyecsca.ec.configuration module
- pyecsca.ec.context module
- pyecsca.ec.coordinates module
- pyecsca.ec.curve module
- pyecsca.ec.divpoly module
- pyecsca.ec.error module
- pyecsca.ec.key_agreement module
- pyecsca.ec.key_generation module
- pyecsca.ec.mod module
- pyecsca.ec.model module
- pyecsca.ec.op module
- pyecsca.ec.params module
- pyecsca.ec.point module
- pyecsca.ec.scalar module
- pyecsca.ec.signature module
- pyecsca.ec.transformations module
- pyecsca.ec.formula package
- pyecsca.misc package
- pyecsca.sca package
- pyecsca.sca.attack package
- pyecsca.sca.re package
- pyecsca.sca.scope package
- pyecsca.sca.stacked_traces package
- pyecsca.sca.target package
- pyecsca.sca.target.ISO7816 module
- pyecsca.sca.target.PCSC module
- pyecsca.sca.target.base module
- pyecsca.sca.target.binary module
- pyecsca.sca.target.chipwhisperer module
- pyecsca.sca.target.ectester module
- pyecsca.sca.target.flash module
- pyecsca.sca.target.leakage module
- pyecsca.sca.target.leia module
- pyecsca.sca.target.serial module
- pyecsca.sca.target.simpleserial module
- pyecsca.sca.trace package
- pyecsca.sca.trace.align module
- pyecsca.sca.trace.combine module
- pyecsca.sca.trace.edit module
- pyecsca.sca.trace.filter module
- pyecsca.sca.trace.match module
- pyecsca.sca.trace.plot module
- pyecsca.sca.trace.process module
- pyecsca.sca.trace.sampling module
- pyecsca.sca.trace.test module
- pyecsca.sca.trace.trace module
- pyecsca.sca.trace_set package
- pyecsca.codegen package
Miscellaneous¶
Requirements¶
General
Optionally:
pyecsca contains data from the Explicit-Formulas Database by Daniel J. Bernstein and Tanja Lange. The data was partially changed, to make working with it easier. It is available on Github at crocs-muni/efd.
It uses ChipWhisperer as one of its targets. It also supports working with Riscure Inspector trace sets, which are of a proprietary format.
Testing & Development
See the Makefile for tests, performance measurement, codestyle and type checking commands. Use black for code-formatting.
License¶
MIT License
MIT License
Copyright (c) 2018-2024 Jan Jancar
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Thanks alot to contributors: Tomas Jusko, Andrej Batora, Vojtech Suchanek and to ChipWhisperer/NewAE.
Development was supported by the Masaryk University grant MUNI/C/1707/2018.