summaryrefslogtreecommitdiff
path: root/decoders/atsha204a/pd.py
diff options
context:
space:
mode:
authorMichalis Pappas <mpappas@fastmail.fm>2018-07-11 20:45:15 +0300
committerUwe Hermann <uwe@hermann-uwe.de>2019-04-30 22:07:31 +0200
commit9e23c0982cd1a902f0ec1d6fe64a5cb4ca4e981b (patch)
tree64d3a8bf3337a9e31dd2b0bb70c3949e5f6e204d /decoders/atsha204a/pd.py
parent0659deb4c36180d33678ff8938168da345293579 (diff)
downloadlibsigrokdecode-9e23c0982cd1a902f0ec1d6fe64a5cb4ca4e981b.tar.gz
libsigrokdecode-9e23c0982cd1a902f0ec1d6fe64a5cb4ca4e981b.zip
atsha204a: Display OtherData parameter correctly when Verify command is executed in Validate mode.
Diffstat (limited to 'decoders/atsha204a/pd.py')
-rw-r--r--decoders/atsha204a/pd.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/decoders/atsha204a/pd.py b/decoders/atsha204a/pd.py
index 053e325..d149c49 100644
--- a/decoders/atsha204a/pd.py
+++ b/decoders/atsha204a/pd.py
@@ -259,14 +259,14 @@ class Decoder(srd.Decoder):
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)]])