id = 'atsha204a'
name = 'ATSHA204A'
longname = 'Microchip ATSHA204A'
- desc = 'Microchip ATSHA204A crypto authentication protocol.'
+ desc = 'Microchip ATSHA204A family crypto authentication protocol.'
license = 'gplv2+'
inputs = ['i2c']
outputs = []
('warning', 'Warning'),
)
annotation_rows = (
- ('frame', 'Frame', (0, 1, 2, 3, 4, 5, 6)),
- ('status', 'Status', (7,)),
+ ('frame', 'Frames', (0, 1, 2, 3, 4, 5, 6)),
+ ('status-vals', 'Status', (7,)),
('warnings', 'Warnings', (8,)),
)
elif op == OPCODE_DERIVE_KEY:
self.putz(s[0][0], s[31][1], [5, ['MAC: %s' % ' '.join(format(i[2], '02x') for i in s)]])
elif op == OPCODE_ECDH:
- self.putz(s[0][0], s[31][1], [5, ['Pub X: %s' % ' '.join(format(i[2], '02x') for i in s[0:32])]])
- self.putz(s[32][0], s[63][1], [5, ['Pub Y: %s' % ' '.join(format(i[2], '02x') for i in s[32:64])]])
+ self.putz(s[0][0], s[31][1], [5, ['Pub X: %s' % ' '.join(format(i[2], '02x') for i in s[0:32])]])
+ self.putz(s[32][0], s[63][1], [5, ['Pub Y: %s' % ' '.join(format(i[2], '02x') for i in s[32:64])]])
elif op in (OPCODE_GEN_DIG, OPCODE_GEN_KEY):
self.putz(s[0][0], s[3][1], [5, ['OtherData: %s' % ' '.join(format(i[2], '02x') for i in s)]])
elif op == OPCODE_MAC:
else: # Just value.
self.putz(s[0][0], s[-1][1], [5, ['Value: %s' % ' '.join(format(i[2], '02x') for i in s)]])
elif op == OPCODE_VERIFY:
- if len(s) >= 64: # ECDSA components
+ if len(s) >= 64: # ECDSA components (always present)
self.putz(s[0][0], s[31][1], [5, ['ECDSA R: %s' % ' '.join(format(i[2], '02x') for i in s[0:32])]])
self.putz(s[32][0], s[63][1], [5, ['ECDSA S: %s' % ' '.join(format(i[2], '02x') for i in s[32:64])]])
- if len(s) >= 128: # Public key components
+ if len(s) == 83: # OtherData (follow ECDSA components in validate / invalidate mode)
+ self.putz(s[64][0], s[82][1], [5, ['OtherData: %s' % ' '.join(format(i[2], '02x') for i in s[64:83])]])
+ if len(s) == 128: # Public key components (follow ECDSA components in external mode)
self.putz(s[64][0], s[95][1], [5, ['Pub X: %s' % ' '.join(format(i[2], '02x') for i in s[64:96])]])
self.putz(s[96][0], s[127][1], [5, ['Pub Y: %s' % ' '.join(format(i[2], '02x') for i in s[96:128])]])
- if len(s) == 147: # OtherData
- self.putz(s[128][0], s[146][1], [5, ['OtherData: %s' % ' '.join(format(i[2], '02x') for i in s[128:147])]])
elif op == OPCODE_WRITE:
if len(s) > 32: # Value + MAC.
self.putz(s[0][0], s[-31][1], [5, ['Value: %s' % ' '.join(format(i[2], '02x') for i in s)]])
def decode(self, ss, es, data):
cmd, databyte = data
-
# State machine.
if self.state == 'IDLE':
# Wait for an I²C START condition.
# Reset the opcode before received data, as this causes
# responses to be displayed incorrectly.
self.opcode = -1
- self.output_rx_bytes()
+ if len(self.bytes) > 0:
+ self.output_rx_bytes()
self.waddr = -1
self.bytes = []
self.state = 'IDLE'
self.output_tx_bytes()
self.bytes = []
self.state = 'IDLE'
-