diff --git a/src/configure b/src/configure index 3f60577..a5636b7 100755 --- a/src/configure +++ b/src/configure @@ -84,7 +84,7 @@ Configuration: -h, --help display this help and exit [no] --vidpid=VID:PID specify vendor/product ID [] --target=TARGET specify target [OLIMEX_STM32_H103] - supported targes are: + supported targets are: OLIMEX_STM32_H103 STM32_PRIMER2 CQ_STARM diff --git a/src/gnuk.h b/src/gnuk.h index 606224a..195f5b5 100644 --- a/src/gnuk.h +++ b/src/gnuk.h @@ -171,8 +171,8 @@ struct key_data { }; struct key_data_internal { - uint8_t data[KEY_CONTENT_LEN]; /* p and q */ - uint8_t checksum[DATA_ENCRYPTION_KEY_SIZE]; + uint32_t data[KEY_CONTENT_LEN/4]; /* p and q */ + uint32_t checksum[DATA_ENCRYPTION_KEY_SIZE/4]; }; struct prvkey_data { diff --git a/src/openpgp-do.c b/src/openpgp-do.c index de49837..746b7d9 100644 --- a/src/openpgp-do.c +++ b/src/openpgp-do.c @@ -453,7 +453,7 @@ const uint8_t openpgpcard_aid[] = { static int do_openpgpcard_aid (uint16_t tag, int with_tag) { - uint16_t vid = *((const volatile uint16_t *)&openpgpcard_aid[8]); + uint16_t vid = (openpgpcard_aid[8] << 8) | openpgpcard_aid[9]; if (with_tag) { @@ -670,7 +670,7 @@ compute_key_data_checksum (struct key_data_internal *kdi, int check_or_calc) uint32_t d[4] = { 0, 0, 0, 0 }; for (i = 0; i < KEY_CONTENT_LEN / sizeof (uint32_t); i++) - d[i&3] ^= *(uint32_t *)(&kdi->data[i*4]); + d[i&3] ^= kdi->data[i]; if (check_or_calc == 0) /* store */ { @@ -807,7 +807,7 @@ gpg_do_write_prvkey (enum kind_of_key kk, const uint8_t *key_data, int key_len, encrypt (dek, iv, (uint8_t *)&kdi, sizeof (struct key_data_internal)); - r = flash_key_write (key_addr, kdi.data, pubkey); + r = flash_key_write (key_addr, (const uint8_t *)kdi.data, pubkey); if (pubkey_allocated_here) free ((void *)pubkey);