-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for LEIA target #280
base: develop
Are you sure you want to change the base?
Conversation
Add LEIA dependencies
Finally reviewing (oops) - we try to avoid forcing dependencies as it can break a lot of stuff. Won't accept as-is but leaving open as will rework to avoid setup.py changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
@@ -24,6 +24,7 @@ | |||
'scipy', | |||
'fastdtw', | |||
'Cython', | |||
'smartleia-target', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to make this optional, since smartleia does pull in a bunch of other stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I don't think this is available on pypi, so I'm assuming this will fail
@@ -13,6 +13,7 @@ | |||
from .SimpleSerial2 import SimpleSerial2, SimpleSerial2_CDC | |||
from .CW305_ECC import CW305_ECC | |||
from .CW310 import CW310 | |||
from .Leia import LeiaTarget |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here (just a try except block would be fine, and log as info if the import fails)
@@ -14,6 +14,7 @@ sphinxcontrib-images>=0.9.1 | |||
pyserial==3.4 | |||
fastdtw==0.3.4 | |||
Cython>=0.29.14 | |||
smartleia_target=>1.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing here - this isn't on pypi, so it needs to be removed
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.