Browse Source

Clear the digest local var w/ memset() in the End function.

OPENBSD_3_4
millert 21 years ago
parent
commit
4f2de66d7b
2 changed files with 14 additions and 12 deletions
  1. +7
    -6
      src/lib/libc/hash/rmd160hl.c
  2. +7
    -6
      src/lib/libc/hash/sha1hl.c

+ 7
- 6
src/lib/libc/hash/rmd160hl.c View File

@ -8,17 +8,17 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$OpenBSD: rmd160hl.c,v 1.3 2002/12/23 04:33:31 millert Exp $";
static char rcsid[] = "$OpenBSD: rmd160hl.c,v 1.4 2003/05/08 23:32:21 millert Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <rmd160.h> #include <rmd160.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
/* ARGSUSED */ /* ARGSUSED */
char * char *
@ -37,6 +37,7 @@ RMD160End(RMD160_CTX *ctx, char *buf)
buf[i + i + 1] = hex[digest[i] & 0x0f]; buf[i + i + 1] = hex[digest[i] & 0x0f];
} }
buf[i + i] = '\0'; buf[i + i] = '\0';
memset(digest, 0, sizeof(digest));
return(buf); return(buf);
} }


+ 7
- 6
src/lib/libc/hash/sha1hl.c View File

@ -8,17 +8,17 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] = "$OpenBSD: sha1hl.c,v 1.3 2002/12/23 04:33:31 millert Exp $";
static const char rcsid[] = "$OpenBSD: sha1hl.c,v 1.4 2003/05/08 23:32:21 millert Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <unistd.h>
#include <sha1.h> #include <sha1.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
/* ARGSUSED */ /* ARGSUSED */
char * char *
@ -37,6 +37,7 @@ SHA1End(SHA1_CTX *ctx, char *buf)
buf[i + i + 1] = hex[digest[i] & 0x0f]; buf[i + i + 1] = hex[digest[i] & 0x0f];
} }
buf[i + i] = '\0'; buf[i + i] = '\0';
memset(digest, 0, sizeof(digest));
return(buf); return(buf);
} }


Loading…
Cancel
Save