Fix long standing buf of digital signature counter.
authorNIIBE Yutaka <gniibe@fsij.org>
Fri, 28 Apr 2017 05:54:15 +0000 (14:54 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Fri, 28 Apr 2017 05:54:15 +0000 (14:54 +0900)
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
ChangeLog
src/openpgp-do.c

index 9a8f720..bd671fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-28  NIIBE Yutaka  <gniibe@fsij.org>
+
+       * src/openpgp-do.c (gpg_write_digital_signature_counter): Fix
+       writing lower 10-bit.
+
 2017-04-27  NIIBE Yutaka  <gniibe@fsij.org>
 
        * src/gnuk.ld.in (_data_pool): Move to the end.
index 2206656..9f398b6 100644 (file)
@@ -336,7 +336,7 @@ gpg_write_digital_signature_counter (const uint8_t *p, uint32_t dsc)
   else
     {
       hw0 = NR_COUNTER_DS | ((dsc & 0xfc0000) >> 18) | ((dsc & 0x03fc00) >> 2);
-      hw1 = NR_COUNTER_DS_LSB;
+      hw1 = NR_COUNTER_DS_LSB | ((dsc & 0x0300) >> 8) | ((dsc & 0x00ff) << 8);
       flash_put_data_internal (p, hw0);
       flash_put_data_internal (p+2, hw1);
       return p+4;