summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2018-03-24 15:19:27 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2018-03-25 13:40:17 +0100
commit2a9d222af6d22606b62557b74e41b6e0e583edf8 (patch)
tree82af666312f569673e8f47d540622e397e10c4d3 /test
parentb8444b382f1b4fa31bf975295ade3a29d616ed9e (diff)
DKIM: move ed25519_privkey_pem_to_pubkey_raw_b64 to src/util/ and add usage notes to docs
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.in8
-rwxr-xr-xtest/configure12
-rw-r--r--test/dnszones-src/db.test.ex2
-rw-r--r--test/src/ed25519_privkey_pem_to_pubkey_raw_b64.c139
4 files changed, 2 insertions, 159 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
index 26631f398..edcc4ab78 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -8,7 +8,6 @@ CFLAGS=@CFLAGS@ @BIND_8_COMPAT@ @DEFS@
LDFLAGS=@LDFLAGS@
CLIENT_SSL=@CLIENT_SSL@
CLIENT_GNUTLS=@CLIENT_GNUTLS@
-B64_GNUTLS=@B64_GNUTLS@
LOADED=@LOADED@
LOADED_OPT=@LOADED_OPT@
LIBS=@LIBS@
@@ -19,8 +18,7 @@ SRC = @srcdir@/src
BINARIES = bin/cf bin/client $(CLIENT_SSL) $(CLIENT_GNUTLS) \
bin/checkaccess bin/fakens bin/fd bin/iefbr14 $(LOADED) \
- bin/mtpscript bin/server bin/showids bin/locate \
- $(B64_GNUTLS)
+ bin/mtpscript bin/server bin/showids bin/locate
# List of targets
@@ -87,10 +85,6 @@ bin/locate: $(SRC)/locate.sh Makefile
cp $(SRC)/locate.pl bin/locate
chmod 0755 bin/locate
-bin/ed25519_privkey_pem_to_pubkey_raw_b64: $(SRC)/ed25519_privkey_pem_to_pubkey_raw_b64.c Makefile
- $(CC) $(CFLAGS) -DHAVE_GNUTLS $(LDFLAGS) -o bin/ed25519_privkey_pem_to_pubkey_raw_b64 \
- $(SRC)/ed25519_privkey_pem_to_pubkey_raw_b64.c -lgnutls -lgcrypt $(LIBS)
-
clean:; rm -rf $(BINARIES) bin.sys
FORCE:
diff --git a/test/configure b/test/configure
index 78f734198..f01a14d74 100755
--- a/test/configure
+++ b/test/configure
@@ -623,7 +623,6 @@ ac_subst_vars='LTLIBOBJS
LIBOBJS
LOADED_OPT
LOADED
-B64_GNUTLS
CLIENT_GNUTLS
CLIENT_SSL
BIND_8_COMPAT
@@ -3243,17 +3242,6 @@ fi
done
-for ac_header in gnutls/gnutls.h
-do :
- ac_fn_c_check_header_mongrel "$LINENO" "gnutls/gnutls.h" "ac_cv_header_gnutls_gnutls_h" "$ac_includes_default"
-if test "x$ac_cv_header_gnutls_gnutls_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_GNUTLS_GNUTLS_H 1
-_ACEOF
- B64_GNUTLS=bin/ed25519_privkey_pem_to_pubkey_raw_b64
-fi
-
-done
diff --git a/test/dnszones-src/db.test.ex b/test/dnszones-src/db.test.ex
index 08aadb963..b8abd2845 100644
--- a/test/dnszones-src/db.test.ex
+++ b/test/dnszones-src/db.test.ex
@@ -556,7 +556,7 @@ sel2._domainkey TXT "v=DKIM1; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXRFf+VhT+
; EC signing, using Ed25519
; - needs GnuTLS 3.6.0 (fedora rawhide has that)
; certtool --generate-privkey --key-type=ed25519 --outfile=dkim_ed25519.private
-; bin/ed25519_privkey_pem_to_pubkey_raw_b64 dkim_ed25519.private
+; ../src/util/ed25519_privkey_pem_to_pubkey_raw_b64 dkim_ed25519.private
sed._domainkey TXT "v=DKIM1; k=ed25519; p=sPs07Vu29FpHT/80UXUcYHFOHifD4o2ZlP2+XUh9g6E="
diff --git a/test/src/ed25519_privkey_pem_to_pubkey_raw_b64.c b/test/src/ed25519_privkey_pem_to_pubkey_raw_b64.c
deleted file mode 100644
index f6639b758..000000000
--- a/test/src/ed25519_privkey_pem_to_pubkey_raw_b64.c
+++ /dev/null
@@ -1,139 +0,0 @@
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-/* Unix includes */
-
-typedef unsigned char uschar;
-
-#define CS (char *)
-#define US (unsigned char *)
-
-#define FALSE 0
-#define TRUE 1
-
-
-
-#ifdef HAVE_GNUTLS
-
-
-#include <gnutls/gnutls.h>
-#include <gnutls/abstract.h>
-#include <gnutls/x509.h>
-
-#if GNUTLS_VERSION_NUMBER >= 0x030600
-# define SIGN_HAVE_ED25519
-#endif
-
-
-
-static uschar *enc64table =
- US"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-uschar *
-b64encode(uschar *clear, int len)
-{
-uschar *code = malloc(4*((len+2)/3) + 2);
-uschar *p = code;
-
-while (len-- >0)
- {
- int x, y;
-
- x = *clear++;
- *p++ = enc64table[(x >> 2) & 63];
-
- if (len-- <= 0)
- {
- *p++ = enc64table[(x << 4) & 63];
- *p++ = '=';
- *p++ = '=';
- break;
- }
-
- y = *clear++;
- *p++ = enc64table[((x << 4) | ((y >> 4) & 15)) & 63];
-
- if (len-- <= 0)
- {
- *p++ = enc64table[(y << 2) & 63];
- *p++ = '=';
- break;
- }
-
- x = *clear++;
- *p++ = enc64table[((y << 2) | ((x >> 6) & 3)) & 63];
-
- *p++ = enc64table[x & 63];
- }
-
-*p = 0;
-
-return code;
-}
-
-/*************************************************
-* Main Program *
-*************************************************/
-
-
-int
-main(int argc, char **argv)
-{
-uschar * pemfile = argv[1];
-int fd;
-uschar buf[1024];
-int len, rc;
-gnutls_privkey_t privkey;
-gnutls_datum_t k;
-gnutls_pubkey_t pubkey;
-uschar * b64;
-
-#ifdef SIGN_HAVE_ED25519
-if ((fd = open(CS pemfile, O_RDONLY)) < 0)
- exit(1);
-
-if ((len = read(fd, buf, sizeof(buf)-1)) < 0)
- exit(2);
-
-k.data = buf;
-k.size = len;
-
-if ( (rc = gnutls_privkey_init(&privkey))
- || (rc = gnutls_privkey_import_x509_raw(privkey, &k, GNUTLS_X509_FMT_PEM, NULL, GNUTLS_PKCS_PLAIN))
- || (rc = gnutls_pubkey_init(&pubkey))
- || (rc = gnutls_pubkey_import_privkey(pubkey, privkey, GNUTLS_KEY_DIGITAL_SIGNATURE, 0))
- || (rc = gnutls_pubkey_export_ecc_raw2(pubkey, NULL, &k, NULL, GNUTLS_EXPORT_FLAG_NO_LZ))
- )
- fprintf(stderr, "%s\n", gnutls_strerror(rc));
-
-b64 = b64encode(k.data, k.size);
-
-printf("%s\n", b64);
-exit(0);
-
-#else
-fprintf(stderr, "No support for ed25519 signing in GnuTLS (version %s)\n", gnutls_check_version(NULL));
-exit(3);
-#endif
-}
-
-#endif
-
-#ifdef HAVE_OPENSSL
-int
-main(int argc, char **argv)
-{
-fprintf(stderr, "No support for ed25519 signing in OpenSSL\n");
-exit(3);
-}
-
-#endif