diff options
| author | beck <> | 1999-09-29 04:37:45 +0000 |
|---|---|---|
| committer | beck <> | 1999-09-29 04:37:45 +0000 |
| commit | de8f24ea083384bb66b32ec105dc4743c5663cdf (patch) | |
| tree | 1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/dsa/dsa.h | |
| parent | cb929d29896bcb87c2a97417fbd03e50078fc178 (diff) | |
| download | openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2 openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip | |
OpenSSL 0.9.4 merge
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa.h')
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa.h | 80 |
1 files changed, 45 insertions, 35 deletions
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 1ca87c1cbe..20b3f8d90a 100644 --- a/src/lib/libcrypto/dsa/dsa.h +++ b/src/lib/libcrypto/dsa/dsa.h | |||
| @@ -69,7 +69,16 @@ | |||
| 69 | extern "C" { | 69 | extern "C" { |
| 70 | #endif | 70 | #endif |
| 71 | 71 | ||
| 72 | #include "bn.h" | 72 | #ifdef NO_DSA |
| 73 | #error DSA is disabled. | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #include <openssl/bn.h> | ||
| 77 | #ifndef NO_DH | ||
| 78 | # include <openssl/dh.h> | ||
| 79 | #endif | ||
| 80 | |||
| 81 | #define DSA_FLAG_CACHE_MONT_P 0x01 | ||
| 73 | 82 | ||
| 74 | typedef struct dsa_st | 83 | typedef struct dsa_st |
| 75 | { | 84 | { |
| @@ -88,9 +97,19 @@ typedef struct dsa_st | |||
| 88 | BIGNUM *kinv; /* Signing pre-calc */ | 97 | BIGNUM *kinv; /* Signing pre-calc */ |
| 89 | BIGNUM *r; /* Signing pre-calc */ | 98 | BIGNUM *r; /* Signing pre-calc */ |
| 90 | 99 | ||
| 100 | int flags; | ||
| 101 | /* Normally used to cache montgomery values */ | ||
| 102 | char *method_mont_p; | ||
| 103 | |||
| 91 | int references; | 104 | int references; |
| 92 | } DSA; | 105 | } DSA; |
| 93 | 106 | ||
| 107 | typedef struct DSA_SIG_st | ||
| 108 | { | ||
| 109 | BIGNUM *r; | ||
| 110 | BIGNUM *s; | ||
| 111 | } DSA_SIG; | ||
| 112 | |||
| 94 | #define DSAparams_dup(x) (DSA *)ASN1_dup((int (*)())i2d_DSAparams, \ | 113 | #define DSAparams_dup(x) (DSA *)ASN1_dup((int (*)())i2d_DSAparams, \ |
| 95 | (char *(*)())d2i_DSAparams,(char *)(x)) | 114 | (char *(*)())d2i_DSAparams,(char *)(x)) |
| 96 | #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ | 115 | #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \ |
| @@ -102,15 +121,23 @@ typedef struct dsa_st | |||
| 102 | #define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio(i2d_DSAparams,(bp), \ | 121 | #define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio(i2d_DSAparams,(bp), \ |
| 103 | (unsigned char *)(x)) | 122 | (unsigned char *)(x)) |
| 104 | 123 | ||
| 105 | #ifndef NOPROTO | 124 | |
| 125 | DSA_SIG * DSA_SIG_new(void); | ||
| 126 | void DSA_SIG_free(DSA_SIG *a); | ||
| 127 | int i2d_DSA_SIG(DSA_SIG *a, unsigned char **pp); | ||
| 128 | DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, unsigned char **pp, long length); | ||
| 129 | |||
| 130 | DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa); | ||
| 131 | int DSA_do_verify(const unsigned char *dgst,int dgst_len, | ||
| 132 | DSA_SIG *sig,DSA *dsa); | ||
| 106 | 133 | ||
| 107 | DSA * DSA_new(void); | 134 | DSA * DSA_new(void); |
| 108 | int DSA_size(DSA *); | 135 | int DSA_size(DSA *); |
| 109 | /* next 4 return -1 on error */ | 136 | /* next 4 return -1 on error */ |
| 110 | int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp); | 137 | int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp); |
| 111 | int DSA_sign(int type,unsigned char *dgst,int dlen, | 138 | int DSA_sign(int type,const unsigned char *dgst,int dlen, |
| 112 | unsigned char *sig, unsigned int *siglen, DSA *dsa); | 139 | unsigned char *sig, unsigned int *siglen, DSA *dsa); |
| 113 | int DSA_verify(int type,unsigned char *dgst,int dgst_len, | 140 | int DSA_verify(int type,const unsigned char *dgst,int dgst_len, |
| 114 | unsigned char *sigbuf, int siglen, DSA *dsa); | 141 | unsigned char *sigbuf, int siglen, DSA *dsa); |
| 115 | void DSA_free (DSA *r); | 142 | void DSA_free (DSA *r); |
| 116 | 143 | ||
| @@ -138,55 +165,38 @@ int DSA_print_fp(FILE *bp, DSA *x, int off); | |||
| 138 | 165 | ||
| 139 | int DSA_is_prime(BIGNUM *q,void (*callback)(),char *cb_arg); | 166 | int DSA_is_prime(BIGNUM *q,void (*callback)(),char *cb_arg); |
| 140 | 167 | ||
| 141 | #else | 168 | #ifndef NO_DH |
| 142 | 169 | /* Convert DSA structure (key or just parameters) into DH structure | |
| 143 | DSA * DSA_new(); | 170 | * (be careful to avoid small subgroup attacks when using this!) */ |
| 144 | int DSA_size(); | 171 | DH *DSA_dup_DH(DSA *r); |
| 145 | int DSA_sign_setup(); | ||
| 146 | int DSA_sign(); | ||
| 147 | int DSA_verify(); | ||
| 148 | void DSA_free (); | ||
| 149 | |||
| 150 | void ERR_load_DSA_strings(); | ||
| 151 | |||
| 152 | DSA * d2i_DSAPublicKey(); | ||
| 153 | DSA * d2i_DSAPrivateKey(); | ||
| 154 | DSA * d2i_DSAparams(); | ||
| 155 | DSA * DSA_generate_parameters(); | ||
| 156 | int DSA_generate_key(); | ||
| 157 | int i2d_DSAPublicKey(); | ||
| 158 | int i2d_DSAPrivateKey(); | ||
| 159 | int i2d_DSAparams(); | ||
| 160 | |||
| 161 | int DSA_is_prime(); | ||
| 162 | |||
| 163 | int DSAparams_print(); | ||
| 164 | int DSA_print(); | ||
| 165 | |||
| 166 | #ifndef NO_FP_API | ||
| 167 | int DSAparams_print_fp(); | ||
| 168 | int DSA_print_fp(); | ||
| 169 | #endif | ||
| 170 | |||
| 171 | #endif | 172 | #endif |
| 172 | 173 | ||
| 173 | /* BEGIN ERROR CODES */ | 174 | /* BEGIN ERROR CODES */ |
| 175 | /* The following lines are auto generated by the script mkerr.pl. Any changes | ||
| 176 | * made after this point may be overwritten when the script is next run. | ||
| 177 | */ | ||
| 178 | |||
| 174 | /* Error codes for the DSA functions. */ | 179 | /* Error codes for the DSA functions. */ |
| 175 | 180 | ||
| 176 | /* Function codes. */ | 181 | /* Function codes. */ |
| 182 | #define DSA_F_D2I_DSA_SIG 110 | ||
| 177 | #define DSA_F_DSAPARAMS_PRINT 100 | 183 | #define DSA_F_DSAPARAMS_PRINT 100 |
| 178 | #define DSA_F_DSAPARAMS_PRINT_FP 101 | 184 | #define DSA_F_DSAPARAMS_PRINT_FP 101 |
| 185 | #define DSA_F_DSA_DO_SIGN 112 | ||
| 186 | #define DSA_F_DSA_DO_VERIFY 113 | ||
| 179 | #define DSA_F_DSA_IS_PRIME 102 | 187 | #define DSA_F_DSA_IS_PRIME 102 |
| 180 | #define DSA_F_DSA_NEW 103 | 188 | #define DSA_F_DSA_NEW 103 |
| 181 | #define DSA_F_DSA_PRINT 104 | 189 | #define DSA_F_DSA_PRINT 104 |
| 182 | #define DSA_F_DSA_PRINT_FP 105 | 190 | #define DSA_F_DSA_PRINT_FP 105 |
| 183 | #define DSA_F_DSA_SIGN 106 | 191 | #define DSA_F_DSA_SIGN 106 |
| 184 | #define DSA_F_DSA_SIGN_SETUP 107 | 192 | #define DSA_F_DSA_SIGN_SETUP 107 |
| 193 | #define DSA_F_DSA_SIG_NEW 109 | ||
| 185 | #define DSA_F_DSA_VERIFY 108 | 194 | #define DSA_F_DSA_VERIFY 108 |
| 195 | #define DSA_F_I2D_DSA_SIG 111 | ||
| 186 | 196 | ||
| 187 | /* Reason codes. */ | 197 | /* Reason codes. */ |
| 188 | #define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 | 198 | #define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100 |
| 189 | 199 | ||
| 190 | #ifdef __cplusplus | 200 | #ifdef __cplusplus |
| 191 | } | 201 | } |
| 192 | #endif | 202 | #endif |
