From f9f7781f097dcac6f4896656ef16a6c4af11dcdb Mon Sep 17 00:00:00 2001 From: IC Rainbow Date: Mon, 30 Oct 2023 14:00:24 +0200 Subject: [PATCH] remove sha512 wrapper and use openssl directly --- cbits/sha512.c | 9 --------- cbits/sha512.h | 3 --- cbits/sntrup761.c | 4 ++-- package.yaml | 6 +++--- simplexmq.cabal | 4 +--- 5 files changed, 6 insertions(+), 20 deletions(-) delete mode 100644 cbits/sha512.c delete mode 100644 cbits/sha512.h diff --git a/cbits/sha512.c b/cbits/sha512.c deleted file mode 100644 index 54b838674..000000000 --- a/cbits/sha512.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include "sha512.h" - -void crypto_hash_sha512 (unsigned char *out, - const unsigned char *in, - unsigned long long inlen) -{ - SHA512(in, inlen, out); -} diff --git a/cbits/sha512.h b/cbits/sha512.h deleted file mode 100644 index af16f5888..000000000 --- a/cbits/sha512.h +++ /dev/null @@ -1,3 +0,0 @@ -void crypto_hash_sha512 (unsigned char *out, - const unsigned char *in, - unsigned long long inlen); diff --git a/cbits/sntrup761.c b/cbits/sntrup761.c index ebdb7fbe5..d697fd37c 100644 --- a/cbits/sntrup761.c +++ b/cbits/sntrup761.c @@ -6,7 +6,7 @@ * - Christine van Vredendaal */ -#include "sha512.h" +#include #include "sntrup761.h" #include "sxcrandom.h" @@ -676,7 +676,7 @@ Hash_prefix (unsigned char *out, int b, const unsigned char *in, int inlen) x[0] = b; for (i = 0; i < inlen; ++i) x[i + 1] = in[i]; - crypto_hash_sha512 (h, x, inlen + 1); + SHA512 (x, inlen + 1, h); for (i = 0; i < 32; ++i) out[i] = h[i]; } diff --git a/package.yaml b/package.yaml index 5b08a8cdc..1f63379b9 100644 --- a/package.yaml +++ b/package.yaml @@ -20,7 +20,7 @@ category: Chat, Network, Web, System, Cryptography extra-source-files: - README.md - CHANGELOG.md - - cbits/sha512.h + # - cbits/sha512.h - cbits/sntrup761.h - cbits/sxcrandom.h @@ -91,11 +91,11 @@ when: library: source-dirs: src c-sources: - - cbits/sha512.c + # - cbits/sha512.c - cbits/sntrup761.c - cbits/sxcrandom.c include-dirs: cbits - extra-libraries: ssl crypto + extra-libraries: crypto executables: smp-server: diff --git a/simplexmq.cabal b/simplexmq.cabal index 5164dddd8..c2c0af78b 100644 --- a/simplexmq.cabal +++ b/simplexmq.cabal @@ -26,7 +26,6 @@ build-type: Simple extra-source-files: README.md CHANGELOG.md - cbits/sha512.h cbits/sntrup761.h cbits/sxcrandom.h @@ -156,11 +155,10 @@ library include-dirs: cbits c-sources: - cbits/sha512.c cbits/sntrup761.c cbits/sxcrandom.c extra-libraries: - ssl crypto + crypto build-depends: aeson ==2.2.* , ansi-terminal >=0.10 && <0.12