Can not use SAKURA-G with OpenADC

Hi Colin,

I met the same problem as the one in (viewtopic.php?f=6&p=157#p157). However, after I change the program as you uploaded in that topic, another problem occures. After I run SAKURA-G AES script, a window jumps out and shows the message “<type ‘exception.IOError’> Opened port UNKNOWN but failed to find OpenADC”. After I click OK, the message shows in the debug logging as follows:

SmartCard targets disabled: (<type ‘exceptions.ImportError’>, ImportError(‘No module named smartcard.CardType’,), <traceback object at 0x10599E18>)
umysql required: pypi.python.org/pypi/umysql

Running Script: SAKURA-G: AES-128 FPGA Target* Starting User Script *****
For address 0x01=1 Sent data: fe
Read data: ff

For address 0x04=4 Sent data: ac
Read data: ff

For address 0x04=4 Sent data: ac
Read data: ff

For address 0x04=4 Sent data: ac
Read data: ff

For address 0x04=4 Sent data: ac
Read data: ff

For address 0x04=4 Sent data: ac
Read data: ff

OpenADC Error: <type ‘exceptions.IOError’>Opened port UNKNOWN but failed to find OpenADC
Target Error: Opened port UNKNOWN but failed to find OpenADCNo OpenADC?
Traceback (most recent call last):
File “d:\chipwhisperer\chipwhisperer-0.08\openadc\controlsw\python\openadc\ExtendedParameter.py”, line 60, in change
param.opts’set’
File “d:\chipwhisperer\chipwhisperer-0.08\openadc\controlsw\python\openadc\openadc.py”, line 580, in setAdcSource
result = self.oa.sendMessage(CODE_READ, ADDR_ADVCLK, maxResp=4)
AttributeError: ‘PySide.QtGui.QTextBrowser’ object has no attribute ‘sendMessage’
Traceback (most recent call last):
File “d:\chipwhisperer\chipwhisperer-0.08\openadc\controlsw\python\openadc\ExtendedParameter.py”, line 60, in change
param.opts’set’
File “d:\chipwhisperer\chipwhisperer-0.08\openadc\controlsw\python\openadc\openadc.py”, line 280, in setMaxSamples
self.oa.setMaxSamples(samples)
AttributeError: ‘PySide.QtGui.QTextBrowser’ object has no attribute ‘setMaxSamples’
Traceback (most recent call last):
File “d:\chipwhisperer\chipwhisperer-0.08\openadc\controlsw\python\openadc\ExtendedParameter.py”, line 60, in change
param.opts’set’
File “d:\chipwhisperer\chipwhisperer-0.08\openadc\controlsw\python\openadc\openadc.py”, line 229, in setGain
self.oa.sendMessage(CODE_WRITE, ADDR_GAIN, cmd)
AttributeError: ‘PySide.QtGui.QTextBrowser’ object has no attribute ‘sendMessage’
Traceback (most recent call last):
File “d:\chipwhisperer\chipwhisperer-0.08\openadc\controlsw\python\openadc\ExtendedParameter.py”, line 60, in change
param.opts’set’
File “d:\chipwhisperer\chipwhisperer-0.08\openadc\controlsw\python\openadc\openadc.py”, line 378, in setMode
cur = self.oa.settings() & ~(SETTINGS_TRIG_HIGH | SETTINGS_WAIT_YES);
AttributeError: ‘PySide.QtGui.QTextBrowser’ object has no attribute ‘settings’
Traceback (most recent call last):
File “d:\chipwhisperer\chipwhisperer-0.08\openadc\controlsw\python\openadc\ExtendedParameter.py”, line 60, in change
param.opts’set’
File “d:\chipwhisperer\chipwhisperer-0.08\openadc\controlsw\python\openadc\openadc.py”, line 580, in setAdcSource
result = self.oa.sendMessage(CODE_READ, ADDR_ADVCLK, maxResp=4)
AttributeError: ‘PySide.QtGui.QTextBrowser’ object has no attribute ‘sendMessage’
Traceback (most recent call last):
File “d:\chipwhisperer\chipwhisperer-0.08\openadc\controlsw\python\openadc\ExtendedParameter.py”, line 73, in change
linked.setValue(linked.opts’get’)
File “d:\chipwhisperer\chipwhisperer-0.08\openadc\controlsw\python\openadc\openadc.py”, line 640, in phase
result = self.oa.sendMessage(CODE_READ, ADDR_PHASE, maxResp=2);
AttributeError: ‘PySide.QtGui.QTextBrowser’ object has no attribute ‘sendMessage’
Traceback (most recent call last):
File “D:\ChipWhisperer\chipwhisperer-0.08\software\chipwhisperer\capture\ChipWhispererCapture.py”, line 434, in runScript
m.run()
File “D:\ChipWhisperer\chipwhisperer-0.08\software\chipwhisperer\capture\scripts\sakurag-aes.py”, line 110, in run
cap.capture1()
File “D:\ChipWhisperer\chipwhisperer-0.08\software\chipwhisperer\capture\ChipWhispererCapture.py”, line 714, in capture1
ac.doSingleReading()
File “d:\chipwhisperer\chipwhisperer-0.08\software\chipwhisperer\capture\AcquisitionController.py”, line 125, in doSingleReading
self.target.setModeEncrypt()
File “d:\chipwhisperer\chipwhisperer-0.08\software\chipwhisperer\capture\targets\SAKURAG.py”, line 320, in setModeEncrypt
self.hw.write(0x000C, 0x00, 0x00)
File “d:\chipwhisperer\chipwhisperer-0.08\software\chipwhisperer\capture\targets\SAKURAG.py”, line 119, in write
self.writeMsg(msg)
File “d:\chipwhisperer\chipwhisperer-0.08\software\chipwhisperer\capture\targets\SAKURAG.py”, line 92, in writeMsg
self.oa.sendMessage(self.CODE_WRITE, self.ADDR_FIFO, [b], Validate=False)
AttributeError: ‘NoneType’ object has no attribute ‘sendMessage’

I would like to ask what might be the problem.

Thanks,
Sylvia

Hi Sylvia,

Have you programmed the ChipWhisperer bitstream into the SAKURA-G LX9 chip? This bitstream is provided as part of the ChipWhisperer release (see newae.com/sidechannel/cwdocs/hwsakurag.html).

That error sounds like it might be that somehow the LX9 device doesn’t have the appropriate bitstream loaded. If the bitstream is loaded it could be a clock setting issue, check the jumpers are set as in the photo in the above link.

PS: The 0.09 release is out now and gets rid of those messages about missing smartcard + sql modules.

Thanks, it works now. However, I have two other problems related to the result I got. Firstly, what is the sample rate of the openADC and whether it is possible to change that sample rate. Secondly, due to the research needed I need to estimate the power consumption of the main FPGA . Therefore, can I estimate the power of the board by doing (V/10)^2/R. V is the voltage from the OpenADC, 10 is the gain of the amplifier which is +20db according to the document and R is 1ohm which is R12 on board.

Thanks,
Sylvia

Hi Sylvia,

The sample rate is set to 48 MS/s, as it’s designed to sample synchronously to the clock of the DUT. This allows you to use a much slower sample rate than you might otherwise expect, as the DUT clock is generated from this 48 MHz clock as well. I think it can be changed (need to check) although it might require some FPGA code changes.

You’ll have to do some calibrations for the OpenADC I suspect. Remember the OpenADC is AC-coupled, so you won’t see constant DC power consumption. But beyond that the easier method of calibrating would be to feed a small signal (say ~100mV) into the OpenADC analog input, and check the scale of the resulting waveform. This would give you an idea about the gain, and then could calculate the current using I=V/R.

Regards,

-Colin

Hi Colin,

I would like to make sure of the method for calibrations. Do you mean that I can add the OpenADC on the SAKURA-G board as I connected for previous AES test. Then I disconnected the SMA port with SAKURA board and add a (say ~100mV) signal to the SMA port on OpenADC which used to connected to SAKURA board. After that I can use the chipwhisper capture and run the 128 AES script as usual. At this time the waveform on the screan is the standard waveform.

Thanks,
Colin

Hello,

Your assumption is correct - I’m suggesting to use a 100mV signal just to understand what the scaling is between 100mV = xxxx signal level on the ChipWhisperer capture software. Then you’ll know what the voltage is for the V=IR level. It should be approximately what you expect based on the scaling of the LNA input gain, but this way you can be 100% sure.

You might need to adjust the voltage level up/down based on what you measure. If 100mV is going off-scale for example dial the voltage down a bit.

Regards,

-Colin

Hi Colin,

I feel a little bit confused about the sampling. In this page (viewtopic.php?f=9&t=3), you stated that for the implementation used in the SAKURA-G (and I assume SAKURA-X too), it does an entire round in one clock cycle. If this is the case, the system clock period is 48 MHz and the sample rate of OpenADC is 48MS/s means that we can only get one sample during 1 clock cycle. Therefore, how can you get the 11 spike picture from openADC for 1 encryption?

Thanks,
Sylvia

Hi Sylvia,

Oops - I meant actually it does a single round per clock cycle! So the 11 spikes are the 10 rounds of AES + an additional round of either loading/unloading or key scheduling (not sure which causes the extra spike!)

-Colin

Hi Colin,

The extra spike is caused by the first key schedule. I understand it finishs one single round with in a clock cycle. However, what I am confused is that if this is the case, you can only get one sample point during one clock cycle which is one single round. You can only get around 11 points during one AES encryption. Therefore, why there are around 26 sample points showed on the picture during one single round?

Thanks,
Sylvia

Ah… alright sorry for the misunderstanding!

So is your question about why use so many sample points when you only need a single one? There isn’t much reason, I had the system oversampling to give it a nicer-looking picture. In fact you can run the CPA attack against a single point where the leakage occurs and it will succeed - the success rate will even be a little better as the noise from the wrong points is removed!

Hopefully I’ve understood this time…

Hi Sylvia,

Could you send me the project materials that you used for this one? Thanks. I cannot work this out.

Bests,
Jiaji

Hello,

I am trying to understand the project of LX9-Spartan6, but some files in ISE project are missing. Could you please send me the completed project? Or Do you have any document described this design, control bus of LX9 in Sakura-G.

Thank you very much.