Skip to content
Snippets Groups Projects
Commit c907cd67 authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

[dnssec] hook the library subproject to autotools

parent 6e640150
Branches
Tags
1 merge request!332libdnssec
Jan Včelák <jan.vcelak@nic.cz>
SUBDIRS = tests
# Knot DNS common sources depedency (temporary)
#AM_CPPFLAGS = -I$(top_srcdir)/src
lib_LTLIBRARIES = libdnssec.la
libdnssec_la_CFLAGS = $(AM_CFLAGS) $(GNUTLS_CFLAGS) -fvisibility=hidden
libdnssec_la_LDFLAGS = $(GNUTLS_LIBS) -version-info 0:1:0
libdnssec_la_SOURCES = \
src/key.c \
src/key.h
#pragma once
#include <stdint.h>
#include <stdlib.h>
typedef struct dnssec_binary {
uint8_t *data;
size_t size;
} dnssec_binary_t;
#pragma once
enum dnssec_error {
DNSSEC_EOK = 0,
DNSSEC_EINVAL = -1,
DNSSEC_ERROR = -1000,
};
#pragma once
#include <stdint.h>
#include "binary.h"
enum dnssec_dnskey_algorithm {
DNSKEY_ALGORITHM_INVALID = 0,
DNSKEY_ALGORITHM_DSA_SHA1 = 3,
DNSKEY_ALGORITHM_RSA_SHA1 = 5,
DNSKEY_ALGORITHM_DSA_SHA1_NSEC3 = 6,
DNSKEY_ALGORITHM_RSA_SHA1_NSEC3 = 7,
DNSKEY_ALGORITHM_RSA_SHA256 = 8,
DNSKEY_ALGORITHM_RSA_SHA512 = 10,
DNSKEY_ALGORITHM_ECDSA_P256_SHA256 = 13,
DNSKEY_ALGORITHM_ECDSA_P384_SHA384 = 14
};
typedef uint8_t dnssec_key_id_t[20];
typedef struct dnssec_key {
dnssec_key_id_t id;
uint16_t keytag;
struct {
uint16_t flags;
uint8_t algorithm;
dnssec_binary_t *public_key;
} dnskey_rdata;
void *public_key;
void *private_key;
} dnssec_key_t;
int dnssec_key_to_dnskey(const dnssec_key_t *key, dnssec_binary_t *dnskey);
int dnssec_dnskey_to_key(const dnssec_binary_t *dnskey, dnssec_key_t *key);
uint8_t dnssec_key_get_algorithm(const dnssec_key_t *key);
uint16_t dnssec_key_get_keytag(const dnssec_key_t *key);
#include "error.h"
#include "keystore.h"
dnssec_keystore_t *dnssec_keystore_open(const char *path);
int dnssec_keystore_close(dnssec_keystore_t **keystore)
{
if (!keystore) {
return DNSSEC_EINVAL;
}
return DNSSEC_EOK;
}
#pragma once
#include "key.h"
typedef struct keystore_callbacks {
int a;
} keystore_callbacks_t;
typedef struct dnssec_keystore {
const keystore_callbacks_t *callbacks;
void *context;
} dnssec_keystore_t;
dnssec_keystore_t *dnssec_keystore_create_pkcs8(void);
dnssec_keystore_t *dnssec_keystore_create_pkcs11(void);
//dnssec_keystore_t *dnssec_keystore_create_custom_pkcs8(const dnssec_keystore_callbacks_t *callbacks);
int dnssec_keystore_open(dnssec_keystore_t *keystore, const char *path);
int dnssec_keystore_close(dnssec_keystore_t *keystore);
void *dnssec_keystore_list_key_ids(dnssec_keystore_t *keystore);
int dnssec_keystore_load_key(dnssec_keystore_t *keystore, dnssec_key_t *key);
#include <assert.h>
#include "error.h"
#include "key.h"
static int keydir_open(void *context, const char *path)
{
return DNSSEC_ERROR;
}
static int keydir_close(void *context)
{
return DNSSEC_ERROR;
}
static int keydir_refresh(void *context)
{
return DNSSEC_ERROR;
}
static int keydir_load_key(void *context, dnssec_key_id_t key_id, dnssec_binary_t data)
{
return DNSSEC_ERROR;
}
static int keydir_store_key(void *context, dnssec_key_id_t key_id, dnssec_binary_t data)
{
return DNSSEC_ERROR;
}
//static dnssec_key_storage_keydir_implementation = {
// .open = keydir_open,
// .close = keydir_close,
// .refresh = keydir_refresh,
// .load_key = keydir_load_key,
// .generate_key = keydir_generate_key
//};
AM_CPPFLAGS = -I$(top_srcdir)/libtap
LDADD = $(top_builddir)/libtap/libtap.a
check_PROGRAMS = \
key
check-compile-only: $(check_PROGRAMS)
check-local: $(check_PROGRAMS)
$(top_builddir)/libtap/runtests -s $(top_srcdir)/tests \
-b $(top_builddir)/tests \
$(check_PROGRAMS)
#include <config.h>
#include <tap/basic.h>
int main(int argc, char *argv[])
{
plan_lazy();
ok(1, "foo");
return 0;
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment