From: Miek Gieben Date: Thu, 3 Mar 2005 12:45:16 +0000 (+0000) Subject: first attempt X-Git-Tag: release-0.50~308 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef1f82291203e874c3e9cd0eba267e174e8193b0;p=thirdparty%2Fldns.git first attempt --- diff --git a/Makefile.in b/Makefile.in index 19015ad1..0d3a0c55 100644 --- a/Makefile.in +++ b/Makefile.in @@ -24,7 +24,7 @@ LINTFLAGS = +quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsign LIBDNS_SOURCES = rdata.c util.c rr.c packet.c wire2host.c \ host2str.c buffer.c str2host.c resolver.c \ - net.c host2wire.c dname.c dnssec.c + net.c host2wire.c dname.c dnssec.c keys.c LIBDNS_HEADERS = ldns/error.h \ ldns/packet.h \ ldns/prototype.h \ @@ -39,6 +39,7 @@ LIBDNS_HEADERS = ldns/error.h \ ldns/net.h \ ldns/dname.h \ ldns/dnssec.h \ + ldns/keys.h \ util.h PROG_SOURCES = mx.c PROG_TARGETS = $(PROG_SOURCES:.c=) diff --git a/TODO b/TODO index cea7e488..6954b2dc 100644 --- a/TODO +++ b/TODO @@ -47,3 +47,8 @@ o Dependency on openSSL? o ldns_lookup_by_name works for types, classes should be shielded, only use ldns_get_class_by_name/type o private key type? + to many algs: + ldns_algorithms[] host2str.c + ldns_algorithm dnssec.h + ldns_signing_algorithm keys.h (new!?) + diff --git a/keys.c b/keys.c index 15e38152..526e6d9a 100644 --- a/keys.c +++ b/keys.c @@ -5,3 +5,6 @@ * and give a general interface for private keys and hmac * handling */ + +#include +#include diff --git a/ldns/keys.h b/ldns/keys.h index bfa5a3b8..30e36f2d 100644 --- a/ldns/keys.h +++ b/ldns/keys.h @@ -11,3 +11,36 @@ * See the file LICENSE for the license */ +#include +#include + +enum ldns_enum_signing_algorithm +{ + LDNS_SIGN_ALG_RSAMD5 = 1, + LDNS_SIGN_ALG_RSASHA1 = 2, + LDNS_SIGN_ALG_DSAMD5 = 3, + LDNS_SIGN_ALG_DSASHA1 = 4, + LDNS_SIGN_ALG_HMACMD5 = 5 +}; +typedef enum ldns_enum_signing_algorithm ldns_signing_algorithm; + +ldns_lookup_table ldns_signing_algorithms[] = { + { LDNS_SIGN_ALG_RSAMD5, "RSAMD5" }, + { LDNS_SIGN_ALG_RSASHA1, "RSASHA1" }, + { LDNS_SIGN_ALG_DSAMD5, "DSAMD5" }, + { LDNS_SIGN_ALG_DSASHA1, "DSASHA1" }, + { LDNS_SIGN_ALG_HMACMD5, "hmac-md5.sig-alg.reg.int" }, + { 0, NULL } +}; + + +struct ldns_struct_key { + ldns_signing_algorithm algorithm; + union { + RSA *rsa; + DSA *dsa; + unsigned char *hmac; + } key; +}; +typedef struct ldns_struct_key ldns_key; +