fix configure and access by type-punning pointer

This commit is contained in:
NIIBE Yutaka
2013-02-25 15:37:10 +09:00
parent d48f448e0f
commit cee25697a3
3 changed files with 6 additions and 6 deletions

View File

@@ -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);