Hi, I had a question in which I would like some inputs,
I have been experimenting with the ECC side channel attacks, and wanted to try using the same attack on a different curve(a binary curve in this case) I built the design and connected m design along with the top modules and have been trying to run the attack. I am using the CW305 + CW 1200 combination. But I am unable to capture the traces.
EVerytime I try I get the following error,
(ChipWhisperer Target ERROR|File CW305_ECC.py:208) Bad Rx!
(ChipWhisperer Target ERROR|File CW305_ECC.py:209) expected 9235f59ca724e672a1c3fff4dc5a009b6f8d7b98a79e7930e458f1c61306735e
(ChipWhisperer Target ERROR|File CW305_ECC.py:210) got 1002ad743fbd34cf92ed235495d9eb063c3584523
(ChipWhisperer Target ERROR|File CW305_ECC.py:212) Bad Ry!
(ChipWhisperer Target ERROR|File CW305_ECC.py:213) expected a26da1c8000d9c6c10464e699a5a7b36b697ae8eb34c1452e5b250c791ca25a7
(ChipWhisperer Target ERROR|File CW305_ECC.py:214) got 1ec53358fcc1fbf25ec4240550db832bf17b46657
(ChipWhisperer Scope WARNING|File _OpenADCInterface.py:695) Timeout in OpenADC capture(), no trigger seen! Trigger forced, data is invalid
(ChipWhisperer Target WARNING|File CW305_ECC.py:141) Timeout happened during capture
Failed capture
I understand why I get bad rx and ry , it is because my curve is different, but I do not know why I get the Timeout, If the FPGA generated the output it means it is doing its multiplication, however I get the timeout after the output is recieved.
I know it is not a typical Chipwhisperer question, but I really appreciate, any input you can provide on this.
After trying to capture again , I also recieve the following error:-
/* USBErrorPipe Traceback (most recent call last)
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py:593, in NAEUSB_Backend._cmd_ctrl_send_data(self, pload, cmd)
592 try:
→ 593 self.sendCtrl(cmd, data=pload)
594 except usb1.USBErrorPipe:
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py:547, in NAEUSB_Backend.sendCtrl(self, cmd, value, data)
546 naeusb_logger.error(“The naeusb fw ctrl buffer is 128 bytes, but len(data) > 128. If you get a pipe error, this is why.”)
→ 547 self.handle.controlWrite(0x41, cmd, value, 0, data, timeout=self._timeout)
File ~\CHIPWH~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\usb1_init_.py:1330, in USBDeviceHandle.controlWrite(self, request_type, request, value, index, data, timeout)
1329 data, _ = create_initialised_buffer(data)
→ 1330 return self._controlTransfer(request_type, request, value, index, data,
1331 sizeof(data), timeout)
File ~\CHIPWH~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\usb1_init_.py:1307, in USBDeviceHandle._controlTransfer(self, request_type, request, value, index, data, length, timeout)
1303 result = libusb1.libusb_control_transfer(
1304 self.__handle, request_type, request, value, index, data, length,
1305 timeout,
1306 )
→ 1307 mayRaiseUSBError(result)
1308 return result
File ~\CHIPWH~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\usb1_init_.py:127, in mayRaiseUSBError(value, __raiseUSBError)
126 if value < 0:
→ 127 __raiseUSBError(value)
128 return value
File ~\CHIPWH~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\usb1_init_.py:119, in raiseUSBError(value, __STATUS_TO_EXCEPTION_DICT, __USBError)
113 def raiseUSBError(
114 value,
115 # Avoid globals lookup on call to work during interpreter shutdown.
116 __STATUS_TO_EXCEPTION_DICT=STATUS_TO_EXCEPTION_DICT,
117 __USBError=USBError,
118 ): # pylint: disable=dangerous-default-value
→ 119 raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)
USBErrorPipe: LIBUSB_ERROR_PIPE [-9]
During handling of the above exception, another exception occurred:
USBErrorPipe Traceback (most recent call last)
Cell In[17], line 2
1 k = 0xffffffffffffffffffffffffffffffff00000000000000000000000000000000
----> 2 traces = get_traces(1, k, ‘part1_1’, full=True)
File ~\AppData\Local\Temp\ipykernel_10368\2213874888.py:55, in get_traces(N, k, step, randomize_k, full, samples_per_segment, as_int)
52 target.fpga_write(target.REG_KB, list(int.to_bytes(kb, length=32, byteorder=‘little’)))
54 if PLATFORM == ‘CWPRO’ or PLATFORM == ‘CWHUSKY’:
—> 55 ret = target.capture_trace(scope, Px=P.x, Py=P.y, k=k, check=True, as_int=as_int)
56 if not ret:
57 print(“Failed capture”)
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\targets\CW305_ECC.py:137, in CW305_ECC.capture_trace(self, scope, k, operation, Px, Py, check, as_int)
134 else:
135 target_logger.error(“Please supply a valid operation to run.”)
→ 137 ret = scope.capture()
138 cycles = scope.adc.trig_count - start_cycles
140 if ret:
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes\OpenADC.py:868, in OpenADC.capture(self, poll_done)
865 raise ValueError(‘The number of samples (%d) must be at least 2 more than the number of presamples (%d).’ % (self.adc.samples, self.adc.presamples))
867 if self.adc.stream_mode and (not self._is_husky):
→ 868 a = self.sc.capture(None)
869 else:
870 a = self.sc.capture(self.adc.offset, self.clock.adc_freq, self.adc.samples, self.adc.segments, self.adc.segment_cycles, poll_done)
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes_OpenADCInterface.py:697, in OpenADCInterface.capture(self, offset, adc_freq, samples, segments, segment_cycles, poll_done)
695 scope_logger.warning(‘Timeout in OpenADC capture(), no trigger seen! Trigger forced, data is invalid’)
696 timeout = True
→ 697 self.triggerNow()
698 self.serial.streamModeCaptureStream.stop = True
699 break
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes_OpenADCInterface.py:464, in OpenADCInterface.triggerNow(self)
462 self.setSettings(initial | SETTINGS_TRIG_NOW)
463 time.sleep(0.05)
→ 464 self.setSettings(initial & ~SETTINGS_TRIG_NOW)
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes_OpenADCInterface.py:434, in OpenADCInterface.setSettings(self, state, validate)
432 cmd[0] = state
433 self.cached_settings = state
→ 434 self.sendMessage(CODE_WRITE, “SETTINGS_ADDR”, cmd, Validate=validate)
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes_OpenADCInterface.py:291, in OpenADCInterface.sendMessage(self, mode, address, payload, Validate, maxResp, readMask)
289 if mode != CODE_WRITE:
290 return self.msg_read(address, maxResp)
→ 291 self.msg_write(address, payload)
292 if Validate:
293 self.msg_validate(address, payload, read_mask=readMask)
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\capture\scopes_OpenADCInterface.py:247, in OpenADCInterface.msg_write(self, address, payload)
244 address = self._address_str2int(address)
245 if self._serial_not_stream:
246 # Write output to memory
→ 247 self.serial.cmdWriteMem(address, payload)
248 else:
249 self._send_msg_hdr(CODE_WRITE, address, len(payload))
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py:893, in NAEUSB.cmdWriteMem(self, addr, data)
887 def cmdWriteMem(self, addr : int, data : bytearray):
888 “”"
889 Send command to write memory over external memory interface to FPGA. Automatically
890 decides to use control-transfer or bulk-endpoint transfer based on data length.
891 “”"
→ 893 return self.usbserializer.cmdWriteMem(addr, data)
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py:662, in NAEUSB_Backend.cmdWriteMem(self, addr, data)
660 pload = util.get_bytes_memview(data)
661 if len(pload) < NAEUSB_CTRL_IO_THRESHOLD:
→ 662 self._cmd_writemem_ctrl(addr, pload)
663 else:
664 self._cmd_writemem_bulk(addr, pload)
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py:647, in NAEUSB_Backend._cmd_writemem_ctrl(self, addr, data)
645 set_len_addr(pload, len(data), addr)
646 util.bytes_fast_copy(pload, LEN_ADDR_HDR_SIZE, data)
→ 647 self._cmd_ctrl_send_data(pload, self.CMD_WRITEMEM_CTRL)
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py:597, in NAEUSB_Backend._cmd_ctrl_send_data(self, pload, cmd)
595 naeusb_logger.info(“Attempting pipe error fix - typically safe to ignore”)
596 self.sendCtrl(0x22, 0x11)
→ 597 self.sendCtrl(cmd, data=pload)
File c:\users\admin\chipwhisperer5_64\chipwhisperer5_64\cw\home\portable\chipwhisperer\software\chipwhisperer\hardware\naeusb\naeusb.py:547, in NAEUSB_Backend.sendCtrl(self, cmd, value, data)
545 if len(data) > NAEUSB_CTRL_IO_MAX:
546 naeusb_logger.error(“The naeusb fw ctrl buffer is 128 bytes, but len(data) > 128. If you get a pipe error, this is why.”)
→ 547 self.handle.controlWrite(0x41, cmd, value, 0, data, timeout=self._timeout)
File ~\CHIPWH~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\usb1_init_.py:1330, in USBDeviceHandle.controlWrite(self, request_type, request, value, index, data, timeout)
1328 # pylint: enable=undefined-variable
1329 data, _ = create_initialised_buffer(data)
→ 1330 return self._controlTransfer(request_type, request, value, index, data,
1331 sizeof(data), timeout)
File ~\CHIPWH~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\usb1_init_.py:1307, in USBDeviceHandle._controlTransfer(self, request_type, request, value, index, data, length, timeout)
1301 def _controlTransfer(
1302 self, request_type, request, value, index, data, length, timeout):
1303 result = libusb1.libusb_control_transfer(
1304 self.__handle, request_type, request, value, index, data, length,
1305 timeout,
1306 )
→ 1307 mayRaiseUSBError(result)
1308 return result
File ~\CHIPWH~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\usb1_init_.py:127, in mayRaiseUSBError(value, __raiseUSBError)
121 def mayRaiseUSBError(
122 value,
123 # Avoid globals lookup on call to work during interpreter shutdown.
124 __raiseUSBError=raiseUSBError,
125 ):
126 if value < 0:
→ 127 __raiseUSBError(value)
128 return value
File ~\CHIPWH~1\CHIPWH~1\cw\home\portable\WPy64-31080\python-3.10.8.amd64\lib\site-packages\usb1_init_.py:119, in raiseUSBError(value, __STATUS_TO_EXCEPTION_DICT, __USBError)
113 def raiseUSBError(
114 value,
115 # Avoid globals lookup on call to work during interpreter shutdown.
116 __STATUS_TO_EXCEPTION_DICT=STATUS_TO_EXCEPTION_DICT,
117 __USBError=USBError,
118 ): # pylint: disable=dangerous-default-value
→ 119 raise __STATUS_TO_EXCEPTION_DICT.get(value, __USBError)(value)
USBErrorPipe: LIBUSB_ERROR_PIPE [-9]
*/
I can no longer think of a solution, and hence would really like to hear your opinions.
Please let me know if you need any further details.
THANK YOU.