-
Notifications
You must be signed in to change notification settings - Fork 281
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?
Changes from all commits
f73c7bc
28b938c
311ef27
e12713a
5bd7546
45859a8
0c779e7
8419438
ea12d82
e7439a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
'scipy', | ||
'fastdtw', | ||
'Cython', | ||
'smartleia-target', | ||
'tqdm' | ||
], | ||
project_urls={ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
# | ||
# ================================================= | ||
|
||
import smartleia_target as LEIATarget | ||
from ._base import TargetTemplate | ||
from chipwhisperer.common.utils.util import dict_to_str | ||
|
||
class LeiaTarget( LEIATarget.TargetController, TargetTemplate): | ||
_name= 'LEIA Java Smartcard Target' | ||
|
||
connectStatus = False | ||
|
||
def __init__(self): | ||
LEIATarget.TargetController.__init__(self) | ||
|
||
def __del__(self): | ||
"""Close system if needed""" | ||
|
||
self.close() | ||
|
||
def getStatus(self): | ||
return self.connectStatus | ||
|
||
def dis(self): | ||
"""Disconnect from target""" | ||
|
||
self.close() | ||
self.connectStatus = False | ||
|
||
def con(self, scope=None, **kwargs): | ||
"""Connect to target""" | ||
|
||
try: | ||
self.open() | ||
self.connectStatus = True | ||
|
||
except: | ||
self.dis() | ||
raise | ||
|
||
@property | ||
def output_len(self): | ||
"""The length of the output expected from the crypto algorithm (in bytes)""" | ||
|
||
return len(self.getExpected()) | ||
|
||
@output_len.setter | ||
def output_len(self, length): | ||
#FIXME | ||
return 16 | ||
|
||
def _con(self, scope=None): | ||
self.con() | ||
|
||
def reinit(self): | ||
pass | ||
|
||
def validateSettings(self): | ||
# FIXME | ||
# return [("warn", "Target Module", "You can't use module \"" + self.getName() + "\"", "Specify other module", "57a3924d-3794-4ca6-9693-46a7b5243727")] | ||
return [] | ||
|
||
def _dict_repr(self): | ||
raise NotImplementedError("Must define target-specific properties.") | ||
|
||
def __repr__(self): | ||
return dict_to_str(self._dict_repr()) | ||
|
||
def __str__(self): | ||
return self.__repr__() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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) |
||
|
||
try: | ||
from .sakura_g import SakuraG #needs ftdi module | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 |
||
pypandoc==1.3.3 | ||
tqdm>=4.40.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.
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