Fix memset usage. XXX audit the rest where hard coded sizes are used
This commit is contained in:
parent
db3c8201d3
commit
b58b5b09d9
12
external/bsd/bind/dist/lib/isc/hmacsha.c
vendored
12
external/bsd/bind/dist/lib/isc/hmacsha.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hmacsha.c,v 1.2 2011/02/16 03:47:11 christos Exp $ */
|
||||
/* $NetBSD: hmacsha.c,v 1.3 2011/07/01 02:24:14 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2005-2007, 2009 Internet Systems Consortium, Inc. ("ISC")
|
||||
@ -227,7 +227,7 @@ void
|
||||
isc_hmacsha1_invalidate(isc_hmacsha1_t *ctx) {
|
||||
isc_sha1_invalidate(&ctx->sha1ctx);
|
||||
memset(ctx->key, 0, sizeof(ctx->key));
|
||||
memset(ctx, 0, sizeof(ctx));
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -295,7 +295,7 @@ isc_hmacsha224_init(isc_hmacsha224_t *ctx, const unsigned char *key,
|
||||
void
|
||||
isc_hmacsha224_invalidate(isc_hmacsha224_t *ctx) {
|
||||
memset(ctx->key, 0, sizeof(ctx->key));
|
||||
memset(ctx, 0, sizeof(ctx));
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -362,7 +362,7 @@ isc_hmacsha256_init(isc_hmacsha256_t *ctx, const unsigned char *key,
|
||||
void
|
||||
isc_hmacsha256_invalidate(isc_hmacsha256_t *ctx) {
|
||||
memset(ctx->key, 0, sizeof(ctx->key));
|
||||
memset(ctx, 0, sizeof(ctx));
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -429,7 +429,7 @@ isc_hmacsha384_init(isc_hmacsha384_t *ctx, const unsigned char *key,
|
||||
void
|
||||
isc_hmacsha384_invalidate(isc_hmacsha384_t *ctx) {
|
||||
memset(ctx->key, 0, sizeof(ctx->key));
|
||||
memset(ctx, 0, sizeof(ctx));
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -496,7 +496,7 @@ isc_hmacsha512_init(isc_hmacsha512_t *ctx, const unsigned char *key,
|
||||
void
|
||||
isc_hmacsha512_invalidate(isc_hmacsha512_t *ctx) {
|
||||
memset(ctx->key, 0, sizeof(ctx->key));
|
||||
memset(ctx, 0, sizeof(ctx));
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
}
|
||||
|
||||
/*
|
||||
|
16
external/bsd/bind/dist/lib/isc/sha2.c
vendored
16
external/bsd/bind/dist/lib/isc/sha2.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sha2.c,v 1.2 2011/02/16 03:47:11 christos Exp $ */
|
||||
/* $NetBSD: sha2.c,v 1.3 2011/07/01 02:24:14 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2005-2007, 2009 Internet Systems Consortium, Inc. ("ISC")
|
||||
@ -897,7 +897,7 @@ isc_sha256_final(isc_uint8_t digest[], isc_sha256_t *context) {
|
||||
}
|
||||
|
||||
/* Clean up state data: */
|
||||
memset(context, 0, sizeof(context));
|
||||
memset(context, 0, sizeof(*context));
|
||||
usedspace = 0;
|
||||
}
|
||||
|
||||
@ -1210,7 +1210,7 @@ void isc_sha512_final(isc_uint8_t digest[], isc_sha512_t *context) {
|
||||
}
|
||||
|
||||
/* Zero out state data */
|
||||
memset(context, 0, sizeof(context));
|
||||
memset(context, 0, sizeof(*context));
|
||||
}
|
||||
|
||||
|
||||
@ -1263,7 +1263,7 @@ isc_sha384_final(isc_uint8_t digest[], isc_sha384_t *context) {
|
||||
}
|
||||
|
||||
/* Zero out state data */
|
||||
memset(context, 0, sizeof(context));
|
||||
memset(context, 0, sizeof(*context));
|
||||
}
|
||||
#endif /* !ISC_PLATFORM_OPENSSLHASH */
|
||||
|
||||
@ -1294,7 +1294,7 @@ isc_sha224_end(isc_sha224_t *context, char buffer[]) {
|
||||
#ifdef ISC_PLATFORM_OPENSSLHASH
|
||||
EVP_MD_CTX_cleanup(context);
|
||||
#else
|
||||
memset(context, 0, sizeof(context));
|
||||
memset(context, 0, sizeof(*context));
|
||||
#endif
|
||||
}
|
||||
memset(digest, 0, ISC_SHA224_DIGESTLENGTH);
|
||||
@ -1333,7 +1333,7 @@ isc_sha256_end(isc_sha256_t *context, char buffer[]) {
|
||||
#ifdef ISC_PLATFORM_OPENSSLHASH
|
||||
EVP_MD_CTX_cleanup(context);
|
||||
#else
|
||||
memset(context, 0, sizeof(context));
|
||||
memset(context, 0, sizeof(*context));
|
||||
#endif
|
||||
}
|
||||
memset(digest, 0, ISC_SHA256_DIGESTLENGTH);
|
||||
@ -1372,7 +1372,7 @@ isc_sha512_end(isc_sha512_t *context, char buffer[]) {
|
||||
#ifdef ISC_PLATFORM_OPENSSLHASH
|
||||
EVP_MD_CTX_cleanup(context);
|
||||
#else
|
||||
memset(context, 0, sizeof(context));
|
||||
memset(context, 0, sizeof(*context));
|
||||
#endif
|
||||
}
|
||||
memset(digest, 0, ISC_SHA512_DIGESTLENGTH);
|
||||
@ -1411,7 +1411,7 @@ isc_sha384_end(isc_sha384_t *context, char buffer[]) {
|
||||
#ifdef ISC_PLATFORM_OPENSSLHASH
|
||||
EVP_MD_CTX_cleanup(context);
|
||||
#else
|
||||
memset(context, 0, sizeof(context));
|
||||
memset(context, 0, sizeof(*context));
|
||||
#endif
|
||||
}
|
||||
memset(digest, 0, ISC_SHA384_DIGESTLENGTH);
|
||||
|
Loading…
Reference in New Issue
Block a user