summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh/dh.h
diff options
context:
space:
mode:
authordjm <>2008-09-06 12:17:54 +0000
committerdjm <>2008-09-06 12:17:54 +0000
commit38ce604e3cc97706b876b0525ddff0121115456d (patch)
tree7ccc28afe1789ea3dbedf72365f955d5b8e105b5 /src/lib/libcrypto/dh/dh.h
parent12867252827c8efaa8ddd1fa3b3d6e321e2bcdef (diff)
downloadopenbsd-38ce604e3cc97706b876b0525ddff0121115456d.tar.gz
openbsd-38ce604e3cc97706b876b0525ddff0121115456d.tar.bz2
openbsd-38ce604e3cc97706b876b0525ddff0121115456d.zip
resolve conflicts
Diffstat (limited to 'src/lib/libcrypto/dh/dh.h')
-rw-r--r--src/lib/libcrypto/dh/dh.h55
1 files changed, 34 insertions, 21 deletions
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h
index 582b34329f..0afabc7dd3 100644
--- a/src/lib/libcrypto/dh/dh.h
+++ b/src/lib/libcrypto/dh/dh.h
@@ -59,6 +59,8 @@
59#ifndef HEADER_DH_H 59#ifndef HEADER_DH_H
60#define HEADER_DH_H 60#define HEADER_DH_H
61 61
62#include <openssl/e_os2.h>
63
62#ifdef OPENSSL_NO_DH 64#ifdef OPENSSL_NO_DH
63#error DH is disabled. 65#error DH is disabled.
64#endif 66#endif
@@ -66,11 +68,14 @@
66#ifndef OPENSSL_NO_BIO 68#ifndef OPENSSL_NO_BIO
67#include <openssl/bio.h> 69#include <openssl/bio.h>
68#endif 70#endif
69#include <openssl/bn.h>
70#include <openssl/crypto.h>
71#include <openssl/ossl_typ.h> 71#include <openssl/ossl_typ.h>
72#ifndef OPENSSL_NO_DEPRECATED
73#include <openssl/bn.h>
74#endif
72 75
73#define OPENSSL_DH_MAX_MODULUS_BITS 10000 76#ifndef OPENSSL_DH_MAX_MODULUS_BITS
77# define OPENSSL_DH_MAX_MODULUS_BITS 10000
78#endif
74 79
75#define DH_FLAG_CACHE_MONT_P 0x01 80#define DH_FLAG_CACHE_MONT_P 0x01
76#define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH 81#define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH
@@ -85,9 +90,12 @@
85extern "C" { 90extern "C" {
86#endif 91#endif
87 92
88typedef struct dh_st DH; 93/* Already defined in ossl_typ.h */
94/* typedef struct dh_st DH; */
95/* typedef struct dh_method DH_METHOD; */
89 96
90typedef struct dh_method { 97struct dh_method
98 {
91 const char *name; 99 const char *name;
92 /* Methods here */ 100 /* Methods here */
93 int (*generate_key)(DH *dh); 101 int (*generate_key)(DH *dh);
@@ -100,7 +108,9 @@ typedef struct dh_method {
100 int (*finish)(DH *dh); 108 int (*finish)(DH *dh);
101 int flags; 109 int flags;
102 char *app_data; 110 char *app_data;
103} DH_METHOD; 111 /* If this is non-NULL, it will be used to generate parameters */
112 int (*generate_params)(DH *dh, int prime_len, int generator, BN_GENCB *cb);
113 };
104 114
105struct dh_st 115struct dh_st
106 { 116 {
@@ -115,7 +125,7 @@ struct dh_st
115 BIGNUM *priv_key; /* x */ 125 BIGNUM *priv_key; /* x */
116 126
117 int flags; 127 int flags;
118 char *method_mont_p; 128 BN_MONT_CTX *method_mont_p;
119 /* Place holders if we want to do X9.42 DH */ 129 /* Place holders if we want to do X9.42 DH */
120 BIGNUM *q; 130 BIGNUM *q;
121 BIGNUM *j; 131 BIGNUM *j;
@@ -147,21 +157,13 @@ struct dh_st
147 this for backward compatibility: */ 157 this for backward compatibility: */
148#define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME 158#define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
149 159
150#define DHparams_dup(x) (DH *)ASN1_dup((int (*)())i2d_DHparams, \ 160#define DHparams_dup(x) ASN1_dup_of_const(DH,i2d_DHparams,d2i_DHparams,x)
151 (char *(*)())d2i_DHparams,(char *)(x))
152#define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ 161#define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
153 (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x)) 162 (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))
154#define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \ 163#define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \
155 (unsigned char *)(x)) 164 (unsigned char *)(x))
156#define d2i_DHparams_bio(bp,x) (DH *)ASN1_d2i_bio((char *(*)())DH_new, \ 165#define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x)
157 (char *(*)())d2i_DHparams,(bp),(unsigned char **)(x)) 166#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
158#ifdef __cplusplus
159#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio((int (*)())i2d_DHparams,(bp), \
160 (unsigned char *)(x))
161#else
162#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio(i2d_DHparams,(bp), \
163 (unsigned char *)(x))
164#endif
165 167
166const DH_METHOD *DH_OpenSSL(void); 168const DH_METHOD *DH_OpenSSL(void);
167 169
@@ -178,8 +180,16 @@ int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
178 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 180 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
179int DH_set_ex_data(DH *d, int idx, void *arg); 181int DH_set_ex_data(DH *d, int idx, void *arg);
180void *DH_get_ex_data(DH *d, int idx); 182void *DH_get_ex_data(DH *d, int idx);
183
184/* Deprecated version */
185#ifndef OPENSSL_NO_DEPRECATED
181DH * DH_generate_parameters(int prime_len,int generator, 186DH * DH_generate_parameters(int prime_len,int generator,
182 void (*callback)(int,int,void *),void *cb_arg); 187 void (*callback)(int,int,void *),void *cb_arg);
188#endif /* !defined(OPENSSL_NO_DEPRECATED) */
189
190/* New version */
191int DH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb);
192
183int DH_check(const DH *dh,int *codes); 193int DH_check(const DH *dh,int *codes);
184int DH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes); 194int DH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes);
185int DH_generate_key(DH *dh); 195int DH_generate_key(DH *dh);
@@ -204,15 +214,18 @@ void ERR_load_DH_strings(void);
204/* Error codes for the DH functions. */ 214/* Error codes for the DH functions. */
205 215
206/* Function codes. */ 216/* Function codes. */
217#define DH_F_COMPUTE_KEY 102
207#define DH_F_DHPARAMS_PRINT 100 218#define DH_F_DHPARAMS_PRINT 100
208#define DH_F_DHPARAMS_PRINT_FP 101 219#define DH_F_DHPARAMS_PRINT_FP 101
209#define DH_F_DH_COMPUTE_KEY 102 220#define DH_F_DH_BUILTIN_GENPARAMS 106
210#define DH_F_DH_GENERATE_KEY 103
211#define DH_F_DH_GENERATE_PARAMETERS 104
212#define DH_F_DH_NEW_METHOD 105 221#define DH_F_DH_NEW_METHOD 105
222#define DH_F_GENERATE_KEY 103
223#define DH_F_GENERATE_PARAMETERS 104
213 224
214/* Reason codes. */ 225/* Reason codes. */
215#define DH_R_BAD_GENERATOR 101 226#define DH_R_BAD_GENERATOR 101
227#define DH_R_INVALID_PUBKEY 102
228#define DH_R_MODULUS_TOO_LARGE 103
216#define DH_R_NO_PRIVATE_VALUE 100 229#define DH_R_NO_PRIVATE_VALUE 100
217#define DH_R_INVALID_PUBKEY 102 230#define DH_R_INVALID_PUBKEY 102
218#define DH_R_MODULUS_TOO_LARGE 103 231#define DH_R_MODULUS_TOO_LARGE 103