aboutsummaryrefslogtreecommitdiff
path: root/docs/index.rst
blob: e3448a56f0704e4bd21c3e32cbdee3c7da93a5f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
=================
pyecsca [pɪɛtska]
=================

.. image:: https://img.shields.io/badge/-Github-brightgreen?style=flat&logo=github
   :target: https://github.com/J08nY/pyecsca
.. image:: https://img.shields.io/github/license/J08nY/pyecsca?color=brightgreen
   :target: https://github.com/J08nY/pyecsca/blob/master/LICENSE
.. image:: https://github.com/J08nY/pyecsca/workflows/Test/badge.svg
   :target: https://github.com/J08nY/pyecsca/actions?query=workflow%3ATest
.. image:: https://github.com/J08nY/pyecsca/workflows/Lint/badge.svg
   :target: https://github.com/J08nY/pyecsca/actions?query=workflow%3ALint
.. image:: https://img.shields.io/codecov/c/gh/J08nY/pyecsca?color=brightgreen&logo=codecov
   :target: https://codecov.io/gh/J08nY/pyecsca
.. image:: https://img.shields.io/static/v1?label=mypy&message=No%20issues&color=brightgreen
.. image:: https://deepsource.io/gh/J08nY/pyecsca.svg/?label=active+issues&show_trend=true
   :target: https://deepsource.io/gh/J08nY/pyecsca/?ref=repository-badge

**Py**\ thon **E**\ lliptic **C**\ urve cryptography **S**\ ide-**C**\ hannel **A**\ nalysis 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 is currently in an alpha stage of development and thus only provides:

.. card:: Enumeration

    Enumeration of millions of possible ECC implementation configurations (see :doc:`notebook/configuration_space`)

.. card:: Simulation

    Simulation and execution tracing of key generation, ECDH and ECDSA (see :doc:`notebook/simulation`)

.. card:: Code generation

    Synthesis of C implementations of ECC for embedded devices, given any implementation configuration (see :doc:`notebook/codegen`),
    CPU-level simulation of implementations (see :doc:`notebook/simulator`)

.. card:: Trace acquisition

    Trace acquisition using PicoScope/ChipWhisperer oscilloscopes (see :doc:`notebook/measurement`)

.. card:: Trace processing

    Trace processing capabilities, e.g. signal-processing, filtering, averaging, cutting, aligning (:doc:`api/pyecsca.sca`)

.. card:: Trace visualization

    Trace visualization using holoviews and datashader (see :doc:`notebook/visualization`)

.. card:: Smartcard communication

    Communication via PCSC/LEIA with a smartcard target (see :doc:`notebook/smartcards`)

**pyecsca** consists of three repositories:

.. grid:: 3

    .. grid-item-card::  Core

        The `core <https://github.com/J08nY/pyecsca>`_ package contains the core of the
        functionality, except the code generation and notebooks.

    .. grid-item-card::  Codegen

    	The `codegen <https://github.com/J08nY/pyecsca-codegen>`_ package contains
    	the code generation functionality.

    .. grid-item-card::  Notebook

    	The `notebook <https://github.com/J08nY/pyecsca-notebook>`_ repository contains
    	example notebooks that showcase functionality of the toolkit.


:fas:`book` 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**.

.. toctree::
   :caption: Notebooks
   :titlesonly:
   :maxdepth: 1

   notebook/configuration_space
   notebook/simulation
   notebook/codegen
   notebook/simulator
   notebook/measurement
   notebook/visualization
   notebook/smartcards

:fas:`code` API reference
=========================

.. toctree::
   :caption: API reference
   :titlesonly:
   :maxdepth: 3

   api/pyecsca.ec
   api/pyecsca.misc
   api/pyecsca.sca
   api/pyecsca.codegen

:fas:`file` References
======================

.. toctree::
   :caption: References
   :titlesonly:
   :maxdepth: 1

   references

Requirements
============

.. dropdown:: General

	 - Numpy_
	 - Scipy_
	 - sympy_
	 - atpublic_
	 - fastdtw_
	 - asn1crypto_
	 - h5py_
	 - holoviews_
	 - bokeh_
	 - datashader_
	 - matplotlib_
	 - xarray_
	 - astunparse_
	 - numba_

	 - **Optionally**:

	   - **Oscilloscope support:**

	     - picosdk_
	     - picoscope_
	     - chipwhisperer_
	   - **Smartcard support:**

	     - pyscard_
	   - **LEIA support:**

	     - leia_
	   - **Faster arithmetic:**

	     - gmpy2_ (and also GMP library)

	*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.


.. dropdown:: Testing & Development

	See the Makefile for tests, performance measurement, codestyle and type checking commands.
	Use black_ for code-formatting.

	 - pytest_
	 - mypy_
	 - flake8_
	 - coverage_
	 - interrogate_
	 - pyinstrument_
	 - pre-commit_
	 - black_


.. dropdown:: Docs

	 - sphinx_
	 - sphinx-autodoc-typehints_
	 - nbsphinx_
	 - sphinx-paramlinks_
	 - sphinx-design_

License
=======

.. dropdown:: MIT License

    MIT License

    Copyright (c) 2018-2023 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 <https://www.muni.cz/en/research/projects/46834>`_.

.. _Numpy: https://www.numpy.org
.. _Scipy: https://www.scipy.org
.. _sympy: https://sympy.org/
.. _matplotlib: https://matplotlib.org/
.. _atpublic: https://public.readthedocs.io/
.. _fastdtw: https://github.com/slaypni/fastdtw
.. _asn1crypto: https://github.com/wbond/asn1crypto
.. _h5py: https://www.h5py.org/
.. _holoviews: https://holoviews.org
.. _bokeh: https://bokeh.org
.. _datashader: https://datashader.org
.. _xarray: https://xarray.pydata.org/en/stable/
.. _astunparse: https://astunparse.readthedocs.io/
.. _numba: https://numba.pydata.org/
.. _picosdk: https://github.com/picotech/picosdk-python-wrappers/
.. _picoscope: https://github.com/colinoflynn/pico-python
.. _chipwhisperer: https://github.com/newaetech/chipwhisperer
.. _pyscard: https://pyscard.sourceforge.io/
.. _leia: https://pypi.org/project/smartleia/
.. _gmpy2: https://gmpy2.readthedocs.io/
.. _pytest: https://pytest.org
.. _mypy: http://mypy-lang.org/
.. _flake8: https://flake8.pycqa.org/
.. _coverage: https://coverage.readthedocs.io/
.. _interrogate: https://interrogate.readthedocs.io/
.. _pyinstrument: https://github.com/joerick/pyinstrument/
.. _pre-commit: https://pre-commit.com
.. _black: https://github.com/psf/black
.. _sphinx: https://www.sphinx-doc.org/
.. _sphinx-autodoc-typehints: https://pypi.org/project/sphinx-autodoc-typehints/
.. _nbsphinx: https://nbsphinx.readthedocs.io/
.. _sphinx-paramlinks: https://pypi.org/project/sphinx-paramlinks/
.. _sphinx-design: https://pypi.org/project/sphinx_design/
.. _Explicit-Formulas Database: https://www.hyperelliptic.org/EFD/index.html
.. _crocs-muni/efd: https://github.com/crocs-muni/efd
.. _ChipWhisperer: https://chipwhisperer.com
.. _Riscure: https://www.riscure.com/