Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153408664
D16316.id45448.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D16316.id45448.diff
View Options
Index: lib/libmd/md4c.c
===================================================================
--- lib/libmd/md4c.c
+++ lib/libmd/md4c.c
@@ -183,7 +183,7 @@
/* Zeroize sensitive information.
*/
- memset ((POINTER)context, 0, sizeof (*context));
+ explicit_bzero(context, sizeof(*context));
}
/* MD4 basic transformation. Transforms state based on block.
Index: lib/libmd/md5c.c
===================================================================
--- lib/libmd/md5c.c
+++ lib/libmd/md5c.c
@@ -220,7 +220,7 @@
Encode (digest, context->state, 16);
/* Zeroize sensitive information. */
- memset ((void *)context, 0, sizeof (*context));
+ explicit_bzero(context, sizeof(*context));
}
/* MD5 basic transformation. Transforms state based on block. */
Index: lib/libmd/mdX.3
===================================================================
--- lib/libmd/mdX.3
+++ lib/libmd/mdX.3
@@ -8,7 +8,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 26, 2016
+.Dd July 20, 2018
.Dt MDX 3
.Os
.Sh NAME
@@ -78,7 +78,9 @@
run over the data with
.Fn MDXUpdate ,
and finally extract the result using
-.Fn MDXFinal .
+.Fn MDXFinal ,
+which will also erase the
+.Vt MDX_CTX .
.Pp
The
.Fn MDXPad
Index: lib/libmd/ripemd.3
===================================================================
--- lib/libmd/ripemd.3
+++ lib/libmd/ripemd.3
@@ -9,7 +9,7 @@
.\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
.\" $FreeBSD$
.\"
-.Dd April 26, 2016
+.Dd July 20, 2018
.Dt RIPEMD 3
.Os
.Sh NAME
@@ -65,7 +65,9 @@
run over the data with
.Fn RIPEMD160_Update ,
and finally extract the result using
-.Fn RIPEMD160_Final .
+.Fn RIPEMD160_Final ,
+which will also erase the
+.Vt RIPEMD160_CTX .
.Pp
The
.Fn RIPEMD160_End
Index: lib/libmd/rmd160c.c
===================================================================
--- lib/libmd/rmd160c.c
+++ lib/libmd/rmd160c.c
@@ -523,10 +523,8 @@
l=c->D; l2c(l,cp);
l=c->E; l2c(l,cp);
- /* clear stuff, ripemd160_block may be leaving some stuff on the stack
- * but I'm not worried :-) */
- c->num=0;
-/* memset((char *)&c,0,sizeof(c));*/
+ /* Clear the context state */
+ explicit_bzero(&c, sizeof(c));
}
#ifdef undef
Index: lib/libmd/sha.3
===================================================================
--- lib/libmd/sha.3
+++ lib/libmd/sha.3
@@ -9,7 +9,7 @@
.\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
.\" $FreeBSD$
.\"
-.Dd April 26, 2016
+.Dd July 20, 2018
.Dt SHA 3
.Os
.Sh NAME
@@ -100,7 +100,9 @@
run over the data with
.Fn SHA1_Update ,
and finally extract the result using
-.Fn SHA1_Final .
+.Fn SHA1_Final ,
+which will also erase the
+.Vt SHA_CTX .
.Pp
.Fn SHA1_End
is a wrapper for
Index: lib/libmd/sha0c.c
===================================================================
--- lib/libmd/sha0c.c
+++ lib/libmd/sha0c.c
@@ -446,9 +446,7 @@
l=c->h3; nl2c(l,cp);
l=c->h4; nl2c(l,cp);
- /* clear stuff, sha_block may be leaving some stuff on the stack
- * but I'm not worried :-) */
- c->num=0;
-/* memset((char *)&c,0,sizeof(c));*/
+ /* Clear the context state */
+ explicit_bzero(&c, sizeof(c));
}
Index: lib/libmd/sha1c.c
===================================================================
--- lib/libmd/sha1c.c
+++ lib/libmd/sha1c.c
@@ -482,10 +482,8 @@
l=c->h3; nl2c(l,cp);
l=c->h4; nl2c(l,cp);
- /* clear stuff, sha1_block may be leaving some stuff on the stack
- * but I'm not worried :-) */
- c->num=0;
-/* memset((char *)&c,0,sizeof(c));*/
+ /* Clear the context state */
+ explicit_bzero(&c, sizeof(c));
}
#ifdef WEAK_REFS
Index: lib/libmd/sha256.3
===================================================================
--- lib/libmd/sha256.3
+++ lib/libmd/sha256.3
@@ -9,7 +9,7 @@
.\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
.\" $FreeBSD$
.\"
-.Dd July 9, 2018
+.Dd July 20, 2018
.Dt SHA256 3
.Os
.Sh NAME
@@ -88,7 +88,9 @@
run over the data with
.Fn SHA256_Update ,
and finally extract the result using
-.Fn SHA256_Final .
+.Fn SHA256_Final ,
+which will also erase the
+.Vt SHA256_CTX .
.Pp
.Fn SHA256_End
is a wrapper for
Index: lib/libmd/sha512.3
===================================================================
--- lib/libmd/sha512.3
+++ lib/libmd/sha512.3
@@ -9,7 +9,7 @@
.\" From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
.\" $FreeBSD$
.\"
-.Dd April 22, 2016
+.Dd July 20, 2018
.Dt SHA512 3
.Os
.Sh NAME
@@ -110,7 +110,9 @@
run over the data with
.Fn SHA512_Update ,
and finally extract the result using
-.Fn SHA512_Final .
+.Fn SHA512_Final ,
+which will also erase the
+.Vt SHA512_CTX .
.Pp
.Fn SHA512_End
is a wrapper for
Index: lib/libmd/skein.3
===================================================================
--- lib/libmd/skein.3
+++ lib/libmd/skein.3
@@ -124,7 +124,9 @@
run over the data with
.Fn SKEIN256_Update ,
and finally extract the result using
-.Fn SKEIN256_Final .
+.Fn SKEIN256_Final ,
+which will also erase the
+.Vt SKEIN256_CTX .
.Pp
.Fn SKEIN256_End
is a wrapper for
Index: sys/crypto/sha2/sha256c.c
===================================================================
--- sys/crypto/sha2/sha256c.c
+++ sys/crypto/sha2/sha256c.c
@@ -298,7 +298,7 @@
be32enc_vect(digest, ctx->state, SHA256_DIGEST_LENGTH);
/* Clear the context state */
- memset(ctx, 0, sizeof(*ctx));
+ explicit_bzero(ctx, sizeof(*ctx));
}
/*** SHA-224: *********************************************************/
Index: sys/crypto/sha2/sha512c.c
===================================================================
--- sys/crypto/sha2/sha512c.c
+++ sys/crypto/sha2/sha512c.c
@@ -331,7 +331,7 @@
be64enc_vect(digest, ctx->state, SHA512_DIGEST_LENGTH);
/* Clear the context state */
- memset(ctx, 0, sizeof(*ctx));
+ explicit_bzero(ctx, sizeof(*ctx));
}
/*** SHA-512t: *********************************************************/
@@ -374,7 +374,7 @@
be64enc_vect(digest, ctx->state, SHA512_224_DIGEST_LENGTH);
/* Clear the context state */
- memset(ctx, 0, sizeof(*ctx));
+ explicit_bzero(ctx, sizeof(*ctx));
}
void
@@ -413,7 +413,7 @@
be64enc_vect(digest, ctx->state, SHA512_256_DIGEST_LENGTH);
/* Clear the context state */
- memset(ctx, 0, sizeof(*ctx));
+ explicit_bzero(ctx, sizeof(*ctx));
}
/*** SHA-384: *********************************************************/
@@ -463,7 +463,7 @@
be64enc_vect(digest, ctx->state, SHA384_DIGEST_LENGTH);
/* Clear the context state */
- memset(ctx, 0, sizeof(*ctx));
+ explicit_bzero(ctx, sizeof(*ctx));
}
#ifdef WEAK_REFS
Index: sys/crypto/skein/skein.c
===================================================================
--- sys/crypto/skein/skein.c
+++ sys/crypto/skein/skein.c
@@ -812,6 +812,7 @@
{
Skein_256_Final(ctx, digest);
+ explicit_bzero(ctx, sizeof(*ctx));
}
void
@@ -819,6 +820,7 @@
{
Skein_512_Final(ctx, digest);
+ explicit_bzero(ctx, sizeof(*ctx));
}
void
@@ -826,6 +828,7 @@
{
Skein1024_Final(ctx, digest);
+ explicit_bzero(ctx, sizeof(*ctx));
}
#ifdef WEAK_REFS
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 22, 12:19 AM (2 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31940941
Default Alt Text
D16316.id45448.diff (6 KB)
Attached To
Mode
D16316: Consistently use explicit_bzero() for _Final methods.
Attached
Detach File
Event Timeline
Log In to Comment