> > found by jsg.
> >
> > Index: lib/isc/hmacsha.c
> > ===================================================================
> > RCS file: /home/tedu/cvs/src/usr.sbin/bind/lib/isc/hmacsha.c,v
> > retrieving revision 1.1.1.1
> > diff -u -p -r1.1.1.1 hmacsha.c
> > --- lib/isc/hmacsha.c 9 Dec 2007 12:34:04 -0000 1.1.1.1
> > +++ lib/isc/hmacsha.c 5 Jul 2011 18:43:15 -0000
> > @@ -65,7 +65,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));
>
> Then what purpose is there to keep ctx->key memset before?
indeed, and there is another isc_sha1_invalidate() that can also be rm'd.
Index: lib/isc/hmacsha.c
===================================================================
RCS file: /cvs/src/usr.sbin/bind/lib/isc/hmacsha.c,v
retrieving revision 1.1.1.1
diff -u -p -u -r1.1.1.1 hmacsha.c
--- lib/isc/hmacsha.c 9 Dec 2007 12:34:04 -0000 1.1.1.1
+++ lib/isc/hmacsha.c 5 Jul 2011 19:47:41 -0000
@@ -63,9 +63,7 @@ isc_hmacsha1_init(isc_hmacsha1_t *ctx, c
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));
}
/*
@@ -145,8 +143,7 @@ isc_hmacsha224_init(isc_hmacsha224_t *ct
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));
}
/*
@@ -225,8 +222,7 @@ isc_hmacsha256_init(isc_hmacsha256_t *ct
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));
}
/*
@@ -305,8 +301,7 @@ isc_hmacsha384_init(isc_hmacsha384_t *ct
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));
}
/*
@@ -385,8 +380,7 @@ isc_hmacsha512_init(isc_hmacsha512_t *ct
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));
}
/*
Index: lib/isc/sha2.c
===================================================================
RCS file: /cvs/src/usr.sbin/bind/lib/isc/sha2.c,v
retrieving revision 1.1.1.1
diff -u -p -u -r1.1.1.1 sha2.c
--- lib/isc/sha2.c 9 Dec 2007 12:34:06 -0000 1.1.1.1
+++ lib/isc/sha2.c 5 Jul 2011 19:43:24 -0000
@@ -445,7 +445,7 @@ isc_sha224_end(isc_sha224_t *context, ch
}
*buffer = (char)0;
} else {
- memset(context, 0, sizeof(context));
+ memset(context, 0, sizeof(*context));
}
memset(digest, 0, ISC_SHA224_DIGESTLENGTH);
return buffer;
@@ -768,7 +768,7 @@ isc_sha256_final(isc_uint8_t digest[], i
}
/* Clean up state data: */
- memset(context, 0, sizeof(context));
+ memset(context, 0, sizeof(*context));
usedspace = 0;
}
@@ -790,7 +790,7 @@ isc_sha256_end(isc_sha256_t *context, ch
}
*buffer = (char)0;
} else {
- memset(context, 0, sizeof(context));
+ memset(context, 0, sizeof(*context));
}
memset(digest, 0, ISC_SHA256_DIGESTLENGTH);
return buffer;
@@ -1112,7 +1112,7 @@ void isc_sha512_final(isc_uint8_t digest
}
/* Zero out state data */
- memset(context, 0, sizeof(context));
+ memset(context, 0, sizeof(*context));
}
char *
@@ -1133,7 +1133,7 @@ isc_sha512_end(isc_sha512_t *context, ch
}
*buffer = (char)0;
} else {
- memset(context, 0, sizeof(context));
+ memset(context, 0, sizeof(*context));
}
memset(digest, 0, ISC_SHA512_DIGESTLENGTH);
return buffer;
@@ -1195,7 +1195,7 @@ isc_sha384_final(isc_uint8_t digest[], i
}
/* Zero out state data */
- memset(context, 0, sizeof(context));
+ memset(context, 0, sizeof(*context));
}
char *
@@ -1216,7 +1216,7 @@ isc_sha384_end(isc_sha384_t *context, ch
}
*buffer = (char)0;
} else {
- memset(context, 0, sizeof(context));
+ memset(context, 0, sizeof(*context));
}
memset(digest, 0, ISC_SHA384_DIGESTLENGTH);
return buffer;