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