1999-07-12 20:08:42 +00:00
|
|
|
/*
|
2000-06-21 22:38:33 +00:00
|
|
|
* Portions Copyright (C) 2000 Internet Software Consortium.
|
|
|
|
* Portions Copyright (C) 1995-2000 by Network Associates, Inc.
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and distribute this software for any
|
1999-07-12 20:08:42 +00:00
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
2000-06-21 22:38:33 +00:00
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM AND
|
|
|
|
* NETWORK ASSOCIATES DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
|
|
|
* SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
* FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE CONSORTIUM OR NETWORK
|
|
|
|
* ASSOCIATES 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.
|
1999-07-12 20:08:42 +00:00
|
|
|
*/
|
2000-04-29 02:02:38 +00:00
|
|
|
|
2000-07-31 19:44:21 +00:00
|
|
|
/* $Id: dst_internal.h,v 1.26 2000/07/31 19:44:15 bwelling Exp $ */
|
2000-06-22 22:00:42 +00:00
|
|
|
|
2000-04-29 02:02:38 +00:00
|
|
|
#ifndef DST_DST_INTERNAL_H
|
|
|
|
#define DST_DST_INTERNAL_H 1
|
|
|
|
|
1999-07-12 20:08:42 +00:00
|
|
|
#include <isc/lang.h>
|
|
|
|
#include <isc/buffer.h>
|
|
|
|
#include <isc/int.h>
|
|
|
|
#include <isc/region.h>
|
|
|
|
|
2000-04-20 01:13:21 +00:00
|
|
|
#include "../rename.h"
|
|
|
|
|
1999-07-12 20:08:42 +00:00
|
|
|
#include <dst/dst.h>
|
|
|
|
|
|
|
|
ISC_LANG_BEGINDECLS
|
|
|
|
|
|
|
|
/***
|
|
|
|
*** Types
|
|
|
|
***/
|
|
|
|
|
2000-06-02 23:36:14 +00:00
|
|
|
typedef struct dst_func dst_func_t;
|
1999-07-12 20:08:42 +00:00
|
|
|
|
|
|
|
struct dst_key {
|
|
|
|
unsigned int magic;
|
2000-05-24 23:13:32 +00:00
|
|
|
dns_name_t * key_name; /* name of the key */
|
2000-06-02 18:57:51 +00:00
|
|
|
unsigned int key_size; /* size of the key in bits */
|
|
|
|
unsigned int key_proto; /* protocols this key is used for */
|
|
|
|
unsigned int key_alg; /* algorithm of the key */
|
1999-07-12 20:08:42 +00:00
|
|
|
isc_uint32_t key_flags; /* flags of the public key */
|
|
|
|
isc_uint16_t key_id; /* identifier of the key */
|
1999-07-29 17:21:23 +00:00
|
|
|
isc_mem_t *mctx; /* memory context */
|
1999-07-12 20:08:42 +00:00
|
|
|
void * opaque; /* pointer to key in crypto pkg fmt */
|
2000-06-02 23:36:14 +00:00
|
|
|
dst_func_t * func; /* crypto package specific functions */
|
1999-07-12 20:08:42 +00:00
|
|
|
};
|
|
|
|
|
2000-06-02 18:57:51 +00:00
|
|
|
struct dst_context {
|
|
|
|
unsigned int magic;
|
|
|
|
dst_key_t *key;
|
|
|
|
isc_mem_t *mctx;
|
|
|
|
void *opaque;
|
|
|
|
};
|
|
|
|
|
1999-07-12 20:08:42 +00:00
|
|
|
struct dst_func {
|
2000-06-02 18:57:51 +00:00
|
|
|
/*
|
|
|
|
* Context functions
|
|
|
|
*/
|
|
|
|
isc_result_t (*createctx)(dst_key_t *key, dst_context_t *dctx);
|
|
|
|
void (*destroyctx)(dst_context_t *dctx);
|
|
|
|
isc_result_t (*adddata)(dst_context_t *dctx, const isc_region_t *data);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Key operations
|
|
|
|
*/
|
|
|
|
isc_result_t (*sign)(dst_context_t *dctx, isc_buffer_t *sig);
|
|
|
|
isc_result_t (*verify)(dst_context_t *dctx, const isc_region_t *sig);
|
2000-03-06 20:06:01 +00:00
|
|
|
isc_result_t (*computesecret)(const dst_key_t *pub,
|
1999-09-27 16:55:45 +00:00
|
|
|
const dst_key_t *priv,
|
|
|
|
isc_buffer_t *secret);
|
1999-07-12 20:08:42 +00:00
|
|
|
isc_boolean_t (*compare)(const dst_key_t *key1, const dst_key_t *key2);
|
1999-09-27 16:55:45 +00:00
|
|
|
isc_boolean_t (*paramcompare)(const dst_key_t *key1,
|
|
|
|
const dst_key_t *key2);
|
2000-06-12 18:05:15 +00:00
|
|
|
isc_result_t (*generate)(dst_key_t *key, int parms);
|
1999-09-23 20:54:38 +00:00
|
|
|
isc_boolean_t (*isprivate)(const dst_key_t *key);
|
2000-06-02 18:57:51 +00:00
|
|
|
void (*destroy)(dst_key_t *key);
|
|
|
|
|
1999-07-12 20:08:42 +00:00
|
|
|
/* conversion functions */
|
2000-06-02 18:57:51 +00:00
|
|
|
isc_result_t (*todns)(const dst_key_t *key, isc_buffer_t *data);
|
|
|
|
isc_result_t (*fromdns)(dst_key_t *key, isc_buffer_t *data);
|
2000-06-06 21:58:16 +00:00
|
|
|
isc_result_t (*tofile)(const dst_key_t *key, const char *directory);
|
|
|
|
isc_result_t (*fromfile)(dst_key_t *key, const isc_uint16_t id,
|
|
|
|
const char *filename);
|
1999-07-12 20:08:42 +00:00
|
|
|
};
|
|
|
|
|
2000-06-02 23:36:14 +00:00
|
|
|
/*
|
|
|
|
* Initializers
|
|
|
|
*/
|
2000-06-09 22:32:20 +00:00
|
|
|
isc_result_t dst__openssl_init(void);
|
|
|
|
|
2000-06-06 21:58:16 +00:00
|
|
|
isc_result_t dst__hmacmd5_init(struct dst_func **funcp);
|
|
|
|
isc_result_t dst__dnssafersa_init(struct dst_func **funcp);
|
|
|
|
isc_result_t dst__openssldsa_init(struct dst_func **funcp);
|
|
|
|
isc_result_t dst__openssldh_init(struct dst_func **funcp);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Destructors
|
|
|
|
*/
|
2000-06-09 23:31:55 +00:00
|
|
|
void dst__openssl_destroy(void);
|
|
|
|
|
2000-06-06 21:58:16 +00:00
|
|
|
void dst__hmacmd5_destroy(void);
|
|
|
|
void dst__dnssafersa_destroy(void);
|
|
|
|
void dst__openssldsa_destroy(void);
|
|
|
|
void dst__openssldh_destroy(void);
|
1999-10-18 21:35:46 +00:00
|
|
|
|
2000-05-02 03:54:17 +00:00
|
|
|
/*
|
|
|
|
* Memory allocators using the DST memory pool.
|
|
|
|
*/
|
2000-06-09 22:32:20 +00:00
|
|
|
void * dst__mem_alloc(size_t size);
|
|
|
|
void dst__mem_free(void *ptr);
|
|
|
|
void * dst__mem_realloc(void *ptr, size_t size);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Entropy retriever using the DST entropy pool.
|
|
|
|
*/
|
2000-06-09 23:31:55 +00:00
|
|
|
isc_result_t dst__entropy_getdata(void *buf, unsigned int len,
|
|
|
|
isc_boolean_t pseudo);
|
1999-07-12 20:08:42 +00:00
|
|
|
|
|
|
|
ISC_LANG_ENDDECLS
|
|
|
|
|
2000-04-29 02:02:38 +00:00
|
|
|
#endif /* DST_DST_INTERNAL_H */
|