Workaround for some CMS signature formats.
[openssl.git] / fips / dsa / fips_dsa_lib.c
index 2545966d2a381005bee342da4afce354297ea457..2e2f192aff3be0b0517b3f8e5c89bf129d1abc65 100644 (file)
  *
  */
 
+#define OPENSSL_FIPSAPI
+
 #include <string.h>
 #include <openssl/dsa.h>
 #include <openssl/bn.h>
+#include <openssl/fips.h>
 
 /* Minimal FIPS versions of FIPS_dsa_new() and FIPS_dsa_free: to
  * reduce external dependencies. 
@@ -93,3 +96,26 @@ void FIPS_dsa_free(DSA *r)
        OPENSSL_free(r);
        }
 
+DSA_SIG *FIPS_dsa_sig_new(void)
+       {
+       DSA_SIG *sig;
+       sig = OPENSSL_malloc(sizeof(DSA_SIG));
+       if (!sig)
+               return NULL;
+       sig->r = NULL;
+       sig->s = NULL;
+       return sig;
+       }
+
+void FIPS_dsa_sig_free(DSA_SIG *sig)
+       {
+       if (sig)
+               {
+               if (sig->r)
+                       BN_free(sig->r);
+               if (sig->s)
+                       BN_free(sig->s);
+               OPENSSL_free(sig);
+               }
+       }
+