diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2016-09-10 16:38:17 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2016-09-10 16:38:17 +0000 |
commit | cfefb69aaaa865bbee77272f5a62148e8e90439b (patch) | |
tree | 35a913a3ae3244c1003538ea731d8353cb8ffa24 | |
parent | 772fb79f5d8129e545393a381ffb9b836bc68db9 (diff) |
Rename libsa pbkdf2.c to pkcs5_pbkdf2.c so that we match libutil.
-rw-r--r-- | sys/arch/amd64/stand/boot/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/amd64/stand/cdboot/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/amd64/stand/efiboot/Makefile.common | 4 | ||||
-rw-r--r-- | sys/arch/amd64/stand/libsa/softraid.c | 4 | ||||
-rw-r--r-- | sys/arch/amd64/stand/pxeboot/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/i386/stand/boot/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/i386/stand/cdboot/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/softraid.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/stand/pxeboot/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/Makefile | 4 | ||||
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/softraid.c | 4 | ||||
-rw-r--r-- | sys/lib/libsa/pkcs5_pbkdf2.c (renamed from sys/lib/libsa/pbkdf2.c) | 22 | ||||
-rw-r--r-- | sys/lib/libsa/pkcs5_pbkdf2.h (renamed from sys/lib/libsa/pbkdf2.h) | 6 |
13 files changed, 35 insertions, 37 deletions
diff --git a/sys/arch/amd64/stand/boot/Makefile b/sys/arch/amd64/stand/boot/Makefile index 567f85967f4..f72e55658fb 100644 --- a/sys/arch/amd64/stand/boot/Makefile +++ b/sys/arch/amd64/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.32 2016/07/30 03:25:48 guenther Exp $ +# $OpenBSD: Makefile,v 1.33 2016/09/10 16:38:16 jsing Exp $ COPTS?= MAN?= boot.8 @@ -40,7 +40,7 @@ SRCS+= close.c closeall.c cons.c cread.c dev.c disklabel.c dkcksum.c fstat.c \ SRCS+= elf32.c elf64.c loadfile.c SRCS+= ufs.c .if ${SOFTRAID:L} == "yes" -SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pbkdf2.c rijndael.c sha1.c +SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pkcs5_pbkdf2.c rijndael.c sha1.c .endif .PATH: ${S}/lib/libkern diff --git a/sys/arch/amd64/stand/cdboot/Makefile b/sys/arch/amd64/stand/cdboot/Makefile index e431f4be3f9..57921f17803 100644 --- a/sys/arch/amd64/stand/cdboot/Makefile +++ b/sys/arch/amd64/stand/cdboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.28 2016/07/30 03:25:48 guenther Exp $ +# $OpenBSD: Makefile,v 1.29 2016/09/10 16:38:16 jsing Exp $ MAN= cdboot.8 @@ -32,7 +32,7 @@ SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c lseek.c \ open.c read.c stat.c cread.c readdir.c cons.c loadfile.c \ elf32.c elf64.c SRCS+= ufs.c cd9660.c -SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pbkdf2.c rijndael.c sha1.c +SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pkcs5_pbkdf2.c rijndael.c sha1.c .PATH: ${S}/lib/libkern/arch/i386 ${S}/lib/libkern SRCS+= divdi3.c moddi3.c qdivrem.c diff --git a/sys/arch/amd64/stand/efiboot/Makefile.common b/sys/arch/amd64/stand/efiboot/Makefile.common index da2646d6664..9219ccff71e 100644 --- a/sys/arch/amd64/stand/efiboot/Makefile.common +++ b/sys/arch/amd64/stand/efiboot/Makefile.common @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.common,v 1.6 2016/08/31 15:11:22 yasuoka Exp $ +# $OpenBSD: Makefile.common,v 1.7 2016/09/10 16:38:16 jsing Exp $ S= ${.CURDIR}/../../../../.. SADIR= ${.CURDIR}/../.. @@ -38,7 +38,7 @@ SRCS+= close.c closeall.c cons.c cread.c dev.c disklabel.c dkcksum.c fstat.c \ lseek.c open.c read.c readdir.c stat.c SRCS+= ufs.c cd9660.c .if ${SOFTRAID:L} == "yes" -SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pbkdf2.c rijndael.c sha1.c +SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pkcs5_pbkdf2.c rijndael.c sha1.c .endif .PATH: ${S}/lib/libz diff --git a/sys/arch/amd64/stand/libsa/softraid.c b/sys/arch/amd64/stand/libsa/softraid.c index a8fca46b02a..88299a3432c 100644 --- a/sys/arch/amd64/stand/libsa/softraid.c +++ b/sys/arch/amd64/stand/libsa/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.25 2016/01/06 16:12:20 krw Exp $ */ +/* $OpenBSD: softraid.c,v 1.26 2016/09/10 16:38:16 jsing Exp $ */ /* * Copyright (c) 2012 Joel Sing <jsing@openbsd.org> @@ -26,7 +26,7 @@ #include <lib/libsa/aes_xts.h> #include <lib/libsa/hmac_sha1.h> -#include <lib/libsa/pbkdf2.h> +#include <lib/libsa/pkcs5_pbkdf2.h> #include <lib/libsa/rijndael.h> #include <lib/libz/zlib.h> diff --git a/sys/arch/amd64/stand/pxeboot/Makefile b/sys/arch/amd64/stand/pxeboot/Makefile index 57f7cde6fc6..2058e08f973 100644 --- a/sys/arch/amd64/stand/pxeboot/Makefile +++ b/sys/arch/amd64/stand/pxeboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.26 2016/07/30 03:25:48 guenther Exp $ +# $OpenBSD: Makefile,v 1.27 2016/09/10 16:38:16 jsing Exp $ MAN= pxeboot.8 @@ -31,7 +31,7 @@ SRCS+= alloc.c exit.c getchar.c getfile.c getln.c globals.c putchar.c \ strcmp.c strlen.c strncmp.c memcmp.c memcpy.c memset.c printf.c \ snprintf.c strerror.c strncpy.c strtol.c strtoll.c ctime.c strlcpy.c \ strlcat.c -SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pbkdf2.c rijndael.c sha1.c +SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pkcs5_pbkdf2.c rijndael.c sha1.c SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \ read.c stat.c write.c cread.c readdir.c cons.c loadfile.c \ diff --git a/sys/arch/i386/stand/boot/Makefile b/sys/arch/i386/stand/boot/Makefile index e227dae8534..7a45dcefa94 100644 --- a/sys/arch/i386/stand/boot/Makefile +++ b/sys/arch/i386/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.60 2016/07/30 03:25:48 guenther Exp $ +# $OpenBSD: Makefile,v 1.61 2016/09/10 16:38:16 jsing Exp $ COPTS?= MAN?= boot.8 @@ -44,7 +44,7 @@ SRCS+= close.c closeall.c cons.c cread.c dev.c disklabel.c dkcksum.c fstat.c \ SRCS+= elf32.c elf64.c loadfile.c SRCS+= ufs.c .if ${SOFTRAID:L} == "yes" -SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pbkdf2.c rijndael.c sha1.c +SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pkcs5_pbkdf2.c rijndael.c sha1.c .endif .PATH: ${S}/lib/libkern diff --git a/sys/arch/i386/stand/cdboot/Makefile b/sys/arch/i386/stand/cdboot/Makefile index ff9c01452b5..0d94398fd17 100644 --- a/sys/arch/i386/stand/cdboot/Makefile +++ b/sys/arch/i386/stand/cdboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.25 2016/07/30 03:25:48 guenther Exp $ +# $OpenBSD: Makefile,v 1.26 2016/09/10 16:38:16 jsing Exp $ MAN= cdboot.8 @@ -34,7 +34,7 @@ SRCS+= close.c closeall.c cons.c cread.c dev.c disklabel.c dkcksum.c fstat.c \ lseek.c open.c read.c readdir.c stat.c SRCS+= elf32.c elf64.c loadfile.c SRCS+= cd9660.c ufs.c -SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pbkdf2.c rijndael.c sha1.c +SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pkcs5_pbkdf2.c rijndael.c sha1.c .PATH: ${S}/lib/libkern/arch/i386 SRCS+= moddi3.c divdi3.c qdivrem.c diff --git a/sys/arch/i386/stand/libsa/softraid.c b/sys/arch/i386/stand/libsa/softraid.c index 22e861b815c..06bbc554509 100644 --- a/sys/arch/i386/stand/libsa/softraid.c +++ b/sys/arch/i386/stand/libsa/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.16 2016/01/07 00:56:46 krw Exp $ */ +/* $OpenBSD: softraid.c,v 1.17 2016/09/10 16:38:16 jsing Exp $ */ /* * Copyright (c) 2012 Joel Sing <jsing@openbsd.org> @@ -26,7 +26,7 @@ #include <lib/libsa/aes_xts.h> #include <lib/libsa/hmac_sha1.h> -#include <lib/libsa/pbkdf2.h> +#include <lib/libsa/pkcs5_pbkdf2.h> #include <lib/libsa/rijndael.h> #include "libsa.h" diff --git a/sys/arch/i386/stand/pxeboot/Makefile b/sys/arch/i386/stand/pxeboot/Makefile index d2dbd231cc0..e772f88dd43 100644 --- a/sys/arch/i386/stand/pxeboot/Makefile +++ b/sys/arch/i386/stand/pxeboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.22 2016/07/30 03:25:48 guenther Exp $ +# $OpenBSD: Makefile,v 1.23 2016/09/10 16:38:16 jsing Exp $ MAN= pxeboot.8 @@ -36,7 +36,7 @@ SRCS+= close.c closeall.c cons.c cread.c dev.c disklabel.c dkcksum.c fstat.c \ SRCS+= elf32.c elf64.c loadfile.c SRCS+= nfs.c ufs.c tftp.c SRCS+= bootp.c ether.c net.c netif.c rpc.c -SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pbkdf2.c rijndael.c sha1.c +SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c pkcs5_pbkdf2.c rijndael.c sha1.c .PATH: ${S}/lib/libkern/arch/i386 SRCS+= divdi3.c moddi3.c qdivrem.c udivdi3.c umoddi3.c diff --git a/sys/arch/sparc64/stand/ofwboot/Makefile b/sys/arch/sparc64/stand/ofwboot/Makefile index f030b699294..d4eddbcadc2 100644 --- a/sys/arch/sparc64/stand/ofwboot/Makefile +++ b/sys/arch/sparc64/stand/ofwboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.20 2016/07/30 03:25:49 guenther Exp $ +# $OpenBSD: Makefile,v 1.21 2016/09/10 16:38:16 jsing Exp $ # $NetBSD: Makefile,v 1.2 2001/03/04 14:50:05 mrg Exp $ CURDIR= ${.CURDIR} @@ -31,7 +31,7 @@ SRCS+= strlcpy.c strcmp.c strlcat.c strlen.c .if ${SOFTRAID:L} == "yes" .PATH: ${S}/lib/libsa -SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c sha1.c pbkdf2.c \ +SRCS+= aes_xts.c explicit_bzero.c hmac_sha1.c sha1.c pkcs5_pbkdf2.c \ rijndael.c .endif diff --git a/sys/arch/sparc64/stand/ofwboot/softraid.c b/sys/arch/sparc64/stand/ofwboot/softraid.c index 34ab1827c51..b42236a29ef 100644 --- a/sys/arch/sparc64/stand/ofwboot/softraid.c +++ b/sys/arch/sparc64/stand/ofwboot/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.4 2015/10/28 13:33:42 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.5 2016/09/10 16:38:16 jsing Exp $ */ /* * Copyright (c) 2012 Joel Sing <jsing@openbsd.org> @@ -27,7 +27,7 @@ #include <lib/libsa/stand.h> #include <lib/libsa/aes_xts.h> #include <lib/libsa/hmac_sha1.h> -#include <lib/libsa/pbkdf2.h> +#include <lib/libsa/pkcs5_pbkdf2.h> #include <lib/libsa/rijndael.h> #include "disk.h" diff --git a/sys/lib/libsa/pbkdf2.c b/sys/lib/libsa/pkcs5_pbkdf2.c index 1bfcda9e04c..73cdb27c7e9 100644 --- a/sys/lib/libsa/pbkdf2.c +++ b/sys/lib/libsa/pkcs5_pbkdf2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pbkdf2.c,v 1.3 2016/09/10 15:55:56 jsing Exp $ */ +/* $OpenBSD: pkcs5_pbkdf2.c,v 1.1 2016/09/10 16:38:16 jsing Exp $ */ /*- * Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr> @@ -20,28 +20,26 @@ #include <lib/libsa/stand.h> -#include "pbkdf2.h" +#include "pkcs5_pbkdf2.h" #include "hmac_sha1.h" -#define MINIMUM(a,b) (((a) < (b)) ? (a) : (b)) - /* * Password-Based Key Derivation Function 2 (PKCS #5 v2.0). * Code based on IEEE Std 802.11-2007, Annex H.4.2. */ int -pkcs5_pbkdf2(const char *pass, size_t pass_len, const uint8_t *salt, - size_t salt_len, uint8_t *key, size_t key_len, unsigned int rounds) +pkcs5_pbkdf2(const char *pass, size_t pass_len, const char *salt, + size_t salt_len, u_int8_t *key, size_t key_len, u_int rounds) { - uint8_t *asalt, obuf[SHA1_DIGEST_LENGTH]; - uint8_t d1[SHA1_DIGEST_LENGTH], d2[SHA1_DIGEST_LENGTH]; - unsigned int i, j; - unsigned int count; + u_int8_t *asalt, obuf[SHA1_DIGEST_LENGTH]; + u_int8_t d1[SHA1_DIGEST_LENGTH], d2[SHA1_DIGEST_LENGTH]; + u_int i, j; + u_int count; size_t r; if (rounds < 1 || key_len == 0) return -1; - if (salt_len == 0 || salt_len > SIZE_MAX - 4) + if (salt_len == 0 || salt_len > SIZE_MAX - 1) return -1; if ((asalt = alloc(salt_len + 4)) == NULL) return -1; @@ -63,7 +61,7 @@ pkcs5_pbkdf2(const char *pass, size_t pass_len, const uint8_t *salt, obuf[j] ^= d1[j]; } - r = MINIMUM(key_len, SHA1_DIGEST_LENGTH); + r = MIN(key_len, SHA1_DIGEST_LENGTH); memcpy(key, obuf, r); key += r; key_len -= r; diff --git a/sys/lib/libsa/pbkdf2.h b/sys/lib/libsa/pkcs5_pbkdf2.h index 4f5c8cfc32b..f2e10820747 100644 --- a/sys/lib/libsa/pbkdf2.h +++ b/sys/lib/libsa/pkcs5_pbkdf2.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pbkdf2.h,v 1.2 2016/09/10 15:55:56 jsing Exp $ */ +/* $OpenBSD: pkcs5_pbkdf2.h,v 1.1 2016/09/10 16:38:16 jsing Exp $ */ /*- * Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr> @@ -20,5 +20,5 @@ * Password-Based Key Derivation Function 2 (PKCS #5 v2.0). * Code based on IEEE Std 802.11-2007, Annex H.4.2. */ -int pkcs5_pbkdf2(const char *, size_t, const uint8_t *, size_t, - uint8_t *, size_t, unsigned int); +int pkcs5_pbkdf2(const char *, size_t, const char *, size_t, + u_int8_t *, size_t, u_int); |