]> git.ipfire.org Git - thirdparty/openssl.git/blobdiff - crypto/dsa/dsa.h
Separate DSA functionality from ASN.1 encoding.
[thirdparty/openssl.git] / crypto / dsa / dsa.h
index 1ca87c1cbea1bef92b75fad3c9ace09b79bc4515..d531efbb04ed7c0b5303b22baf1b1934de982e0e 100644 (file)
@@ -71,6 +71,8 @@ extern "C" {
 
 #include "bn.h"
 
+#define DSA_FLAG_CACHE_MONT_P  0x01
+
 typedef struct dsa_st
        {
        /* This first variable is used to pick up errors where
@@ -88,9 +90,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, \
@@ -104,6 +116,15 @@ typedef struct dsa_st
 
 #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(unsigned char *dgst,int dlen,DSA *dsa);
+int    DSA_do_verify(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 */
@@ -140,6 +161,14 @@ int DSA_is_prime(BIGNUM *q,void (*callback)(),char *cb_arg);
 
 #else
 
+DSA_SIG * DSA_SIG_new();
+void   DSA_SIG_free();
+int    i2d_DSA_SIG();
+DSA_SIG * d2i_DSA_SIG();
+
+DSA_SIG * DSA_do_sign();
+int    DSA_do_verify();
+
 DSA *  DSA_new();
 int    DSA_size();
 int    DSA_sign_setup();
@@ -183,6 +212,11 @@ int        DSA_print_fp();
 #define DSA_F_DSA_SIGN                                  106
 #define DSA_F_DSA_SIGN_SETUP                            107
 #define DSA_F_DSA_VERIFY                                108
+#define DSA_F_DSA_SIG_NEW                               109
+#define DSA_F_D2I_DSA_SIG                               110
+#define DSA_F_I2D_DSA_SIG                               111
+#define DSA_F_DSA_DO_SIGN                               112
+#define DSA_F_DSA_DO_VERIFY                             113
 
 /* Reason codes. */
 #define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE               100