|
@ -1,4 +1,4 @@ |
|
|
/* $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 |
|
|
* FILE: sha2.c |
|
@ -316,7 +316,7 @@ SHA224Final(u_int8_t digest[SHA224_DIGEST_LENGTH], SHA2_CTX *context) |
|
|
#else |
|
|
#else |
|
|
memcpy(digest, context->state.st32, SHA224_DIGEST_LENGTH); |
|
|
memcpy(digest, context->state.st32, SHA224_DIGEST_LENGTH); |
|
|
#endif |
|
|
#endif |
|
|
memset(context, 0, sizeof(*context)); |
|
|
|
|
|
|
|
|
explicit_bzero(context, sizeof(*context)); |
|
|
} |
|
|
} |
|
|
#endif /* !defined(SHA2_SMALL) */ |
|
|
#endif /* !defined(SHA2_SMALL) */ |
|
|
|
|
|
|
|
@ -591,7 +591,7 @@ SHA256Final(u_int8_t digest[SHA256_DIGEST_LENGTH], SHA2_CTX *context) |
|
|
#else |
|
|
#else |
|
|
memcpy(digest, context->state.st32, SHA256_DIGEST_LENGTH); |
|
|
memcpy(digest, context->state.st32, SHA256_DIGEST_LENGTH); |
|
|
#endif |
|
|
#endif |
|
|
memset(context, 0, sizeof(*context)); |
|
|
|
|
|
|
|
|
explicit_bzero(context, sizeof(*context)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -867,7 +867,7 @@ SHA512Final(u_int8_t digest[SHA512_DIGEST_LENGTH], SHA2_CTX *context) |
|
|
#else |
|
|
#else |
|
|
memcpy(digest, context->state.st64, SHA512_DIGEST_LENGTH); |
|
|
memcpy(digest, context->state.st64, SHA512_DIGEST_LENGTH); |
|
|
#endif |
|
|
#endif |
|
|
memset(context, 0, sizeof(*context)); |
|
|
|
|
|
|
|
|
explicit_bzero(context, sizeof(*context)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if !defined(SHA2_SMALL) |
|
|
#if !defined(SHA2_SMALL) |
|
@ -901,6 +901,6 @@ SHA384Final(u_int8_t digest[SHA384_DIGEST_LENGTH], SHA2_CTX *context) |
|
|
memcpy(digest, context->state.st64, SHA384_DIGEST_LENGTH); |
|
|
memcpy(digest, context->state.st64, SHA384_DIGEST_LENGTH); |
|
|
#endif |
|
|
#endif |
|
|
/* Zero out state data */ |
|
|
/* Zero out state data */ |
|
|
memset(context, 0, sizeof(*context)); |
|
|
|
|
|
|
|
|
explicit_bzero(context, sizeof(*context)); |
|
|
} |
|
|
} |
|
|
#endif /* !defined(SHA2_SMALL) */ |
|
|
#endif /* !defined(SHA2_SMALL) */ |