summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2015-06-26 11:51:52 +0100
committerRichard Hughes <richard@hughsie.com>2015-06-26 12:01:00 +0100
commit2801cba5ac52436d6cc5c8d6877eb661375e26ca (patch)
tree374a88ee5ebf9ed1b42d6e44eb24436fa4803da3
parent2b26b510bab62ec9505c6edce09d6615b55396e3 (diff)
downloadcolord-2801cba5ac52436d6cc5c8d6877eb661375e26ca.tar.gz
ColorHug: When converting HEX to BIN pad out the entire size
This allows us to get a SHA1 hash that we can verify from the device.
-rw-r--r--lib/colorhug/ch-inhx32.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/colorhug/ch-inhx32.c b/lib/colorhug/ch-inhx32.c
index 57aa6f5..0b7827e 100644
--- a/lib/colorhug/ch-inhx32.c
+++ b/lib/colorhug/ch-inhx32.c
@@ -178,9 +178,8 @@ ch_inhx32_to_bin_full (const gchar *in_buffer,
offset = ptr - in_buffer;
}
- /* ensure flash finishes on a 64 byte boundary */
- end = string->len % CH_FLASH_WRITE_BLOCK_SIZE;
- for (i = 0; i < CH_FLASH_WRITE_BLOCK_SIZE - end; i++)
+ /* pad out to device size so we can read back a verifiable blob */
+ for (i = string->len; i < runcode_addr; i++)
g_string_append_len (string, "\0", 1);
/* save data */