dst_internal.h (7c478bd9) | dst_internal.h (9525b14b) |
---|---|
1/* 2 * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved. 3 * Use is subject to license terms. 4 */ 5 6#pragma ident "%Z%%M% %I% %E% SMI" 7 | |
8#ifndef DST_INTERNAL_H 9#define DST_INTERNAL_H 10 11/* 12 * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. 13 * 14 * Permission to use, copy modify, and distribute this software for any 15 * purpose with or without fee is hereby granted, provided that the above --- 15 unchanged lines hidden (view full) --- 31#else 32# include <sys/types.h> 33#endif 34 35#ifndef PATH_MAX 36# ifdef POSIX_PATH_MAX 37# define PATH_MAX POSIX_PATH_MAX 38# else | 1#ifndef DST_INTERNAL_H 2#define DST_INTERNAL_H 3 4/* 5 * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. 6 * 7 * Permission to use, copy modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above --- 15 unchanged lines hidden (view full) --- 24#else 25# include <sys/types.h> 26#endif 27 28#ifndef PATH_MAX 29# ifdef POSIX_PATH_MAX 30# define PATH_MAX POSIX_PATH_MAX 31# else |
39# define PATH_MAX 255 /* this is the value of POSIX_PATH_MAX */ | 32# define PATH_MAX 255 /*%< this is the value of POSIX_PATH_MAX */ |
40# endif 41#endif 42 43typedef struct dst_key { | 33# endif 34#endif 35 36typedef struct dst_key { |
44 char *dk_key_name; /* name of the key */ 45 int dk_key_size; /* this is the size of the key in bits */ 46 int dk_proto; /* what protocols this key can be used for */ 47 int dk_alg; /* algorithm number from key record */ 48 u_int32_t dk_flags; /* and the flags of the public key */ 49 u_int16_t dk_id; /* identifier of the key */ 50 void *dk_KEY_struct; /* pointer to key in crypto pkg fmt */ 51 struct dst_func *dk_func; /* point to cryptto pgk specific function table */ | 37 char *dk_key_name; /*%< name of the key */ 38 int dk_key_size; /*%< this is the size of the key in bits */ 39 int dk_proto; /*%< what protocols this key can be used for */ 40 int dk_alg; /*%< algorithm number from key record */ 41 u_int32_t dk_flags; /*%< and the flags of the public key */ 42 u_int16_t dk_id; /*%< identifier of the key */ 43 void *dk_KEY_struct; /*%< pointer to key in crypto pkg fmt */ 44 struct dst_func *dk_func; /*%< point to cryptto pgk specific function table */ |
52} DST_KEY; 53#define HAS_DST_KEY 54 55#include <isc/dst.h> 56/* 57 * define what crypto systems are supported for RSA, 58 * BSAFE is prefered over RSAREF; only one can be set at any time 59 */ --- 15 unchanged lines hidden (view full) --- 75#define EREPORT(str) (void)0 76#endif 77 78/* use our own special macro to FRRE memory */ 79 80#ifndef SAFE_FREE 81#define SAFE_FREE(a) \ 82do{if(a != NULL){memset(a,0, sizeof(*a)); free(a); a=NULL;}} while (0) | 45} DST_KEY; 46#define HAS_DST_KEY 47 48#include <isc/dst.h> 49/* 50 * define what crypto systems are supported for RSA, 51 * BSAFE is prefered over RSAREF; only one can be set at any time 52 */ --- 15 unchanged lines hidden (view full) --- 68#define EREPORT(str) (void)0 69#endif 70 71/* use our own special macro to FRRE memory */ 72 73#ifndef SAFE_FREE 74#define SAFE_FREE(a) \ 75do{if(a != NULL){memset(a,0, sizeof(*a)); free(a); a=NULL;}} while (0) |
83#define SAFE_FREE2(a,s) if (a != NULL && s > 0){memset(a,0, s);free(a); a=NULL;} | 76#define SAFE_FREE2(a,s) if (a != NULL && (long)s > 0){memset(a,0, s);free(a); a=NULL;} |
84#endif 85 86typedef struct dst_func { 87 int (*sign)(const int mode, DST_KEY *key, void **context, 88 const u_int8_t *data, const int len, 89 u_int8_t *signature, const int sig_len); 90 int (*verify)(const int mode, DST_KEY *key, void **context, 91 const u_int8_t *data, const int len, --- 13 unchanged lines hidden (view full) --- 105 106} dst_func; 107 108extern dst_func *dst_t_func[DST_MAX_ALGS]; 109extern const char *key_file_fmt_str; 110extern const char *dst_path; 111 112#ifndef DST_HASH_SIZE | 77#endif 78 79typedef struct dst_func { 80 int (*sign)(const int mode, DST_KEY *key, void **context, 81 const u_int8_t *data, const int len, 82 u_int8_t *signature, const int sig_len); 83 int (*verify)(const int mode, DST_KEY *key, void **context, 84 const u_int8_t *data, const int len, --- 13 unchanged lines hidden (view full) --- 98 99} dst_func; 100 101extern dst_func *dst_t_func[DST_MAX_ALGS]; 102extern const char *key_file_fmt_str; 103extern const char *dst_path; 104 105#ifndef DST_HASH_SIZE |
113#define DST_HASH_SIZE 20 /* RIPEMD160 and SHA-1 are 20 bytes MD5 is 16 */ | 106#define DST_HASH_SIZE 20 /*%< RIPEMD160 and SHA-1 are 20 bytes MD5 is 16 */ |
114#endif 115 116int dst_bsafe_init(void); 117 118int dst_rsaref_init(void); 119 120int dst_hmac_md5_init(void); 121 122int dst_cylink_init(void); 123 124int dst_eay_dss_init(void); 125 | 107#endif 108 109int dst_bsafe_init(void); 110 111int dst_rsaref_init(void); 112 113int dst_hmac_md5_init(void); 114 115int dst_cylink_init(void); 116 117int dst_eay_dss_init(void); 118 |
126/* support functions */ 127/* base64 to bignum conversion routines */ 128int dst_s_conv_bignum_u8_to_b64( char *out_buf, const int out_len, 129 const char *header, 130 const u_int8_t *bin_data, 131 const int bin_len); 132int dst_s_conv_bignum_b64_to_u8( const char **buf, u_int8_t *loc, 133 const int loclen) ; | |
134/* from higher level support routines */ 135int dst_s_calculate_bits( const u_int8_t *str, const int max_bits); 136int dst_s_verify_str( const char **buf, const char *str); 137 138 139/* conversion between dns names and key file names */ 140size_t dst_s_filename_length( const char *name, const char *suffix); 141int dst_s_build_filename( char *filename, const char *name, 142 u_int16_t id, int alg, const char *suffix, 143 size_t filename_length); 144 145FILE *dst_s_fopen (const char *filename, const char *mode, int perm); 146 | 119/* from higher level support routines */ 120int dst_s_calculate_bits( const u_int8_t *str, const int max_bits); 121int dst_s_verify_str( const char **buf, const char *str); 122 123 124/* conversion between dns names and key file names */ 125size_t dst_s_filename_length( const char *name, const char *suffix); 126int dst_s_build_filename( char *filename, const char *name, 127 u_int16_t id, int alg, const char *suffix, 128 size_t filename_length); 129 130FILE *dst_s_fopen (const char *filename, const char *mode, int perm); 131 |
147/* from file prandom.c */ 148int dst_s_random( u_int8_t *output, int size); 149int dst_s_semi_random( u_int8_t *output, int size); 150u_int32_t dst_s_quick_random( int inc); 151void dst_s_quick_random_set( u_int32_t val, u_int32_t cnt); 152 153/* | 132/*% |
154 * read and write network byte order into u_int?_t 155 * all of these should be retired 156 */ 157u_int16_t dst_s_get_int16( const u_int8_t *buf); 158void dst_s_put_int16( u_int8_t *buf, const u_int16_t val); 159 160u_int32_t dst_s_get_int32( const u_int8_t *buf); 161void dst_s_put_int32( u_int8_t *buf, const u_int32_t val); --- 6 unchanged lines hidden (view full) --- 168#endif 169void 170dst_s_dump(const int mode, const u_char *data, const int size, 171 const char *msg); 172 173 174 175#endif /* DST_INTERNAL_H */ | 133 * read and write network byte order into u_int?_t 134 * all of these should be retired 135 */ 136u_int16_t dst_s_get_int16( const u_int8_t *buf); 137void dst_s_put_int16( u_int8_t *buf, const u_int16_t val); 138 139u_int32_t dst_s_get_int32( const u_int8_t *buf); 140void dst_s_put_int32( u_int8_t *buf, const u_int32_t val); --- 6 unchanged lines hidden (view full) --- 147#endif 148void 149dst_s_dump(const int mode, const u_char *data, const int size, 150 const char *msg); 151 152 153 154#endif /* DST_INTERNAL_H */ |
155/*! \file */ |
|