summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh/dh.h
diff options
context:
space:
mode:
authorbeck <>2002-05-15 02:29:21 +0000
committerbeck <>2002-05-15 02:29:21 +0000
commitb64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9 (patch)
treefa27cf82a1250b64ed3bf5f4a18c7354d470bbcc /src/lib/libcrypto/dh/dh.h
parente471e1ea98d673597b182ea85f29e30c97cd08b5 (diff)
downloadopenbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.gz
openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.bz2
openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.zip
OpenSSL 0.9.7 stable 2002 05 08 merge
Diffstat (limited to 'src/lib/libcrypto/dh/dh.h')
-rw-r--r--src/lib/libcrypto/dh/dh.h60
1 files changed, 27 insertions, 33 deletions
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h
index 7a8d9f88c2..d51dc130f4 100644
--- a/src/lib/libcrypto/dh/dh.h
+++ b/src/lib/libcrypto/dh/dh.h
@@ -59,15 +59,16 @@
59#ifndef HEADER_DH_H 59#ifndef HEADER_DH_H
60#define HEADER_DH_H 60#define HEADER_DH_H
61 61
62#ifdef NO_DH 62#ifdef OPENSSL_NO_DH
63#error DH is disabled. 63#error DH is disabled.
64#endif 64#endif
65 65
66#ifndef NO_BIO 66#ifndef OPENSSL_NO_BIO
67#include <openssl/bio.h> 67#include <openssl/bio.h>
68#endif 68#endif
69#include <openssl/bn.h> 69#include <openssl/bn.h>
70#include <openssl/crypto.h> 70#include <openssl/crypto.h>
71#include <openssl/ossl_typ.h>
71 72
72#define DH_FLAG_CACHE_MONT_P 0x01 73#define DH_FLAG_CACHE_MONT_P 0x01
73 74
@@ -81,9 +82,9 @@ typedef struct dh_method {
81 const char *name; 82 const char *name;
82 /* Methods here */ 83 /* Methods here */
83 int (*generate_key)(DH *dh); 84 int (*generate_key)(DH *dh);
84 int (*compute_key)(unsigned char *key,BIGNUM *pub_key,DH *dh); 85 int (*compute_key)(unsigned char *key,const BIGNUM *pub_key,DH *dh);
85 int (*bn_mod_exp)(DH *dh, BIGNUM *r, BIGNUM *a, const BIGNUM *p, 86 int (*bn_mod_exp)(const DH *dh, BIGNUM *r, const BIGNUM *a,
86 const BIGNUM *m, BN_CTX *ctx, 87 const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
87 BN_MONT_CTX *m_ctx); /* Can be null */ 88 BN_MONT_CTX *m_ctx); /* Can be null */
88 89
89 int (*init)(DH *dh); 90 int (*init)(DH *dh);
@@ -115,11 +116,8 @@ struct dh_st
115 116
116 int references; 117 int references;
117 CRYPTO_EX_DATA ex_data; 118 CRYPTO_EX_DATA ex_data;
118#if 0 119 const DH_METHOD *meth;
119 DH_METHOD *meth; 120 ENGINE *engine;
120#else
121 struct engine_st *engine;
122#endif
123 }; 121 };
124 122
125#define DH_GENERATOR_2 2 123#define DH_GENERATOR_2 2
@@ -152,46 +150,42 @@ struct dh_st
152 (unsigned char *)(x)) 150 (unsigned char *)(x))
153#endif 151#endif
154 152
155DH_METHOD *DH_OpenSSL(void); 153const DH_METHOD *DH_OpenSSL(void);
156 154
157void DH_set_default_openssl_method(DH_METHOD *meth); 155void DH_set_default_method(const DH_METHOD *meth);
158DH_METHOD *DH_get_default_openssl_method(void); 156const DH_METHOD *DH_get_default_method(void);
159#if 0 157int DH_set_method(DH *dh, const DH_METHOD *meth);
160DH_METHOD *DH_set_method(DH *dh, DH_METHOD *meth); 158DH *DH_new_method(ENGINE *engine);
161DH *DH_new_method(DH_METHOD *meth);
162#else
163int DH_set_method(DH *dh, struct engine_st *engine);
164DH *DH_new_method(struct engine_st *engine);
165#endif
166 159
167DH * DH_new(void); 160DH * DH_new(void);
168void DH_free(DH *dh); 161void DH_free(DH *dh);
169int DH_size(DH *dh); 162int DH_up_ref(DH *dh);
163int DH_size(const DH *dh);
170int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 164int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
171 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 165 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
172int DH_set_ex_data(DH *d, int idx, void *arg); 166int DH_set_ex_data(DH *d, int idx, void *arg);
173void *DH_get_ex_data(DH *d, int idx); 167void *DH_get_ex_data(DH *d, int idx);
174DH * DH_generate_parameters(int prime_len,int generator, 168DH * DH_generate_parameters(int prime_len,int generator,
175 void (*callback)(int,int,void *),void *cb_arg); 169 void (*callback)(int,int,void *),void *cb_arg);
176int DH_check(DH *dh,int *codes); 170int DH_check(const DH *dh,int *codes);
177int DH_generate_key(DH *dh); 171int DH_generate_key(DH *dh);
178int DH_compute_key(unsigned char *key,BIGNUM *pub_key,DH *dh); 172int DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh);
179DH * d2i_DHparams(DH **a,unsigned char **pp, long length); 173DH * d2i_DHparams(DH **a,const unsigned char **pp, long length);
180int i2d_DHparams(DH *a,unsigned char **pp); 174int i2d_DHparams(const DH *a,unsigned char **pp);
181#ifndef NO_FP_API 175#ifndef OPENSSL_NO_FP_API
182int DHparams_print_fp(FILE *fp, DH *x); 176int DHparams_print_fp(FILE *fp, const DH *x);
183#endif 177#endif
184#ifndef NO_BIO 178#ifndef OPENSSL_NO_BIO
185int DHparams_print(BIO *bp, DH *x); 179int DHparams_print(BIO *bp, const DH *x);
186#else 180#else
187int DHparams_print(char *bp, DH *x); 181int DHparams_print(char *bp, const DH *x);
188#endif 182#endif
189void ERR_load_DH_strings(void );
190 183
191/* BEGIN ERROR CODES */ 184/* BEGIN ERROR CODES */
192/* The following lines are auto generated by the script mkerr.pl. Any changes 185/* The following lines are auto generated by the script mkerr.pl. Any changes
193 * made after this point may be overwritten when the script is next run. 186 * made after this point may be overwritten when the script is next run.
194 */ 187 */
188void ERR_load_DH_strings(void);
195 189
196/* Error codes for the DH functions. */ 190/* Error codes for the DH functions. */
197 191
@@ -201,13 +195,13 @@ void ERR_load_DH_strings(void );
201#define DH_F_DH_COMPUTE_KEY 102 195#define DH_F_DH_COMPUTE_KEY 102
202#define DH_F_DH_GENERATE_KEY 103 196#define DH_F_DH_GENERATE_KEY 103
203#define DH_F_DH_GENERATE_PARAMETERS 104 197#define DH_F_DH_GENERATE_PARAMETERS 104
204#define DH_F_DH_NEW 105 198#define DH_F_DH_NEW_METHOD 105
205 199
206/* Reason codes. */ 200/* Reason codes. */
201#define DH_R_BAD_GENERATOR 101
207#define DH_R_NO_PRIVATE_VALUE 100 202#define DH_R_NO_PRIVATE_VALUE 100
208 203
209#ifdef __cplusplus 204#ifdef __cplusplus
210} 205}
211#endif 206#endif
212#endif 207#endif
213