aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-03-06 23:29:52 +0100
committerDuncaen <mail@duncano.de>2017-03-06 23:29:52 +0100
commit1306d269624c43174ac8973e1b761bf5079a93ce (patch)
tree75831e6c9edcdd39be44ba9bf66e385460315ff8
parent3b6e9d7b33d9af78ed75d566c78d01df81da9995 (diff)
downloadlobase-1306d269624c43174ac8973e1b761bf5079a93ce.tar.gz
lib/libopenbsd: remove hash generated hash helpers
-rw-r--r--lib/libopenbsd/hash/md5hl.c113
-rw-r--r--lib/libopenbsd/hash/rmd160hl.c113
-rw-r--r--lib/libopenbsd/hash/sha1hl.c113
-rw-r--r--lib/libopenbsd/hash/sha224hl.c113
-rw-r--r--lib/libopenbsd/hash/sha256hl.c113
-rw-r--r--lib/libopenbsd/hash/sha384hl.c113
-rw-r--r--lib/libopenbsd/hash/sha512hl.c113
7 files changed, 0 insertions, 791 deletions
diff --git a/lib/libopenbsd/hash/md5hl.c b/lib/libopenbsd/hash/md5hl.c
deleted file mode 100644
index 941b12b..0000000
--- a/lib/libopenbsd/hash/md5hl.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: helper.c,v 1.15 2015/11/01 03:45:29 guenther Exp $ */
-
-/*
- * Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * If we meet some day, and you think this stuff is worth it, you
- * can buy me a beer in return. Poul-Henning Kamp
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <md5.h>
-
-#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
-
-char *
-MD5End(MD5_CTX *ctx, char *buf)
-{
- int i;
- u_int8_t digest[MD5_DIGEST_LENGTH];
- static const char hex[] = "0123456789abcdef";
-
- if (buf == NULL && (buf = malloc(MD5_DIGEST_STRING_LENGTH)) == NULL)
- return (NULL);
-
- MD5Final(digest, ctx);
- for (i = 0; i < MD5_DIGEST_LENGTH; i++) {
- buf[i + i] = hex[digest[i] >> 4];
- buf[i + i + 1] = hex[digest[i] & 0x0f];
- }
- buf[i + i] = '\0';
- explicit_bzero(digest, sizeof(digest));
- return (buf);
-}
-DEF_WEAK(MD5End);
-
-char *
-MD5FileChunk(const char *filename, char *buf, off_t off, off_t len)
-{
- struct stat sb;
- u_char buffer[BUFSIZ];
- MD5_CTX ctx;
- int fd, save_errno;
- ssize_t nr;
-
- MD5Init(&ctx);
-
- if ((fd = open(filename, O_RDONLY)) < 0)
- return (NULL);
- if (len == 0) {
- if (fstat(fd, &sb) == -1) {
- close(fd);
- return (NULL);
- }
- len = sb.st_size;
- }
- if (off > 0 && lseek(fd, off, SEEK_SET) < 0) {
- close(fd);
- return (NULL);
- }
-
- while ((nr = read(fd, buffer, MINIMUM(sizeof(buffer), len))) > 0) {
- MD5Update(&ctx, buffer, (size_t)nr);
- if (len > 0 && (len -= nr) == 0)
- break;
- }
-
- save_errno = errno;
- close(fd);
- errno = save_errno;
- return (nr < 0 ? NULL : MD5End(&ctx, buf));
-}
-DEF_WEAK(MD5FileChunk);
-
-char *
-MD5File(const char *filename, char *buf)
-{
- return (MD5FileChunk(filename, buf, (off_t)0, (off_t)0));
-}
-DEF_WEAK(MD5File);
-
-char *
-MD5Data(const u_char *data, size_t len, char *buf)
-{
- MD5_CTX ctx;
-
- MD5Init(&ctx);
- MD5Update(&ctx, data, len);
- return (MD5End(&ctx, buf));
-}
-DEF_WEAK(MD5Data);
diff --git a/lib/libopenbsd/hash/rmd160hl.c b/lib/libopenbsd/hash/rmd160hl.c
deleted file mode 100644
index fbb4cd3..0000000
--- a/lib/libopenbsd/hash/rmd160hl.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: helper.c,v 1.15 2015/11/01 03:45:29 guenther Exp $ */
-
-/*
- * Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * If we meet some day, and you think this stuff is worth it, you
- * can buy me a beer in return. Poul-Henning Kamp
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <rmd160.h>
-
-#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
-
-char *
-RMD160End(RMD160_CTX *ctx, char *buf)
-{
- int i;
- u_int8_t digest[RMD160_DIGEST_LENGTH];
- static const char hex[] = "0123456789abcdef";
-
- if (buf == NULL && (buf = malloc(RMD160_DIGEST_STRING_LENGTH)) == NULL)
- return (NULL);
-
- RMD160Final(digest, ctx);
- for (i = 0; i < RMD160_DIGEST_LENGTH; i++) {
- buf[i + i] = hex[digest[i] >> 4];
- buf[i + i + 1] = hex[digest[i] & 0x0f];
- }
- buf[i + i] = '\0';
- explicit_bzero(digest, sizeof(digest));
- return (buf);
-}
-DEF_WEAK(RMD160End);
-
-char *
-RMD160FileChunk(const char *filename, char *buf, off_t off, off_t len)
-{
- struct stat sb;
- u_char buffer[BUFSIZ];
- RMD160_CTX ctx;
- int fd, save_errno;
- ssize_t nr;
-
- RMD160Init(&ctx);
-
- if ((fd = open(filename, O_RDONLY)) < 0)
- return (NULL);
- if (len == 0) {
- if (fstat(fd, &sb) == -1) {
- close(fd);
- return (NULL);
- }
- len = sb.st_size;
- }
- if (off > 0 && lseek(fd, off, SEEK_SET) < 0) {
- close(fd);
- return (NULL);
- }
-
- while ((nr = read(fd, buffer, MINIMUM(sizeof(buffer), len))) > 0) {
- RMD160Update(&ctx, buffer, (size_t)nr);
- if (len > 0 && (len -= nr) == 0)
- break;
- }
-
- save_errno = errno;
- close(fd);
- errno = save_errno;
- return (nr < 0 ? NULL : RMD160End(&ctx, buf));
-}
-DEF_WEAK(RMD160FileChunk);
-
-char *
-RMD160File(const char *filename, char *buf)
-{
- return (RMD160FileChunk(filename, buf, (off_t)0, (off_t)0));
-}
-DEF_WEAK(RMD160File);
-
-char *
-RMD160Data(const u_char *data, size_t len, char *buf)
-{
- RMD160_CTX ctx;
-
- RMD160Init(&ctx);
- RMD160Update(&ctx, data, len);
- return (RMD160End(&ctx, buf));
-}
-DEF_WEAK(RMD160Data);
diff --git a/lib/libopenbsd/hash/sha1hl.c b/lib/libopenbsd/hash/sha1hl.c
deleted file mode 100644
index 437a560..0000000
--- a/lib/libopenbsd/hash/sha1hl.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: helper.c,v 1.15 2015/11/01 03:45:29 guenther Exp $ */
-
-/*
- * Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * If we meet some day, and you think this stuff is worth it, you
- * can buy me a beer in return. Poul-Henning Kamp
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sha1.h>
-
-#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
-
-char *
-SHA1End(SHA1_CTX *ctx, char *buf)
-{
- int i;
- u_int8_t digest[SHA1_DIGEST_LENGTH];
- static const char hex[] = "0123456789abcdef";
-
- if (buf == NULL && (buf = malloc(SHA1_DIGEST_STRING_LENGTH)) == NULL)
- return (NULL);
-
- SHA1Final(digest, ctx);
- for (i = 0; i < SHA1_DIGEST_LENGTH; i++) {
- buf[i + i] = hex[digest[i] >> 4];
- buf[i + i + 1] = hex[digest[i] & 0x0f];
- }
- buf[i + i] = '\0';
- explicit_bzero(digest, sizeof(digest));
- return (buf);
-}
-DEF_WEAK(SHA1End);
-
-char *
-SHA1FileChunk(const char *filename, char *buf, off_t off, off_t len)
-{
- struct stat sb;
- u_char buffer[BUFSIZ];
- SHA1_CTX ctx;
- int fd, save_errno;
- ssize_t nr;
-
- SHA1Init(&ctx);
-
- if ((fd = open(filename, O_RDONLY)) < 0)
- return (NULL);
- if (len == 0) {
- if (fstat(fd, &sb) == -1) {
- close(fd);
- return (NULL);
- }
- len = sb.st_size;
- }
- if (off > 0 && lseek(fd, off, SEEK_SET) < 0) {
- close(fd);
- return (NULL);
- }
-
- while ((nr = read(fd, buffer, MINIMUM(sizeof(buffer), len))) > 0) {
- SHA1Update(&ctx, buffer, (size_t)nr);
- if (len > 0 && (len -= nr) == 0)
- break;
- }
-
- save_errno = errno;
- close(fd);
- errno = save_errno;
- return (nr < 0 ? NULL : SHA1End(&ctx, buf));
-}
-DEF_WEAK(SHA1FileChunk);
-
-char *
-SHA1File(const char *filename, char *buf)
-{
- return (SHA1FileChunk(filename, buf, (off_t)0, (off_t)0));
-}
-DEF_WEAK(SHA1File);
-
-char *
-SHA1Data(const u_char *data, size_t len, char *buf)
-{
- SHA1_CTX ctx;
-
- SHA1Init(&ctx);
- SHA1Update(&ctx, data, len);
- return (SHA1End(&ctx, buf));
-}
-DEF_WEAK(SHA1Data);
diff --git a/lib/libopenbsd/hash/sha224hl.c b/lib/libopenbsd/hash/sha224hl.c
deleted file mode 100644
index 2f97183..0000000
--- a/lib/libopenbsd/hash/sha224hl.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: helper.c,v 1.15 2015/11/01 03:45:29 guenther Exp $ */
-
-/*
- * Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * If we meet some day, and you think this stuff is worth it, you
- * can buy me a beer in return. Poul-Henning Kamp
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sha2.h>
-
-#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
-
-char *
-SHA224End(SHA2_CTX *ctx, char *buf)
-{
- int i;
- u_int8_t digest[SHA224_DIGEST_LENGTH];
- static const char hex[] = "0123456789abcdef";
-
- if (buf == NULL && (buf = malloc(SHA224_DIGEST_STRING_LENGTH)) == NULL)
- return (NULL);
-
- SHA224Final(digest, ctx);
- for (i = 0; i < SHA224_DIGEST_LENGTH; i++) {
- buf[i + i] = hex[digest[i] >> 4];
- buf[i + i + 1] = hex[digest[i] & 0x0f];
- }
- buf[i + i] = '\0';
- explicit_bzero(digest, sizeof(digest));
- return (buf);
-}
-DEF_WEAK(SHA224End);
-
-char *
-SHA224FileChunk(const char *filename, char *buf, off_t off, off_t len)
-{
- struct stat sb;
- u_char buffer[BUFSIZ];
- SHA2_CTX ctx;
- int fd, save_errno;
- ssize_t nr;
-
- SHA224Init(&ctx);
-
- if ((fd = open(filename, O_RDONLY)) < 0)
- return (NULL);
- if (len == 0) {
- if (fstat(fd, &sb) == -1) {
- close(fd);
- return (NULL);
- }
- len = sb.st_size;
- }
- if (off > 0 && lseek(fd, off, SEEK_SET) < 0) {
- close(fd);
- return (NULL);
- }
-
- while ((nr = read(fd, buffer, MINIMUM(sizeof(buffer), len))) > 0) {
- SHA224Update(&ctx, buffer, (size_t)nr);
- if (len > 0 && (len -= nr) == 0)
- break;
- }
-
- save_errno = errno;
- close(fd);
- errno = save_errno;
- return (nr < 0 ? NULL : SHA224End(&ctx, buf));
-}
-DEF_WEAK(SHA224FileChunk);
-
-char *
-SHA224File(const char *filename, char *buf)
-{
- return (SHA224FileChunk(filename, buf, (off_t)0, (off_t)0));
-}
-DEF_WEAK(SHA224File);
-
-char *
-SHA224Data(const u_char *data, size_t len, char *buf)
-{
- SHA2_CTX ctx;
-
- SHA224Init(&ctx);
- SHA224Update(&ctx, data, len);
- return (SHA224End(&ctx, buf));
-}
-DEF_WEAK(SHA224Data);
diff --git a/lib/libopenbsd/hash/sha256hl.c b/lib/libopenbsd/hash/sha256hl.c
deleted file mode 100644
index 7fb8faa..0000000
--- a/lib/libopenbsd/hash/sha256hl.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: helper.c,v 1.15 2015/11/01 03:45:29 guenther Exp $ */
-
-/*
- * Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * If we meet some day, and you think this stuff is worth it, you
- * can buy me a beer in return. Poul-Henning Kamp
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sha2.h>
-
-#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
-
-char *
-SHA256End(SHA2_CTX *ctx, char *buf)
-{
- int i;
- u_int8_t digest[SHA256_DIGEST_LENGTH];
- static const char hex[] = "0123456789abcdef";
-
- if (buf == NULL && (buf = malloc(SHA256_DIGEST_STRING_LENGTH)) == NULL)
- return (NULL);
-
- SHA256Final(digest, ctx);
- for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
- buf[i + i] = hex[digest[i] >> 4];
- buf[i + i + 1] = hex[digest[i] & 0x0f];
- }
- buf[i + i] = '\0';
- explicit_bzero(digest, sizeof(digest));
- return (buf);
-}
-DEF_WEAK(SHA256End);
-
-char *
-SHA256FileChunk(const char *filename, char *buf, off_t off, off_t len)
-{
- struct stat sb;
- u_char buffer[BUFSIZ];
- SHA2_CTX ctx;
- int fd, save_errno;
- ssize_t nr;
-
- SHA256Init(&ctx);
-
- if ((fd = open(filename, O_RDONLY)) < 0)
- return (NULL);
- if (len == 0) {
- if (fstat(fd, &sb) == -1) {
- close(fd);
- return (NULL);
- }
- len = sb.st_size;
- }
- if (off > 0 && lseek(fd, off, SEEK_SET) < 0) {
- close(fd);
- return (NULL);
- }
-
- while ((nr = read(fd, buffer, MINIMUM(sizeof(buffer), len))) > 0) {
- SHA256Update(&ctx, buffer, (size_t)nr);
- if (len > 0 && (len -= nr) == 0)
- break;
- }
-
- save_errno = errno;
- close(fd);
- errno = save_errno;
- return (nr < 0 ? NULL : SHA256End(&ctx, buf));
-}
-DEF_WEAK(SHA256FileChunk);
-
-char *
-SHA256File(const char *filename, char *buf)
-{
- return (SHA256FileChunk(filename, buf, (off_t)0, (off_t)0));
-}
-DEF_WEAK(SHA256File);
-
-char *
-SHA256Data(const u_char *data, size_t len, char *buf)
-{
- SHA2_CTX ctx;
-
- SHA256Init(&ctx);
- SHA256Update(&ctx, data, len);
- return (SHA256End(&ctx, buf));
-}
-DEF_WEAK(SHA256Data);
diff --git a/lib/libopenbsd/hash/sha384hl.c b/lib/libopenbsd/hash/sha384hl.c
deleted file mode 100644
index fc4cf14..0000000
--- a/lib/libopenbsd/hash/sha384hl.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: helper.c,v 1.15 2015/11/01 03:45:29 guenther Exp $ */
-
-/*
- * Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * If we meet some day, and you think this stuff is worth it, you
- * can buy me a beer in return. Poul-Henning Kamp
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sha2.h>
-
-#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
-
-char *
-SHA384End(SHA2_CTX *ctx, char *buf)
-{
- int i;
- u_int8_t digest[SHA384_DIGEST_LENGTH];
- static const char hex[] = "0123456789abcdef";
-
- if (buf == NULL && (buf = malloc(SHA384_DIGEST_STRING_LENGTH)) == NULL)
- return (NULL);
-
- SHA384Final(digest, ctx);
- for (i = 0; i < SHA384_DIGEST_LENGTH; i++) {
- buf[i + i] = hex[digest[i] >> 4];
- buf[i + i + 1] = hex[digest[i] & 0x0f];
- }
- buf[i + i] = '\0';
- explicit_bzero(digest, sizeof(digest));
- return (buf);
-}
-DEF_WEAK(SHA384End);
-
-char *
-SHA384FileChunk(const char *filename, char *buf, off_t off, off_t len)
-{
- struct stat sb;
- u_char buffer[BUFSIZ];
- SHA2_CTX ctx;
- int fd, save_errno;
- ssize_t nr;
-
- SHA384Init(&ctx);
-
- if ((fd = open(filename, O_RDONLY)) < 0)
- return (NULL);
- if (len == 0) {
- if (fstat(fd, &sb) == -1) {
- close(fd);
- return (NULL);
- }
- len = sb.st_size;
- }
- if (off > 0 && lseek(fd, off, SEEK_SET) < 0) {
- close(fd);
- return (NULL);
- }
-
- while ((nr = read(fd, buffer, MINIMUM(sizeof(buffer), len))) > 0) {
- SHA384Update(&ctx, buffer, (size_t)nr);
- if (len > 0 && (len -= nr) == 0)
- break;
- }
-
- save_errno = errno;
- close(fd);
- errno = save_errno;
- return (nr < 0 ? NULL : SHA384End(&ctx, buf));
-}
-DEF_WEAK(SHA384FileChunk);
-
-char *
-SHA384File(const char *filename, char *buf)
-{
- return (SHA384FileChunk(filename, buf, (off_t)0, (off_t)0));
-}
-DEF_WEAK(SHA384File);
-
-char *
-SHA384Data(const u_char *data, size_t len, char *buf)
-{
- SHA2_CTX ctx;
-
- SHA384Init(&ctx);
- SHA384Update(&ctx, data, len);
- return (SHA384End(&ctx, buf));
-}
-DEF_WEAK(SHA384Data);
diff --git a/lib/libopenbsd/hash/sha512hl.c b/lib/libopenbsd/hash/sha512hl.c
deleted file mode 100644
index 4a8742f..0000000
--- a/lib/libopenbsd/hash/sha512hl.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* $OpenBSD: helper.c,v 1.15 2015/11/01 03:45:29 guenther Exp $ */
-
-/*
- * Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * If we meet some day, and you think this stuff is worth it, you
- * can buy me a beer in return. Poul-Henning Kamp
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sha2.h>
-
-#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
-
-char *
-SHA512End(SHA2_CTX *ctx, char *buf)
-{
- int i;
- u_int8_t digest[SHA512_DIGEST_LENGTH];
- static const char hex[] = "0123456789abcdef";
-
- if (buf == NULL && (buf = malloc(SHA512_DIGEST_STRING_LENGTH)) == NULL)
- return (NULL);
-
- SHA512Final(digest, ctx);
- for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
- buf[i + i] = hex[digest[i] >> 4];
- buf[i + i + 1] = hex[digest[i] & 0x0f];
- }
- buf[i + i] = '\0';
- explicit_bzero(digest, sizeof(digest));
- return (buf);
-}
-DEF_WEAK(SHA512End);
-
-char *
-SHA512FileChunk(const char *filename, char *buf, off_t off, off_t len)
-{
- struct stat sb;
- u_char buffer[BUFSIZ];
- SHA2_CTX ctx;
- int fd, save_errno;
- ssize_t nr;
-
- SHA512Init(&ctx);
-
- if ((fd = open(filename, O_RDONLY)) < 0)
- return (NULL);
- if (len == 0) {
- if (fstat(fd, &sb) == -1) {
- close(fd);
- return (NULL);
- }
- len = sb.st_size;
- }
- if (off > 0 && lseek(fd, off, SEEK_SET) < 0) {
- close(fd);
- return (NULL);
- }
-
- while ((nr = read(fd, buffer, MINIMUM(sizeof(buffer), len))) > 0) {
- SHA512Update(&ctx, buffer, (size_t)nr);
- if (len > 0 && (len -= nr) == 0)
- break;
- }
-
- save_errno = errno;
- close(fd);
- errno = save_errno;
- return (nr < 0 ? NULL : SHA512End(&ctx, buf));
-}
-DEF_WEAK(SHA512FileChunk);
-
-char *
-SHA512File(const char *filename, char *buf)
-{
- return (SHA512FileChunk(filename, buf, (off_t)0, (off_t)0));
-}
-DEF_WEAK(SHA512File);
-
-char *
-SHA512Data(const u_char *data, size_t len, char *buf)
-{
- SHA2_CTX ctx;
-
- SHA512Init(&ctx);
- SHA512Update(&ctx, data, len);
- return (SHA512End(&ctx, buf));
-}
-DEF_WEAK(SHA512Data);