summaryrefslogtreecommitdiff
path: root/hmac.c
diff options
context:
space:
mode:
authorAlistair Delva <adelva@google.com>2020-08-20 16:14:23 -0700
committerAlistair Delva <adelva@google.com>2020-08-20 16:53:18 -0700
commitd9da10d147d633fdb6ec65e17ff4b8447419d83e (patch)
tree8f93e8fdc2907f141e0924910bfec26669819f0b /hmac.c
parent22246b08952d746a7cc5a292570636cf4277598f (diff)
parentecb2c02d994b3e21994f31a70ff911667c262f1f (diff)
Merge upstream-master into master
Commit ecb2c02d994b3e21994f31a70ff911667c262f1f upstream This nearly (but not quite) corresponds to V_8_3_P1; subsequent cherry-picks will correct this. Bug: 162492243 Change-Id: I3c079d86435b7c25aefff4538dc89a3002b1e25b
Diffstat (limited to 'hmac.c')
-rw-r--r--hmac.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/hmac.c b/hmac.c
index d1c12417..7b588019 100644
--- a/hmac.c
+++ b/hmac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hmac.c,v 1.11 2015/01/15 21:37:14 markus Exp $ */
+/* $OpenBSD: hmac.c,v 1.14 2020/02/26 13:40:09 jsg Exp $ */
/*
* Copyright (c) 2014 Markus Friedl. All rights reserved.
*
@@ -18,6 +18,8 @@
#include "includes.h"
#include <sys/types.h>
+
+#include <stdlib.h>
#include <string.h>
#include "sshbuf.h"
@@ -129,8 +131,7 @@ ssh_hmac_free(struct ssh_hmac_ctx *ctx)
explicit_bzero(ctx->buf, ctx->buf_len);
free(ctx->buf);
}
- explicit_bzero(ctx, sizeof(*ctx));
- free(ctx);
+ freezero(ctx, sizeof(*ctx));
}
}
@@ -154,7 +155,7 @@ hmac_test(void *key, size_t klen, void *m, size_t mlen, u_char *e, size_t elen)
if (memcmp(e, digest, elen)) {
for (i = 0; i < elen; i++)
- printf("[%zd] %2.2x %2.2x\n", i, e[i], digest[i]);
+ printf("[%zu] %2.2x %2.2x\n", i, e[i], digest[i]);
printf("mismatch\n");
} else
printf("ok\n");