From 9738e042f90942ef782381f747d21709f3b37c62 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Thu, 13 Sep 2018 16:43:30 +0100 Subject: [PATCH] Clean up a couple of consts and char pointers. hmacmd5_do_hmac and hmac_sha1_simple should be consistently referring to input memory blocks as 'const void *', but one had pointlessly typed the pointer as 'const unsigned char *' and the other had missed out the consts. --- ssh.h | 5 +++-- sshmd5.c | 2 +- sshsha.c | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ssh.h b/ssh.h index ff4305b0..0b2d78ec 100644 --- a/ssh.h +++ b/ssh.h @@ -380,7 +380,7 @@ struct hmacmd5_context *hmacmd5_make_context(void); void hmacmd5_free_context(struct hmacmd5_context *ctx); void hmacmd5_key(struct hmacmd5_context *ctx, void const *key, int len); void hmacmd5_do_hmac(struct hmacmd5_context *ctx, - unsigned char const *blk, int len, unsigned char *hmac); + const void *blk, int len, unsigned char *hmac); int supports_sha_ni(void); @@ -396,7 +396,8 @@ void SHA_Init(SHA_State * s); void SHA_Final(SHA_State * s, unsigned char *output); void SHA_Simple(const void *p, int len, unsigned char *output); -void hmac_sha1_simple(void *key, int keylen, void *data, int datalen, +void hmac_sha1_simple(const void *key, int keylen, + const void *data, int datalen, unsigned char *output); typedef struct SHA256_State { uint32 h[8]; diff --git a/sshmd5.c b/sshmd5.c index 87a224d9..35a21df4 100644 --- a/sshmd5.c +++ b/sshmd5.c @@ -312,7 +312,7 @@ static void hmacmd5_genresult(ssh2_mac *mac, unsigned char *hmac) } void hmacmd5_do_hmac(struct hmacmd5_context *ctx, - unsigned char const *blk, int len, unsigned char *hmac) + const void *blk, int len, unsigned char *hmac) { ssh2_mac_start(&ctx->mac); put_data(&ctx->mac, blk, len); diff --git a/sshsha.c b/sshsha.c index f93c2a1f..282e98a3 100644 --- a/sshsha.c +++ b/sshsha.c @@ -360,7 +360,8 @@ static void hmacsha1_genresult(ssh2_mac *mac, unsigned char *hmac) smemclr(intermediate, sizeof(intermediate)); } -void hmac_sha1_simple(void *key, int keylen, void *data, int datalen, +void hmac_sha1_simple(const void *key, int keylen, + const void *data, int datalen, unsigned char *output) { SHA_State states[2]; unsigned char intermediate[20];