Usb Timeout

Hi Colin,

I’m using the ChipWhisperer Lite with the CW303. I’m attempting to capture large data, I need it for the profiling attack. However, after 10000 traces the usb timeouts, I have tried even setting the capture traces to 20000 with 4 segments but it fails at the third segment. Anything below 10000 works perfectly.

Below is the error code.

 File "/home/cwuser/chipwhisperer/software/chipwhisperer/capture/ChipWhispererCapture.py", line 938, in captureM
    ac.doReadings(addToList=self.manageTraces)
  File "/home/cwuser/chipwhisperer/software/chipwhisperer/capture/AcquisitionController.py", line 186, in doReadings
    if self.doSingleReading(True, None) == True:
  File "/home/cwuser/chipwhisperer/software/chipwhisperer/capture/AcquisitionController.py", line 141, in doSingleReading
    self.textout = self.TargetDoTrace(self.textin, key=None)
  File "/home/cwuser/chipwhisperer/software/chipwhisperer/capture/AcquisitionController.py", line 98, in TargetDoTrace
    resp = self.target.readOutput()
  File "/home/cwuser/chipwhisperer/software/chipwhisperer/capture/targets/SimpleSerial.py", line 495, in readOutput
    response = self.ser.read(dataLen)
  File "/home/cwuser/chipwhisperer/software/chipwhisperer/capture/targets/SimpleSerial.py", line 125, in read
    data = bytearray(self.cwlite_usart.read(num, timeout=timeout))
  File "/home/cwuser/chipwhisperer/software/chipwhisperer/capture/scopes/ChipWhispererLite.py", line 843, in read
    waiting = self.inWaiting()
  File "/home/cwuser/chipwhisperer/software/chipwhisperer/capture/scopes/ChipWhispererLite.py", line 833, in inWaiting
    data = self._usartRxCmd(self.USART_CMD_NUMWAIT, dlen=4)
  File "/home/cwuser/chipwhisperer/software/chipwhisperer/capture/scopes/ChipWhispererLite.py", line 776, in _usartRxCmd
    return self._usbdev.ctrl_transfer(0xC1, self.CMD_USART0_CONFIG, cmd, 0, dlen, timeout=self._timeout)
  File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 971, in ctrl_transfer
    self.__get_timeout(timeout))
  File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 819, in ctrl_transfer
    timeout))
  File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 552, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 110] Operation timed out

Hmm… this is new for me, I have used this with huge number of traces so there shouldn’t be an artificial limit.

Is it always a specific number (i.e., exactly 10000)?

Basically that USB timeout error suggests some sort of comm error. I’m not sure why a long capture would have this effect, as each “trace capture” is effectively seperate to the hardware.

Can you let me know what OS you are using, and how many samples is in each trace? I’m going to try and duplicate that here.

Sorry for the problems!

Hi Colin,

I’m using your VM, with the host machine being windows 10 x64. I changed the VM settings to use 4GBs of Ram and this time I was able to get over 14000 traces before failure. It could be some weird VM bug. Will test it later with Linux or W7 as the base OS.

In the meantime, I decided to repeat the capture 4 times with each case capturing 5000 traces. When using the analyzer software I added all the traces from the trace management tab and proceeded to Trace Explorer tab. Changed the comparison and partition mode and clicked on display and got this error.

Traceback (most recent call last):
  File "/home/cwuser/chipwhisperer/software/chipwhisperer/analyzer/ChipWhispererAnalyzer.py", line 306, in runFunc
    self.runScriptFunction(name)
  File "/home/cwuser/chipwhisperer/software/chipwhisperer/analyzer/ChipWhispererAnalyzer.py", line 473, in runScriptFunction
    eval('mod.%s()' % funcname)
  File "<string>", line 1, in <module>
  File "/tmp/cwautoscript_43vZdR.py", line 47, in TraceExplorerDialog_PartitionDisplay_displayPartitionStats
    partData = ted.partObject.generatePartitions(saveFile=True, loadFile=False)
  File "/home/cwuser/chipwhisperer/software/chipwhisperer/analyzer/utils/Partition.py", line 312, in generatePartitions
    partNum = self.partMethod.getPartitionNum(t, tnum - tmapstart)
  File "/home/cwuser/chipwhisperer/software/chipwhisperer/analyzer/utils/Partition.py", line 85, in getPartitionNum
    text = trace.getTextin(tnum)
  File "/home/cwuser/chipwhisperer/software/chipwhisperer/common/traces/TraceContainer.py", line 175, in getTextin
    return self.textins[n]
TypeError: 'NoneType' object has no attribute '__getitem__'

Hi Colin,

Have you determined why I am unable to use multiple segments as input for the profile attack?

Regards.

Hi Zoe,

Still looking sorry - was doing that this weekend and got pulled away, will pick that up today.

-Colin

Hi Colin,

Just an update, I managed to solve the usb problem. There was an issue between the virtual machine and host machine. Recompiled vmware-tools and now I am able to capture thousands of traces with multiple segments.

Tested the CPA attack with multiple traces and segements and everything works. However, I’m still having trouble with the profiling attack. If I have multiple segments for the profiling attack and click on “display” in the trace explorer window, I still get this error:

Traceback (most recent call last):
  File "ChipWhispererAnalyzer.py", line 306, in runFunc
    self.runScriptFunction(name)
  File "ChipWhispererAnalyzer.py", line 473, in runScriptFunction
    eval('mod.%s()' % funcname)
  File "<string>", line 1, in <module>
  File "/tmp/cwautoscript_8ai1lU.py", line 47, in TraceExplorerDialog_PartitionDisplay_displayPartitionStats
    partData = ted.partObject.generatePartitions(saveFile=True, loadFile=False)
  File "/home/kitten/Downloads/chipwhisperer-0.12RC1/software/chipwhisperer/analyzer/utils/Partition.py", line 312, in generatePartitions
    partNum = self.partMethod.getPartitionNum(t, tnum - tmapstart)
  File "/home/kitten/Downloads/chipwhisperer-0.12RC1/software/chipwhisperer/analyzer/utils/Partition.py", line 85, in getPartitionNum
    text = trace.getTextin(tnum)
  File "/home/kitten/Downloads/chipwhisperer-0.12RC1/software/chipwhisperer/common/traces/TraceContainer.py", line 175, in getTextin
    return self.textins[n]
TypeError: 'NoneType' object has no attribute '__getitem__'

Is there a way I could debug this and find a way to use multiple segments to generate a template for the profiling attack?

Hmm… we’re actually still updating the code right now, this should be fixed shortly (traceexplorer had issues until a few days ago). Might be best to hold off, sorry for the delay!

Hi Colin,

Just wanted to inform you, since the latest git update all my issues have been resolved. Thanks for the hard work.

Regards.