diff options
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa.h')
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa.h | 59 |
1 files changed, 23 insertions, 36 deletions
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 3a8fe5b56b..aa0669eb7a 100644 --- a/src/lib/libcrypto/dsa/dsa.h +++ b/src/lib/libcrypto/dsa/dsa.h | |||
| @@ -65,8 +65,6 @@ | |||
| 65 | #ifndef HEADER_DSA_H | 65 | #ifndef HEADER_DSA_H |
| 66 | #define HEADER_DSA_H | 66 | #define HEADER_DSA_H |
| 67 | 67 | ||
| 68 | #include <openssl/e_os2.h> | ||
| 69 | |||
| 70 | #ifdef OPENSSL_NO_DSA | 68 | #ifdef OPENSSL_NO_DSA |
| 71 | #error DSA is disabled. | 69 | #error DSA is disabled. |
| 72 | #endif | 70 | #endif |
| @@ -74,19 +72,14 @@ | |||
| 74 | #ifndef OPENSSL_NO_BIO | 72 | #ifndef OPENSSL_NO_BIO |
| 75 | #include <openssl/bio.h> | 73 | #include <openssl/bio.h> |
| 76 | #endif | 74 | #endif |
| 75 | #include <openssl/bn.h> | ||
| 77 | #include <openssl/crypto.h> | 76 | #include <openssl/crypto.h> |
| 78 | #include <openssl/ossl_typ.h> | 77 | #include <openssl/ossl_typ.h> |
| 79 | |||
| 80 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 81 | #include <openssl/bn.h> | ||
| 82 | #ifndef OPENSSL_NO_DH | 78 | #ifndef OPENSSL_NO_DH |
| 83 | # include <openssl/dh.h> | 79 | # include <openssl/dh.h> |
| 84 | #endif | 80 | #endif |
| 85 | #endif | ||
| 86 | 81 | ||
| 87 | #ifndef OPENSSL_DSA_MAX_MODULUS_BITS | 82 | #define OPENSSL_DSA_MAX_MODULUS_BITS 3072 |
| 88 | # define OPENSSL_DSA_MAX_MODULUS_BITS 10000 | ||
| 89 | #endif | ||
| 90 | 83 | ||
| 91 | #define DSA_FLAG_CACHE_MONT_P 0x01 | 84 | #define DSA_FLAG_CACHE_MONT_P 0x01 |
| 92 | #define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA | 85 | #define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA |
| @@ -97,13 +90,22 @@ | |||
| 97 | * be used for all exponents. | 90 | * be used for all exponents. |
| 98 | */ | 91 | */ |
| 99 | 92 | ||
| 93 | /* If this flag is set external DSA_METHOD callbacks are allowed in FIPS mode | ||
| 94 | * it is then the applications responsibility to ensure the external method | ||
| 95 | * is compliant. | ||
| 96 | */ | ||
| 97 | |||
| 98 | #define DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW 0x04 | ||
| 99 | |||
| 100 | #if defined(OPENSSL_FIPS) | ||
| 101 | #define FIPS_DSA_SIZE_T int | ||
| 102 | #endif | ||
| 103 | |||
| 100 | #ifdef __cplusplus | 104 | #ifdef __cplusplus |
| 101 | extern "C" { | 105 | extern "C" { |
| 102 | #endif | 106 | #endif |
| 103 | 107 | ||
| 104 | /* Already defined in ossl_typ.h */ | 108 | typedef struct dsa_st DSA; |
| 105 | /* typedef struct dsa_st DSA; */ | ||
| 106 | /* typedef struct dsa_method DSA_METHOD; */ | ||
| 107 | 109 | ||
| 108 | typedef struct DSA_SIG_st | 110 | typedef struct DSA_SIG_st |
| 109 | { | 111 | { |
| @@ -111,8 +113,7 @@ typedef struct DSA_SIG_st | |||
| 111 | BIGNUM *s; | 113 | BIGNUM *s; |
| 112 | } DSA_SIG; | 114 | } DSA_SIG; |
| 113 | 115 | ||
| 114 | struct dsa_method | 116 | typedef struct dsa_method { |
| 115 | { | ||
| 116 | const char *name; | 117 | const char *name; |
| 117 | DSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa); | 118 | DSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa); |
| 118 | int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, | 119 | int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, |
| @@ -129,14 +130,7 @@ struct dsa_method | |||
| 129 | int (*finish)(DSA *dsa); | 130 | int (*finish)(DSA *dsa); |
| 130 | int flags; | 131 | int flags; |
| 131 | char *app_data; | 132 | char *app_data; |
| 132 | /* If this is non-NULL, it is used to generate DSA parameters */ | 133 | } DSA_METHOD; |
| 133 | int (*dsa_paramgen)(DSA *dsa, int bits, | ||
| 134 | unsigned char *seed, int seed_len, | ||
| 135 | int *counter_ret, unsigned long *h_ret, | ||
| 136 | BN_GENCB *cb); | ||
| 137 | /* If this is non-NULL, it is used to generate DSA keys */ | ||
| 138 | int (*dsa_keygen)(DSA *dsa); | ||
| 139 | }; | ||
| 140 | 134 | ||
| 141 | struct dsa_st | 135 | struct dsa_st |
| 142 | { | 136 | { |
| @@ -157,7 +151,7 @@ struct dsa_st | |||
| 157 | 151 | ||
| 158 | int flags; | 152 | int flags; |
| 159 | /* Normally used to cache montgomery values */ | 153 | /* Normally used to cache montgomery values */ |
| 160 | BN_MONT_CTX *method_mont_p; | 154 | char *method_mont_p; |
| 161 | int references; | 155 | int references; |
| 162 | CRYPTO_EX_DATA ex_data; | 156 | CRYPTO_EX_DATA ex_data; |
| 163 | const DSA_METHOD *meth; | 157 | const DSA_METHOD *meth; |
| @@ -165,13 +159,16 @@ struct dsa_st | |||
| 165 | ENGINE *engine; | 159 | ENGINE *engine; |
| 166 | }; | 160 | }; |
| 167 | 161 | ||
| 168 | #define DSAparams_dup(x) ASN1_dup_of_const(DSA,i2d_DSAparams,d2i_DSAparams,x) | 162 | #define DSAparams_dup(x) (DSA *)ASN1_dup((int (*)())i2d_DSAparams, \ |
| 163 | (char *(*)())d2i_DSAparams,(char *)(x)) | ||
| 169 | #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ | 164 | #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ |
| 170 | (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) | 165 | (char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x)) |
| 171 | #define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ | 166 | #define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \ |
| 172 | (unsigned char *)(x)) | 167 | (unsigned char *)(x)) |
| 173 | #define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x) | 168 | #define d2i_DSAparams_bio(bp,x) (DSA *)ASN1_d2i_bio((char *(*)())DSA_new, \ |
| 174 | #define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x) | 169 | (char *(*)())d2i_DSAparams,(bp),(unsigned char **)(x)) |
| 170 | #define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio(i2d_DSAparams,(bp), \ | ||
| 171 | (unsigned char *)(x)) | ||
| 175 | 172 | ||
| 176 | 173 | ||
| 177 | DSA_SIG * DSA_SIG_new(void); | 174 | DSA_SIG * DSA_SIG_new(void); |
| @@ -209,20 +206,10 @@ void *DSA_get_ex_data(DSA *d, int idx); | |||
| 209 | DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); | 206 | DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); |
| 210 | DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); | 207 | DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length); |
| 211 | DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, long length); | 208 | DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, long length); |
| 212 | |||
| 213 | /* Deprecated version */ | ||
| 214 | #ifndef OPENSSL_NO_DEPRECATED | ||
| 215 | DSA * DSA_generate_parameters(int bits, | 209 | DSA * DSA_generate_parameters(int bits, |
| 216 | unsigned char *seed,int seed_len, | 210 | unsigned char *seed,int seed_len, |
| 217 | int *counter_ret, unsigned long *h_ret,void | 211 | int *counter_ret, unsigned long *h_ret,void |
| 218 | (*callback)(int, int, void *),void *cb_arg); | 212 | (*callback)(int, int, void *),void *cb_arg); |
| 219 | #endif /* !defined(OPENSSL_NO_DEPRECATED) */ | ||
| 220 | |||
| 221 | /* New version */ | ||
| 222 | int DSA_generate_parameters_ex(DSA *dsa, int bits, | ||
| 223 | unsigned char *seed,int seed_len, | ||
| 224 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); | ||
| 225 | |||
| 226 | int DSA_generate_key(DSA *a); | 213 | int DSA_generate_key(DSA *a); |
| 227 | int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); | 214 | int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); |
| 228 | int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); | 215 | int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp); |
