New Configure option no-<cipher> (rsa, idea, rc5, ...).
[openssl.git] / crypto / dsa / dsa.h
index 1ca87c1cbea1bef92b75fad3c9ace09b79bc4515..d9ff1933ee2e139591b61e71a7a80a39f6c8349f 100644 (file)
 extern "C" {
 #endif
 
-#include "bn.h"
+#ifdef NO_DSA
+#error DSA is disabled.
+#endif
+
+#include <openssl/bn.h>
+
+#define DSA_FLAG_CACHE_MONT_P  0x01
 
 typedef struct dsa_st
        {
@@ -88,9 +94,19 @@ typedef struct dsa_st
        BIGNUM *kinv;   /* Signing pre-calc */
        BIGNUM *r;      /* Signing pre-calc */
 
+       int flags;
+       /* Normally used to cache montgomery values */
+       char *method_mont_p;
+
        int references;
        } DSA;
 
+typedef struct DSA_SIG_st
+       {
+       BIGNUM *r;
+       BIGNUM *s;
+       } DSA_SIG;
+
 #define DSAparams_dup(x) (DSA *)ASN1_dup((int (*)())i2d_DSAparams, \
                (char *(*)())d2i_DSAparams,(char *)(x))
 #define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \
@@ -102,15 +118,23 @@ typedef struct dsa_st
 #define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio(i2d_DSAparams,(bp), \
                (unsigned char *)(x))
 
-#ifndef NOPROTO
+
+DSA_SIG * DSA_SIG_new(void);
+void   DSA_SIG_free(DSA_SIG *a);
+int    i2d_DSA_SIG(DSA_SIG *a, unsigned char **pp);
+DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, unsigned char **pp, long length);
+
+DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa);
+int    DSA_do_verify(const unsigned char *dgst,int dgst_len,
+                     DSA_SIG *sig,DSA *dsa);
 
 DSA *  DSA_new(void);
 int    DSA_size(DSA *);
        /* next 4 return -1 on error */
 int    DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp);
-int    DSA_sign(int type,unsigned char *dgst,int dlen,
+int    DSA_sign(int type,const unsigned char *dgst,int dlen,
                unsigned char *sig, unsigned int *siglen, DSA *dsa);
-int    DSA_verify(int type,unsigned char *dgst,int dgst_len,
+int    DSA_verify(int type,const unsigned char *dgst,int dgst_len,
                unsigned char *sigbuf, int siglen, DSA *dsa);
 void   DSA_free (DSA *r);
 
@@ -138,55 +162,32 @@ int       DSA_print_fp(FILE *bp, DSA *x, int off);
 
 int DSA_is_prime(BIGNUM *q,void (*callback)(),char *cb_arg);
 
-#else
-
-DSA *  DSA_new();
-int    DSA_size();
-int    DSA_sign_setup();
-int    DSA_sign();
-int    DSA_verify();
-void   DSA_free ();
-
-void   ERR_load_DSA_strings();
-
-DSA *  d2i_DSAPublicKey();
-DSA *  d2i_DSAPrivateKey();
-DSA *  d2i_DSAparams();
-DSA *  DSA_generate_parameters();
-int    DSA_generate_key();
-int    i2d_DSAPublicKey();
-int    i2d_DSAPrivateKey();
-int    i2d_DSAparams();
-
-int    DSA_is_prime();
-
-int    DSAparams_print();
-int    DSA_print();
-
-#ifndef NO_FP_API
-int    DSAparams_print_fp();
-int    DSA_print_fp();
-#endif
-
-#endif
-
 /* BEGIN ERROR CODES */
+/* The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+
 /* Error codes for the DSA functions. */
 
 /* Function codes. */
+#define DSA_F_D2I_DSA_SIG                               110
 #define DSA_F_DSAPARAMS_PRINT                           100
 #define DSA_F_DSAPARAMS_PRINT_FP                        101
+#define DSA_F_DSA_DO_SIGN                               112
+#define DSA_F_DSA_DO_VERIFY                             113
 #define DSA_F_DSA_IS_PRIME                              102
 #define DSA_F_DSA_NEW                                   103
 #define DSA_F_DSA_PRINT                                         104
 #define DSA_F_DSA_PRINT_FP                              105
 #define DSA_F_DSA_SIGN                                  106
 #define DSA_F_DSA_SIGN_SETUP                            107
+#define DSA_F_DSA_SIG_NEW                               109
 #define DSA_F_DSA_VERIFY                                108
+#define DSA_F_I2D_DSA_SIG                               111
 
 /* Reason codes. */
 #define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE               100
+
 #ifdef  __cplusplus
 }
 #endif