Add support for LEIA target#280
Open
GotoHack wants to merge 4120 commits into
Open
Conversation
For SWO trace (without an external debugger).
Major issue with captures sometimes returning bad data
Max reads limited to 128 bytes if nano and fw_ver <= 0.23
To revert to slow/regular SMC timing, set OpenADCInterface._fast_fifo_read to False.
Fix: KeyError in scope.capture()
…to newaetech-develop
alex-dewar
requested changes
Aug 23, 2021
alex-dewar
left a comment
Contributor
There was a problem hiding this comment.
Will need the following changes before merging in. Additionally, I'd like to test this locally, but I run into the following issues:
On first connect:
---------------------------------------------------------------------------
SerialException Traceback (most recent call last)
<ipython-input-1-dff1e27c4691> in <module>
1 import chipwhisperer as cw
2 cw.target_logger.setLevel(cw.logging.INFO)
----> 3 target = cw.target(None, cw.targets.LeiaTarget)
c:\users\adewa\code\chipwhisperer\software\chipwhisperer\__init__.py in target(scope, target_type, **kwargs)
284 """
285 target = target_type()
--> 286 target.con(scope, **kwargs)
287
288 # need to check
c:\users\adewa\code\chipwhisperer\software\chipwhisperer\capture\targets\Leia.py in con(self, scope, **kwargs)
34
35 try:
---> 36 self.open()
37 self.connectStatus = True
38
C:\Users\adewa\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\smartleia\__init__.py in open(self)
811 break
812 else:
--> 813 self.ser = self.serial_factory(self.device, timeout=1, baudrate=115200)
814 while True:
815 d = self.read_all()
C:\Users\adewa\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\serial\serialwin32.py in __init__(self, *args, **kwargs)
31 self._overlapped_read = None
32 self._overlapped_write = None
---> 33 super(Serial, self).__init__(*args, **kwargs)
34
35 def open(self):
C:\Users\adewa\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\serial\serialutil.py in __init__(self, port, baudrate, bytesize, parity, stopbits, timeout, xonxoff, rtscts, write_timeout, dsrdtr, inter_byte_timeout, exclusive, **kwargs)
242
243 if port is not None:
--> 244 self.open()
245
246 # - - - - - - - - - - - - - - - - - - - - - - - -
C:\Users\adewa\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\serial\serialwin32.py in open(self)
62 if self._port_handle == win32.INVALID_HANDLE_VALUE:
63 self._port_handle = None # 'cause __del__ is called anyway
---> 64 raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
65
66 try:
SerialException: could not open port 'COM18': PermissionError(13, 'Access is denied.', None, 5)On second connection:
---------------------------------------------------------------------------
ConnectionError Traceback (most recent call last)
<ipython-input-2-78fdaec6a794> in <module>
1 import chipwhisperer as cw
----> 2 target = cw.target(None, cw.targets.LeiaTarget)
c:\users\adewa\code\chipwhisperer\software\chipwhisperer\__init__.py in target(scope, target_type, **kwargs)
284 """
285 target = target_type()
--> 286 target.con(scope, **kwargs)
287
288 # need to check
c:\users\adewa\code\chipwhisperer\software\chipwhisperer\capture\targets\Leia.py in con(self, scope, **kwargs)
34
35 try:
---> 36 self.open()
37 self.connectStatus = True
38
C:\Users\adewa\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\smartleia\__init__.py in open(self)
C:\Users\adewa\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\smartleia\__init__.py in _testWaitingFlag(self)
ConnectionError: Can not connect to LEIA.On third connection:
---------------------------------------------------------------------------
SerialException Traceback (most recent call last)
<ipython-input-3-78fdaec6a794> in <module>
1 import chipwhisperer as cw
----> 2 target = cw.target(None, cw.targets.LeiaTarget)
c:\users\adewa\code\chipwhisperer\software\chipwhisperer\__init__.py in target(scope, target_type, **kwargs)
284 """
285 target = target_type()
--> 286 target.con(scope, **kwargs)
287
288 # need to check
c:\users\adewa\code\chipwhisperer\software\chipwhisperer\capture\targets\Leia.py in con(self, scope, **kwargs)
34
35 try:
---> 36 self.open()
37 self.connectStatus = True
38
C:\Users\adewa\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\smartleia\__init__.py in open(self)
C:\Users\adewa\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\serial\serialwin32.py in __init__(self, *args, **kwargs)
31 self._overlapped_read = None
32 self._overlapped_write = None
---> 33 super(Serial, self).__init__(*args, **kwargs)
34
35 def open(self):
C:\Users\adewa\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\serial\serialutil.py in __init__(self, port, baudrate, bytesize, parity, stopbits, timeout, xonxoff, rtscts, write_timeout, dsrdtr, inter_byte_timeout, exclusive, **kwargs)
242
243 if port is not None:
--> 244 self.open()
245
246 # - - - - - - - - - - - - - - - - - - - - - - - -
C:\Users\adewa\Downloads\WPy64-3771\python-3.7.7.amd64\lib\site-packages\serial\serialwin32.py in open(self)
62 if self._port_handle == win32.INVALID_HANDLE_VALUE:
63 self._port_handle = None # 'cause __del__ is called anyway
---> 64 raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
65
66 try:
SerialException: could not open port 'COM19': PermissionError(13, 'Access is denied.', None, 5)| 'scipy', | ||
| 'fastdtw', | ||
| 'Cython', | ||
| 'smartleia-target', |
Contributor
There was a problem hiding this comment.
I'd like to make this optional, since smartleia does pull in a bunch of other stuff
Contributor
There was a problem hiding this comment.
Also, I don't think this is available on pypi, so I'm assuming this will fail
| from .SimpleSerial2 import SimpleSerial2, SimpleSerial2_CDC | ||
| from .CW305_ECC import CW305_ECC | ||
| from .CW310 import CW310 | ||
| from .Leia import LeiaTarget |
Contributor
There was a problem hiding this comment.
Same thing here (just a try except block would be fine, and log as info if the import fails)
| pyserial==3.4 | ||
| fastdtw==0.3.4 | ||
| Cython>=0.29.14 | ||
| smartleia_target=>1.0.0 |
Contributor
There was a problem hiding this comment.
Same thing here - this isn't on pypi, so it needs to be removed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This add support for the LEIA by H2LAB target: an open hardware and open source device targeting smart card side-channel analysis (SCA) and evaluation, for educational and evaluation purpose. It implements a fully controlled ISO7816 stack with a dedicated custom hardware platform to acquire clean measurements for SCA characterization.