diff options
author | beck <> | 2000-03-19 11:13:58 +0000 |
---|---|---|
committer | beck <> | 2000-03-19 11:13:58 +0000 |
commit | 796d609550df3a33fc11468741c5d2f6d3df4c11 (patch) | |
tree | 6c6d539061caa20372dad0ac4ddb1dfae2fbe7fe /src/lib/libcrypto/dh/dh.h | |
parent | 5be3114c1fd7e0dfea1e38d3abb4cbba75244419 (diff) | |
download | openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.gz openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.bz2 openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.zip |
OpenSSL 0.9.5 merge
*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs
Diffstat (limited to 'src/lib/libcrypto/dh/dh.h')
-rw-r--r-- | src/lib/libcrypto/dh/dh.h | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h index 2cc3797a94..c15b2ad483 100644 --- a/src/lib/libcrypto/dh/dh.h +++ b/src/lib/libcrypto/dh/dh.h | |||
@@ -68,10 +68,28 @@ extern "C" { | |||
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | #include <openssl/bn.h> | 70 | #include <openssl/bn.h> |
71 | #include <openssl/crypto.h> | ||
71 | 72 | ||
72 | #define DH_FLAG_CACHE_MONT_P 0x01 | 73 | #define DH_FLAG_CACHE_MONT_P 0x01 |
73 | 74 | ||
74 | typedef struct dh_st | 75 | typedef struct dh_st DH; |
76 | |||
77 | typedef struct dh_method { | ||
78 | const char *name; | ||
79 | /* Methods here */ | ||
80 | int (*generate_key)(DH *dh); | ||
81 | int (*compute_key)(unsigned char *key,BIGNUM *pub_key,DH *dh); | ||
82 | int (*bn_mod_exp)(DH *dh, BIGNUM *r, BIGNUM *a, const BIGNUM *p, | ||
83 | const BIGNUM *m, BN_CTX *ctx, | ||
84 | BN_MONT_CTX *m_ctx); /* Can be null */ | ||
85 | |||
86 | int (*init)(DH *dh); | ||
87 | int (*finish)(DH *dh); | ||
88 | int flags; | ||
89 | char *app_data; | ||
90 | } DH_METHOD; | ||
91 | |||
92 | struct dh_st | ||
75 | { | 93 | { |
76 | /* This first argument is used to pick up errors when | 94 | /* This first argument is used to pick up errors when |
77 | * a DH is passed instead of a EVP_PKEY */ | 95 | * a DH is passed instead of a EVP_PKEY */ |
@@ -80,12 +98,22 @@ typedef struct dh_st | |||
80 | BIGNUM *p; | 98 | BIGNUM *p; |
81 | BIGNUM *g; | 99 | BIGNUM *g; |
82 | int length; /* optional */ | 100 | int length; /* optional */ |
83 | BIGNUM *pub_key; /* y */ | 101 | BIGNUM *pub_key; /* g^x */ |
84 | BIGNUM *priv_key; /* x */ | 102 | BIGNUM *priv_key; /* x */ |
85 | 103 | ||
86 | int flags; | 104 | int flags; |
87 | char *method_mont_p; | 105 | char *method_mont_p; |
88 | } DH; | 106 | /* Place holders if we want to do X9.42 DH */ |
107 | BIGNUM *q; | ||
108 | BIGNUM *j; | ||
109 | unsigned char *seed; | ||
110 | int seedlen; | ||
111 | BIGNUM *counter; | ||
112 | |||
113 | int references; | ||
114 | CRYPTO_EX_DATA ex_data; | ||
115 | DH_METHOD *meth; | ||
116 | }; | ||
89 | 117 | ||
90 | #define DH_GENERATOR_2 2 | 118 | #define DH_GENERATOR_2 2 |
91 | /* #define DH_GENERATOR_3 3 */ | 119 | /* #define DH_GENERATOR_3 3 */ |
@@ -93,10 +121,14 @@ typedef struct dh_st | |||
93 | 121 | ||
94 | /* DH_check error codes */ | 122 | /* DH_check error codes */ |
95 | #define DH_CHECK_P_NOT_PRIME 0x01 | 123 | #define DH_CHECK_P_NOT_PRIME 0x01 |
96 | #define DH_CHECK_P_NOT_STRONG_PRIME 0x02 | 124 | #define DH_CHECK_P_NOT_SAFE_PRIME 0x02 |
97 | #define DH_UNABLE_TO_CHECK_GENERATOR 0x04 | 125 | #define DH_UNABLE_TO_CHECK_GENERATOR 0x04 |
98 | #define DH_NOT_SUITABLE_GENERATOR 0x08 | 126 | #define DH_NOT_SUITABLE_GENERATOR 0x08 |
99 | 127 | ||
128 | /* primes p where (p-1)/2 is prime too are called "safe"; we define | ||
129 | this for backward compatibility: */ | ||
130 | #define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME | ||
131 | |||
100 | #define DHparams_dup(x) (DH *)ASN1_dup((int (*)())i2d_DHparams, \ | 132 | #define DHparams_dup(x) (DH *)ASN1_dup((int (*)())i2d_DHparams, \ |
101 | (char *(*)())d2i_DHparams,(char *)(x)) | 133 | (char *(*)())d2i_DHparams,(char *)(x)) |
102 | #define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ | 134 | #define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ |
@@ -113,9 +145,20 @@ typedef struct dh_st | |||
113 | (unsigned char *)(x)) | 145 | (unsigned char *)(x)) |
114 | #endif | 146 | #endif |
115 | 147 | ||
148 | DH_METHOD *DH_OpenSSL(void); | ||
149 | |||
150 | void DH_set_default_method(DH_METHOD *meth); | ||
151 | DH_METHOD *DH_get_default_method(void); | ||
152 | DH_METHOD *DH_set_method(DH *dh, DH_METHOD *meth); | ||
153 | DH *DH_new_method(DH_METHOD *meth); | ||
154 | |||
116 | DH * DH_new(void); | 155 | DH * DH_new(void); |
117 | void DH_free(DH *dh); | 156 | void DH_free(DH *dh); |
118 | int DH_size(DH *dh); | 157 | int DH_size(DH *dh); |
158 | int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | ||
159 | CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); | ||
160 | int DH_set_ex_data(DH *d, int idx, void *arg); | ||
161 | void *DH_get_ex_data(DH *d, int idx); | ||
119 | DH * DH_generate_parameters(int prime_len,int generator, | 162 | DH * DH_generate_parameters(int prime_len,int generator, |
120 | void (*callback)(int,int,void *),void *cb_arg); | 163 | void (*callback)(int,int,void *),void *cb_arg); |
121 | int DH_check(DH *dh,int *codes); | 164 | int DH_check(DH *dh,int *codes); |