Changes

Tutorial A5 Breaking AES-256 Bootloader

92 bytes removed, 22:48, 15 September 2016
Appendix D: AES-256 13th Round Key Script
</pre>
= Appendix D: AES-256 13th Round Key Script =
Full attack script, copy/paste into a file then add as active attack script:
 
<pre>
# AES-256 13th Round Key Script
from chipwhisperer.common.scripts.base import UserScriptBase
# Imports for AES256 Attack
from chipwhisperer.analyzer.attacks.models.AES128_8bit base import getHWModelsBase
from chipwhisperer.analyzer.models.aes.funcs import sbox, inv_sbox, inv_shiftrows, inv_mixcolumns, inv_subbytes
class AES256Attack(objectModelsBase): numSubKeys _name = 16'AES 128'
@staticmethoddef __init__(self): ModelsBase.__init__(self, 16, 256, model=1) self.numRoundKeys = 10 def leakage(self, textin, textout, guess, bnum, setting, state): if setting == 13: knownkey = [0xea, 0x79, 0x79, 0x20, 0xc8, 0x71, 0x44, 0x7d, 0x46, 0x62, 0x5f, 0x51, 0x85, 0xc1, 0x3b, 0xcb] xored = [knownkey[i] ^ textin[i] for i in range(0, 16)] block = xored block = inv_shiftrows(block) block = inv_subbytes(block) block = inv_mixcolumns(block) block = inv_shiftrows(block) result = block return getHW(self.HW[inv_sbox((result[bnum] ^ guess)))]
self.attack = CPA()
self.attack.setTraceSource(self.traces, blockSignal=True)
self.attack.setAnalysisAlgorithm(CPAProgressive, AES256Attack, 13None)
self.attack.setTraceStart(0)
self.attack.setTracesPerAttack(200)
self.attack.setIterations(1)
self.attack.setReportingInterval(10)
self.attack.setTargetBytessetTargetSubkeys([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])
self.attack.setPointRange((0,10991))
gui.show() # Comment if you don't need the GUI
api.runScriptClass(UserScript) # Run UserScript through the API
app.exec_() # Comment if you don't need the GUI </pre> {{TemplateGUITraceback (most recent call last):Tutorials}}[[Category:Tutorials]]
Approved_users, bureaucrat, administrator
1,956
edits