summaryrefslogtreecommitdiff
path: root/chip/g
diff options
context:
space:
mode:
Diffstat (limited to 'chip/g')
-rw-r--r--chip/g/crypto_api.c8
-rw-r--r--chip/g/dcrypto/app_cipher.c5
-rw-r--r--chip/g/upgrade_fw.c2
3 files changed, 7 insertions, 8 deletions
diff --git a/chip/g/crypto_api.c b/chip/g/crypto_api.c
index 9c0c7bb8f5..075472238d 100644
--- a/chip/g/crypto_api.c
+++ b/chip/g/crypto_api.c
@@ -7,8 +7,8 @@
#include "crypto_api.h"
#include "dcrypto.h"
-void app_compute_hash(uint8_t *p_buf, size_t num_bytes,
- uint8_t *p_hash, size_t hash_len)
+void app_compute_hash(const void *p_buf, size_t num_bytes, void *p_hash,
+ size_t hash_len)
{
uint8_t sha1_digest[SHA_DIGEST_SIZE];
@@ -16,12 +16,12 @@ void app_compute_hash(uint8_t *p_buf, size_t num_bytes,
* Use the built in dcrypto engine to generate the sha1 hash of the
* buffer.
*/
- DCRYPTO_SHA1_hash((uint8_t *)p_buf, num_bytes, sha1_digest);
+ DCRYPTO_SHA1_hash(p_buf, num_bytes, sha1_digest);
memcpy(p_hash, sha1_digest, MIN(hash_len, sizeof(sha1_digest)));
if (hash_len > sizeof(sha1_digest))
- memset(p_hash + sizeof(sha1_digest), 0,
+ memset((uint8_t *)p_hash + sizeof(sha1_digest), 0,
hash_len - sizeof(sha1_digest));
}
diff --git a/chip/g/dcrypto/app_cipher.c b/chip/g/dcrypto/app_cipher.c
index e465598718..125b443ee6 100644
--- a/chip/g/dcrypto/app_cipher.c
+++ b/chip/g/dcrypto/app_cipher.c
@@ -323,7 +323,7 @@ static int command_loop(struct test_info *pinfo)
* Prepare the hash of the original data to be able to verify
* results.
*/
- DCRYPTO_SHA1_hash((uint8_t *)(pinfo->p), pinfo->test_blob_size, sha);
+ DCRYPTO_SHA1_hash(pinfo->p, pinfo->test_blob_size, sha);
/* Use the hash as an IV for the cipher. */
memcpy(sha_after, sha, sizeof(sha_after));
@@ -369,8 +369,7 @@ static int command_loop(struct test_info *pinfo)
return EC_ERROR_UNKNOWN;
}
- DCRYPTO_SHA1_hash((uint8_t *)(pinfo->p),
- pinfo->test_blob_size, sha_after);
+ DCRYPTO_SHA1_hash(pinfo->p, pinfo->test_blob_size, sha_after);
if (memcmp(sha, sha_after, sizeof(sha))) {
ccprintf("\n"
"sha1 before and after mismatch, %d to go!\n",
diff --git a/chip/g/upgrade_fw.c b/chip/g/upgrade_fw.c
index 276eac8f92..727af4b7d9 100644
--- a/chip/g/upgrade_fw.c
+++ b/chip/g/upgrade_fw.c
@@ -148,7 +148,7 @@ int usb_pdu_valid(struct upgrade_command *cmd_body, size_t cmd_size)
cmd.block_base);
/* Check if the block was received properly. */
- DCRYPTO_SHA1_hash((uint8_t *)&cmd_body->block_base,
+ DCRYPTO_SHA1_hash(&cmd_body->block_base,
body_size + sizeof(cmd_body->block_base),
sha1_digest);
if (memcmp(sha1_digest, &cmd_body->block_digest,