diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/dh/dh.h | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h index 4cc1df2650..2cc3797a94 100644 --- a/src/lib/libcrypto/dh/dh.h +++ b/src/lib/libcrypto/dh/dh.h | |||
| @@ -63,10 +63,14 @@ | |||
| 63 | extern "C" { | 63 | extern "C" { |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | #ifndef HEADER_BN_H | 66 | #ifdef NO_DH |
| 67 | #define BIGNUM char | 67 | #error DH is disabled. |
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| 70 | #include <openssl/bn.h> | ||
| 71 | |||
| 72 | #define DH_FLAG_CACHE_MONT_P 0x01 | ||
| 73 | |||
| 70 | typedef struct dh_st | 74 | typedef struct dh_st |
| 71 | { | 75 | { |
| 72 | /* This first argument is used to pick up errors when | 76 | /* This first argument is used to pick up errors when |
| @@ -78,6 +82,9 @@ typedef struct dh_st | |||
| 78 | int length; /* optional */ | 82 | int length; /* optional */ |
| 79 | BIGNUM *pub_key; /* y */ | 83 | BIGNUM *pub_key; /* y */ |
| 80 | BIGNUM *priv_key; /* x */ | 84 | BIGNUM *priv_key; /* x */ |
| 85 | |||
| 86 | int flags; | ||
| 87 | char *method_mont_p; | ||
| 81 | } DH; | 88 | } DH; |
| 82 | 89 | ||
| 83 | #define DH_GENERATOR_2 2 | 90 | #define DH_GENERATOR_2 2 |
| @@ -98,15 +105,19 @@ typedef struct dh_st | |||
| 98 | (unsigned char *)(x)) | 105 | (unsigned char *)(x)) |
| 99 | #define d2i_DHparams_bio(bp,x) (DH *)ASN1_d2i_bio((char *(*)())DH_new, \ | 106 | #define d2i_DHparams_bio(bp,x) (DH *)ASN1_d2i_bio((char *(*)())DH_new, \ |
| 100 | (char *(*)())d2i_DHparams,(bp),(unsigned char **)(x)) | 107 | (char *(*)())d2i_DHparams,(bp),(unsigned char **)(x)) |
| 108 | #ifdef __cplusplus | ||
| 109 | #define i2d_DHparams_bio(bp,x) ASN1_i2d_bio((int (*)())i2d_DHparams,(bp), \ | ||
| 110 | (unsigned char *)(x)) | ||
| 111 | #else | ||
| 101 | #define i2d_DHparams_bio(bp,x) ASN1_i2d_bio(i2d_DHparams,(bp), \ | 112 | #define i2d_DHparams_bio(bp,x) ASN1_i2d_bio(i2d_DHparams,(bp), \ |
| 102 | (unsigned char *)(x)) | 113 | (unsigned char *)(x)) |
| 114 | #endif | ||
| 103 | 115 | ||
| 104 | #ifndef NOPROTO | ||
| 105 | DH * DH_new(void); | 116 | DH * DH_new(void); |
| 106 | void DH_free(DH *dh); | 117 | void DH_free(DH *dh); |
| 107 | int DH_size(DH *dh); | 118 | int DH_size(DH *dh); |
| 108 | DH * DH_generate_parameters(int prime_len,int generator, | 119 | DH * DH_generate_parameters(int prime_len,int generator, |
| 109 | void (*callback)(int,int,char *),char *cb_arg); | 120 | void (*callback)(int,int,void *),void *cb_arg); |
| 110 | int DH_check(DH *dh,int *codes); | 121 | int DH_check(DH *dh,int *codes); |
| 111 | int DH_generate_key(DH *dh); | 122 | int DH_generate_key(DH *dh); |
| 112 | int DH_compute_key(unsigned char *key,BIGNUM *pub_key,DH *dh); | 123 | int DH_compute_key(unsigned char *key,BIGNUM *pub_key,DH *dh); |
| @@ -122,26 +133,11 @@ int DHparams_print(char *bp, DH *x); | |||
| 122 | #endif | 133 | #endif |
| 123 | void ERR_load_DH_strings(void ); | 134 | void ERR_load_DH_strings(void ); |
| 124 | 135 | ||
| 125 | #else | ||
| 126 | |||
| 127 | DH * DH_new(); | ||
| 128 | void DH_free(); | ||
| 129 | int DH_size(); | ||
| 130 | DH * DH_generate_parameters(); | ||
| 131 | int DH_check(); | ||
| 132 | int DH_generate_key(); | ||
| 133 | int DH_compute_key(); | ||
| 134 | DH * d2i_DHparams(); | ||
| 135 | int i2d_DHparams(); | ||
| 136 | #ifndef NO_FP_API | ||
| 137 | int DHparams_print_fp(); | ||
| 138 | #endif | ||
| 139 | int DHparams_print(); | ||
| 140 | void ERR_load_DH_strings(); | ||
| 141 | |||
| 142 | #endif | ||
| 143 | |||
| 144 | /* BEGIN ERROR CODES */ | 136 | /* BEGIN ERROR CODES */ |
| 137 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 138 | * made after this point may be overwritten when the script is next run. | ||
| 139 | */ | ||
| 140 | |||
| 145 | /* Error codes for the DH functions. */ | 141 | /* Error codes for the DH functions. */ |
| 146 | 142 | ||
| 147 | /* Function codes. */ | 143 | /* Function codes. */ |
| @@ -154,7 +150,7 @@ void ERR_load_DH_strings(); | |||
| 154 | 150 | ||
| 155 | /* Reason codes. */ | 151 | /* Reason codes. */ |
| 156 | #define DH_R_NO_PRIVATE_VALUE 100 | 152 | #define DH_R_NO_PRIVATE_VALUE 100 |
| 157 | 153 | ||
| 158 | #ifdef __cplusplus | 154 | #ifdef __cplusplus |
| 159 | } | 155 | } |
| 160 | #endif | 156 | #endif |
