Initial support for Certificate Policies extension: print out works but setting
[oweals/openssl.git] / crypto / asn1 / a_sign.c
index 02188e68c48526c64302351e745a453dd8161fe3..d3ae78b7b451d5f7bda758c5fec53bc09dd163b6 100644 (file)
@@ -67,7 +67,6 @@
 #include "x509.h"
 #include "objects.h"
 #include "buffer.h"
-#include "pem.h"
 
 int ASN1_sign(i2d,algor1,algor2,signature,data,pkey,type)
 int (*i2d)();
@@ -76,7 +75,7 @@ X509_ALGOR *algor2;
 ASN1_BIT_STRING *signature;
 char *data;
 EVP_PKEY *pkey;
-EVP_MD *type;
+const EVP_MD *type;
        {
        EVP_MD_CTX ctx;
        unsigned char *p,*buf_in=NULL,*buf_out=NULL;
@@ -136,7 +135,11 @@ EVP_MD *type;
        signature->data=buf_out;
        buf_out=NULL;
        signature->length=outl;
-
+       /* In the interests of compatability, I'll make sure that
+        * the bit string has a 'not-used bits' value of 0
+        */
+       signature->flags&= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07);
+       signature->flags|=ASN1_STRING_FLAG_BITS_LEFT;
 err:
        memset(&ctx,0,sizeof(ctx));
        if (buf_in != NULL)