| OLD | NEW |
| 1 /* crypto/dh/dh.h */ | 1 /* crypto/dh/dh.h */ |
| 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
| 6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
| 7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
| 8 * | 8 * |
| 9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
| 10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 #endif | 70 #endif |
| 71 #include <openssl/ossl_typ.h> | 71 #include <openssl/ossl_typ.h> |
| 72 #ifndef OPENSSL_NO_DEPRECATED | 72 #ifndef OPENSSL_NO_DEPRECATED |
| 73 #include <openssl/bn.h> | 73 #include <openssl/bn.h> |
| 74 #endif | 74 #endif |
| 75 | 75 |
| 76 #ifndef OPENSSL_DH_MAX_MODULUS_BITS | 76 #ifndef OPENSSL_DH_MAX_MODULUS_BITS |
| 77 # define OPENSSL_DH_MAX_MODULUS_BITS 10000 | 77 # define OPENSSL_DH_MAX_MODULUS_BITS 10000 |
| 78 #endif | 78 #endif |
| 79 | 79 |
| 80 #define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024 | |
| 81 | |
| 82 #define DH_FLAG_CACHE_MONT_P 0x01 | 80 #define DH_FLAG_CACHE_MONT_P 0x01 |
| 83 #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 |
| 84 * implementation now uses constant time | 82 * implementation now uses constant time |
| 85 * modular exponentiation for secret expon
ents | 83 * modular exponentiation for secret expon
ents |
| 86 * by default. This flag causes the | 84 * by default. This flag causes the |
| 87 * faster variable sliding window method t
o | 85 * faster variable sliding window method t
o |
| 88 * be used for all exponents. | 86 * be used for all exponents. |
| 89 */ | 87 */ |
| 90 | 88 |
| 91 #ifdef __cplusplus | 89 #ifdef __cplusplus |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 #define DH_NOT_SUITABLE_GENERATOR 0x08 | 150 #define DH_NOT_SUITABLE_GENERATOR 0x08 |
| 153 | 151 |
| 154 /* DH_check_pub_key error codes */ | 152 /* DH_check_pub_key error codes */ |
| 155 #define DH_CHECK_PUBKEY_TOO_SMALL 0x01 | 153 #define DH_CHECK_PUBKEY_TOO_SMALL 0x01 |
| 156 #define DH_CHECK_PUBKEY_TOO_LARGE 0x02 | 154 #define DH_CHECK_PUBKEY_TOO_LARGE 0x02 |
| 157 | 155 |
| 158 /* primes p where (p-1)/2 is prime too are called "safe"; we define | 156 /* primes p where (p-1)/2 is prime too are called "safe"; we define |
| 159 this for backward compatibility: */ | 157 this for backward compatibility: */ |
| 160 #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 |
| 161 | 159 |
| 162 #define DHparams_dup(x) ASN1_dup_of_const(DH,i2d_DHparams,d2i_DHparams,x) | |
| 163 #define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ | 160 #define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \ |
| 164 (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x)) | 161 (char *(*)())d2i_DHparams,(fp),(unsigned char **)(x)) |
| 165 #define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \ | 162 #define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \ |
| 166 (unsigned char *)(x)) | 163 (unsigned char *)(x)) |
| 167 #define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x) | 164 #define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x) |
| 168 #define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) | 165 #define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x) |
| 169 | 166 |
| 167 DH *DHparams_dup(DH *); |
| 168 |
| 170 const DH_METHOD *DH_OpenSSL(void); | 169 const DH_METHOD *DH_OpenSSL(void); |
| 171 | 170 |
| 172 #ifdef OPENSSL_FIPS | |
| 173 DH * FIPS_dh_new(void); | |
| 174 void FIPS_dh_free(DH *dh); | |
| 175 #endif | |
| 176 | |
| 177 void DH_set_default_method(const DH_METHOD *meth); | 171 void DH_set_default_method(const DH_METHOD *meth); |
| 178 const DH_METHOD *DH_get_default_method(void); | 172 const DH_METHOD *DH_get_default_method(void); |
| 179 int DH_set_method(DH *dh, const DH_METHOD *meth); | 173 int DH_set_method(DH *dh, const DH_METHOD *meth); |
| 180 DH *DH_new_method(ENGINE *engine); | 174 DH *DH_new_method(ENGINE *engine); |
| 181 | 175 |
| 182 DH * DH_new(void); | 176 DH * DH_new(void); |
| 183 void DH_free(DH *dh); | 177 void DH_free(DH *dh); |
| 184 int DH_up_ref(DH *dh); | 178 int DH_up_ref(DH *dh); |
| 185 int DH_size(const DH *dh); | 179 int DH_size(const DH *dh); |
| 186 int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 180 int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 205 int i2d_DHparams(const DH *a,unsigned char **pp); | 199 int i2d_DHparams(const DH *a,unsigned char **pp); |
| 206 #ifndef OPENSSL_NO_FP_API | 200 #ifndef OPENSSL_NO_FP_API |
| 207 int DHparams_print_fp(FILE *fp, const DH *x); | 201 int DHparams_print_fp(FILE *fp, const DH *x); |
| 208 #endif | 202 #endif |
| 209 #ifndef OPENSSL_NO_BIO | 203 #ifndef OPENSSL_NO_BIO |
| 210 int DHparams_print(BIO *bp, const DH *x); | 204 int DHparams_print(BIO *bp, const DH *x); |
| 211 #else | 205 #else |
| 212 int DHparams_print(char *bp, const DH *x); | 206 int DHparams_print(char *bp, const DH *x); |
| 213 #endif | 207 #endif |
| 214 | 208 |
| 209 #define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ |
| 210 EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ |
| 211 EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL) |
| 212 |
| 213 #define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \ |
| 214 EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ |
| 215 EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL) |
| 216 |
| 217 #define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1) |
| 218 #define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2) |
| 219 |
| 220 |
| 215 /* BEGIN ERROR CODES */ | 221 /* BEGIN ERROR CODES */ |
| 216 /* The following lines are auto generated by the script mkerr.pl. Any changes | 222 /* The following lines are auto generated by the script mkerr.pl. Any changes |
| 217 * made after this point may be overwritten when the script is next run. | 223 * made after this point may be overwritten when the script is next run. |
| 218 */ | 224 */ |
| 219 void ERR_load_DH_strings(void); | 225 void ERR_load_DH_strings(void); |
| 220 | 226 |
| 221 /* Error codes for the DH functions. */ | 227 /* Error codes for the DH functions. */ |
| 222 | 228 |
| 223 /* Function codes. */ | 229 /* Function codes. */ |
| 224 #define DH_F_COMPUTE_KEY 102 | 230 #define DH_F_COMPUTE_KEY 102 |
| 225 #define DH_F_DHPARAMS_PRINT 100 | |
| 226 #define DH_F_DHPARAMS_PRINT_FP 101 | 231 #define DH_F_DHPARAMS_PRINT_FP 101 |
| 227 #define DH_F_DH_BUILTIN_GENPARAMS 106 | 232 #define DH_F_DH_BUILTIN_GENPARAMS 106 |
| 228 #define DH_F_DH_COMPUTE_KEY 107 | |
| 229 #define DH_F_DH_GENERATE_KEY 108 | |
| 230 #define DH_F_DH_GENERATE_PARAMETERS 109 | |
| 231 #define DH_F_DH_NEW_METHOD 105 | 233 #define DH_F_DH_NEW_METHOD 105 |
| 234 #define DH_F_DH_PARAM_DECODE 107 |
| 235 #define DH_F_DH_PRIV_DECODE 110 |
| 236 #define DH_F_DH_PRIV_ENCODE 111 |
| 237 #define DH_F_DH_PUB_DECODE 108 |
| 238 #define DH_F_DH_PUB_ENCODE 109 |
| 239 #define DH_F_DO_DH_PRINT 100 |
| 232 #define DH_F_GENERATE_KEY 103 | 240 #define DH_F_GENERATE_KEY 103 |
| 233 #define DH_F_GENERATE_PARAMETERS 104 | 241 #define DH_F_GENERATE_PARAMETERS 104 |
| 242 #define DH_F_PKEY_DH_DERIVE 112 |
| 243 #define DH_F_PKEY_DH_KEYGEN 113 |
| 234 | 244 |
| 235 /* Reason codes. */ | 245 /* Reason codes. */ |
| 236 #define DH_R_BAD_GENERATOR 101 | 246 #define DH_R_BAD_GENERATOR 101 |
| 247 #define DH_R_BN_DECODE_ERROR 109 |
| 248 #define DH_R_BN_ERROR 106 |
| 249 #define DH_R_DECODE_ERROR 104 |
| 237 #define DH_R_INVALID_PUBKEY 102 | 250 #define DH_R_INVALID_PUBKEY 102 |
| 238 #define DH_R_KEY_SIZE_TOO_SMALL»» » » 104 | 251 #define DH_R_KEYS_NOT_SET» » » » 108 |
| 239 #define DH_R_MODULUS_TOO_LARGE 103 | 252 #define DH_R_MODULUS_TOO_LARGE 103 |
| 253 #define DH_R_NO_PARAMETERS_SET 107 |
| 240 #define DH_R_NO_PRIVATE_VALUE 100 | 254 #define DH_R_NO_PRIVATE_VALUE 100 |
| 255 #define DH_R_PARAMETER_ENCODING_ERROR 105 |
| 241 | 256 |
| 242 #ifdef __cplusplus | 257 #ifdef __cplusplus |
| 243 } | 258 } |
| 244 #endif | 259 #endif |
| 245 #endif | 260 #endif |
| OLD | NEW |