-/* $OpenBSD: helper.c,v 1.11 2014/04/03 17:55:27 beck Exp $ */
+/* $OpenBSD: helper.c,v 1.12 2015/01/15 13:05:59 millert Exp $ */
/*
* Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
buf[i + i + 1] = hex[digest[i] & 0x0f];
}
buf[i + i] = '\0';
- memset(digest, 0, sizeof(digest));
+ explicit_bzero(digest, sizeof(digest));
return (buf);
}
-/* $OpenBSD: md5.c,v 1.9 2014/01/08 06:14:57 tedu Exp $ */
+/* $OpenBSD: md5.c,v 1.10 2015/01/15 13:05:59 millert Exp $ */
/*
* This code implements the MD5 message-digest algorithm.
MD5Pad(ctx);
for (i = 0; i < 4; i++)
PUT_32BIT_LE(digest + i * 4, ctx->state[i]);
- memset(ctx, 0, sizeof(*ctx));
+ explicit_bzero(ctx, sizeof(*ctx));
}
-/* $OpenBSD: sha1.c,v 1.23 2014/01/08 06:14:57 tedu Exp $ */
+/* $OpenBSD: sha1.c,v 1.24 2015/01/15 13:05:59 millert Exp $ */
/*
* SHA-1 in C
digest[i] = (u_int8_t)
((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
}
- memset(context, 0, sizeof(*context));
+ explicit_bzero(context, sizeof(*context));
}
-/* $OpenBSD: sha2.c,v 1.22 2014/12/19 15:14:04 tedu Exp $ */
+/* $OpenBSD: sha2.c,v 1.23 2015/01/15 13:05:59 millert Exp $ */
/*
* FILE: sha2.c
#else
memcpy(digest, context->state.st32, SHA224_DIGEST_LENGTH);
#endif
- memset(context, 0, sizeof(*context));
+ explicit_bzero(context, sizeof(*context));
}
#endif /* !defined(SHA2_SMALL) */
#else
memcpy(digest, context->state.st32, SHA256_DIGEST_LENGTH);
#endif
- memset(context, 0, sizeof(*context));
+ explicit_bzero(context, sizeof(*context));
}
#else
memcpy(digest, context->state.st64, SHA512_DIGEST_LENGTH);
#endif
- memset(context, 0, sizeof(*context));
+ explicit_bzero(context, sizeof(*context));
}
#if !defined(SHA2_SMALL)
memcpy(digest, context->state.st64, SHA384_DIGEST_LENGTH);
#endif
/* Zero out state data */
- memset(context, 0, sizeof(*context));
+ explicit_bzero(context, sizeof(*context));
}
#endif /* !defined(SHA2_SMALL) */