summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dsa/dsa.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa.h')
-rw-r--r--src/lib/libcrypto/dsa/dsa.h80
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 @@
69extern "C" { 69extern "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
74typedef struct dsa_st 83typedef 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
107typedef 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
125DSA_SIG * DSA_SIG_new(void);
126void DSA_SIG_free(DSA_SIG *a);
127int i2d_DSA_SIG(DSA_SIG *a, unsigned char **pp);
128DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, unsigned char **pp, long length);
129
130DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa);
131int DSA_do_verify(const unsigned char *dgst,int dgst_len,
132 DSA_SIG *sig,DSA *dsa);
106 133
107DSA * DSA_new(void); 134DSA * DSA_new(void);
108int DSA_size(DSA *); 135int DSA_size(DSA *);
109 /* next 4 return -1 on error */ 136 /* next 4 return -1 on error */
110int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp); 137int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp);
111int DSA_sign(int type,unsigned char *dgst,int dlen, 138int 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);
113int DSA_verify(int type,unsigned char *dgst,int dgst_len, 140int 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);
115void DSA_free (DSA *r); 142void DSA_free (DSA *r);
116 143
@@ -138,55 +165,38 @@ int DSA_print_fp(FILE *bp, DSA *x, int off);
138 165
139int DSA_is_prime(BIGNUM *q,void (*callback)(),char *cb_arg); 166int 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
143DSA * DSA_new(); 170 * (be careful to avoid small subgroup attacks when using this!) */
144int DSA_size(); 171DH *DSA_dup_DH(DSA *r);
145int DSA_sign_setup();
146int DSA_sign();
147int DSA_verify();
148void DSA_free ();
149
150void ERR_load_DSA_strings();
151
152DSA * d2i_DSAPublicKey();
153DSA * d2i_DSAPrivateKey();
154DSA * d2i_DSAparams();
155DSA * DSA_generate_parameters();
156int DSA_generate_key();
157int i2d_DSAPublicKey();
158int i2d_DSAPrivateKey();
159int i2d_DSAparams();
160
161int DSA_is_prime();
162
163int DSAparams_print();
164int DSA_print();
165
166#ifndef NO_FP_API
167int DSAparams_print_fp();
168int 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