本文整理汇总了Python中chipwhisperer.common.api.CWCoreAPI.CWCoreAPI.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Python CWCoreAPI.getInstance方法的具体用法?Python CWCoreAPI.getInstance怎么用?Python CWCoreAPI.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chipwhisperer.common.api.CWCoreAPI.CWCoreAPI
的用法示例。
在下文中一共展示了CWCoreAPI.getInstance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resetDevice
# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
def resetDevice(self):
# Reset the target by reading its signature
target = self.findParam('target').getValue()
if target == 'xmega (PDI)':
CWCoreAPI.getInstance().getScope().scopetype.dev.getCwliteXMEGA().readSignature()
else:
CWCoreAPI.getInstance().getScope().scopetype.dev.getCwliteAVR().readSignature()
示例2: trigger
# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
def trigger(self, _=None):
print "AUXIO: Trigger pin %d" % self.pin
self.checkMode()
CWCoreAPI.getInstance().getScope().advancedSettings.cwEXTRA.setGPIOState(state=(not self.standby), IONumber=self.pin)
self.nonblockingSleep(self.triglength)
CWCoreAPI.getInstance().getScope().advancedSettings.cwEXTRA.setGPIOState(state=self.standby, IONumber=self.pin)
self.nonblockingSleep(self.postdelay)
示例3: processTraces
# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
def processTraces(self, _=None):
tstart = self.findParam('tracerng').getValue()[0]
tend = self.findParam('tracerng').getValue()[1]
pstart = self.findParam('pointrng').getValue()[0]
pend = self.findParam('pointrng').getValue()[1]
trace = CWCoreAPI.getInstance().getNewTrace(self.findParam('tracefmt').getValue())
trace.config.setAttr("notes", "Recorded from \"%s\" output: Traces (%s,%s). Points (%s,%s)" % (self.findParam('Input').getValueKey(), tstart, tend, pstart, pend))
for tnum in range(tstart, tend+1):
trace.addTrace(self.getTraceSource().getTrace(tnum)[pstart:pend+1], self.getTraceSource().getTextin(tnum), self.getTraceSource().getTextout(tnum), self.getTraceSource().getKnownKey(tnum))
trace.closeAll()
CWCoreAPI.getInstance().project().traceManager().appendSegment(trace, enabled=False)
示例4: checkMode
# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
def checkMode(self):
cwa = CWCoreAPI.getInstance().getScope().advancedSettings.cwEXTRA
if self.pin != self.lastPin:
# Turn off last used pin
if self.lastPin:
cwa.setTargetIOMode(IONumber=self.lastPin, setting=0)
# Setup new pin
cwa.setTargetIOMode(IONumber=self.pin, setting=cwa.IOROUTE_GPIOE)
# Don't do this again
self.lastPin = self.pin
示例5: __init__
# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
def __init__(self, parent):
AutoScript.__init__(self)
self._autoscript_init = False
self.parent = parent
self.poi = POI(self)
self.poiDock = CWMainGUI.getInstance().addDock(self.poi, "Partition Comparison POI Table", area=Qt.TopDockWidgetArea)
self.poiDock.hide()
self.defineName()
self._traces = None
self.api = CWCoreAPI.getInstance()
self.graph = GraphWidget()
self.bselection = QToolBar()
self.graph.addWidget(self.bselection)
self.graphDock = CWMainGUI.getInstance().addDock(self.graph, "Partition Comparison Graph", area=Qt.TopDockWidgetArea)
self.graphDock.hide()
示例6: addTraces
# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
def addTraces(self, tracedata, tracerange, progressBar=None, pointRange=None):
keyround=self.keyround
modeltype=self.modeltype
brange=self.brange
foundkey = []
self.all_diffs = range(0,16)
tdiff = self.findParam('reportinterval').getValue()
numtraces = tracerange[1] - tracerange[0]
if progressBar:
progressBar.setMinimum(0)
progressBar.setMaximum(len(brange) * 256 * (numtraces/tdiff + 1))
#r = Parallel(n_jobs=4)(delayed(traceOneSubkey)(bnum, pointRange, traces_all, numtraces, plaintexts, ciphertexts, keyround, modeltype, progressBar, self.model, pbcnt) for bnum in brange)
#self.all_diffs, pb = zip(*r)
cpa = [None]*(max(brange)+1)
for bnum in brange:
cpa[bnum] = CPAProgressiveOneSubkey()
# cpa[bnum] = MinDistOneSubkey()
# cpa[bnum] = TemplateOneSubkey()
brangeMap = [None]*(max(brange)+1)
i = 1
for bnum in brange:
brangeMap[bnum] = i
i += 1
skipPGE = self.findParam('checkpge').getValue()
bf = self.findParam('itmode').getValue() == 'bf'
#bf specifies a 'breadth-first' search. bf means we search across each
#subkey by only the amount of traces specified. Depth-First means we
#search each subkey completely, then move onto the next.
if bf:
brange_df = [0]
brange_bf = brange
else:
brange_bf = [0]
brange_df = brange
#H = np.load('channelinfo-masked.npy')
#H = np.load('csi-masked-newkey.npy')
#H = np.load('channelinfo.npy')
#mio = sio.loadmat('equalizer.mat')
#H = mio['equaltotal']
# H = np.load('equalization.npy')
# self.project() ?
project = CWCoreAPI.getInstance().project()
section = project.getDataConfig("Template Data", "Equalization Matrix")
# section = project.getDataConfig("Template Data", "AOF Matrix")
fname = project.convertDataFilepathAbs(section[0]["filename"])
H = np.load(fname)
#for j in range(0, 16):
#4 = 500-800
#test = H.copy()
#for i in range(0, 5):
# threshold = max(abs(test[j]))
# test[j, abs(test[j,:]) >= threshold ] = 0
#print "%f %d"%(threshold, (abs(H[j,:]) > threshold).sum())
#H[j, abs(H[j,:]) < threshold] = 0
for bnum_df in brange_df:
#CPAMemoryOneSubkey
#CPASimpleOneSubkey
#(self.all_diffs[bnum], pbcnt) = sCPAMemoryOneSubkey(bnum, pointRange, traces_all, numtraces, plaintexts, ciphertexts, keyround, modeltype, progressBar, self.model, pbcnt)
tstart = 0
tend = tdiff
while tstart < numtraces:
pbcnt = 0
if tend > numtraces:
tend = numtraces
if tstart > numtraces:
tstart = numtraces
data = []
textins = []
textouts = []
knownkeys = []
for i in range(tstart, tend):
# Handle Offset
tnum = i + tracerange[0]
d = tracedata.getTrace(tnum)
if d is None:
continue
#.........这里部分代码省略.........
示例7: savePOI
# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
def savePOI(self):
poiDict = {"poi":self.poiArray, "partitiontype":self.parent.partObject.partMethod.__class__.__name__}
CWCoreAPI.getInstance().project().addDataConfig(poiDict, "Template Data", "Points of Interest")
示例8: captureInit
# 需要导入模块: from chipwhisperer.common.api.CWCoreAPI import CWCoreAPI [as 别名]
# 或者: from chipwhisperer.common.api.CWCoreAPI.CWCoreAPI import getInstance [as 别名]
def captureInit(self):
self.checkMode()
CWCoreAPI.getInstance().getScope().advancedSettings.cwEXTRA.setGPIOState(state=self.standby, IONumber=self.pin)
if self.triglocation == 0:
self.trigger()