Beginnings of EVP cipher overhaul. This should eventually
[openssl.git] / crypto / pkcs7 / example.c
index 73548900841a96ccfe5ca8b76d7837555511a7fe..f6656be28e19b30de5bc0039cb0959003d216c73 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <openssl/pkcs7.h>
 #include <openssl/asn1_mac.h>
 
@@ -36,7 +37,7 @@ void add_signed_string(PKCS7_SIGNER_INFO *si, char *str)
                signed_string_nid=
                        OBJ_create("1.2.3.4.5","OID_example","Our example OID");
        os=ASN1_OCTET_STRING_new();
-       ASN1_OCTET_STRING_set(os,str,strlen(str));
+       ASN1_OCTET_STRING_set(os,(unsigned char*)str,strlen(str));
        /* When we add, we do not free */
        PKCS7_add_signed_attribute(si,signed_string_nid,
                V_ASN1_OCTET_STRING,(char *)os);
@@ -68,7 +69,7 @@ int get_signed_string(PKCS7_SIGNER_INFO *si, char *buf, int len)
        return(0);
        }
 
-static signed_seq2string_nid= -1;
+static int signed_seq2string_nid= -1;
 /* ########################################### */
 int add_signed_seq2string(PKCS7_SIGNER_INFO *si, char *str1, char *str2)
        {
@@ -86,8 +87,8 @@ int add_signed_seq2string(PKCS7_SIGNER_INFO *si, char *str1, char *str2)
 
        os1=ASN1_OCTET_STRING_new();
        os2=ASN1_OCTET_STRING_new();
-       ASN1_OCTET_STRING_set(os1,str1,strlen(str1));
-       ASN1_OCTET_STRING_set(os2,str1,strlen(str1));
+       ASN1_OCTET_STRING_set(os1,(unsigned char*)str1,strlen(str1));
+       ASN1_OCTET_STRING_set(os2,(unsigned char*)str1,strlen(str1));
        i =i2d_ASN1_OCTET_STRING(os1,NULL);
        i+=i2d_ASN1_OCTET_STRING(os2,NULL);
        total=ASN1_object_size(1,i,V_ASN1_SEQUENCE);
@@ -197,7 +198,7 @@ X509_ATTRIBUTE *create_string(char *str)
                signed_string_nid=
                        OBJ_create("1.2.3.4.5","OID_example","Our example OID");
        os=ASN1_OCTET_STRING_new();
-       ASN1_OCTET_STRING_set(os,str,strlen(str));
+       ASN1_OCTET_STRING_set(os,(unsigned char*)str,strlen(str));
        /* When we add, we do not free */
        ret=X509_ATTRIBUTE_create(signed_string_nid,
                V_ASN1_OCTET_STRING,(char *)os);
@@ -250,8 +251,8 @@ X509_ATTRIBUTE *add_seq2string(PKCS7_SIGNER_INFO *si, char *str1, char *str2)
 
        os1=ASN1_OCTET_STRING_new();
        os2=ASN1_OCTET_STRING_new();
-       ASN1_OCTET_STRING_set(os1,str1,strlen(str1));
-       ASN1_OCTET_STRING_set(os2,str1,strlen(str1));
+       ASN1_OCTET_STRING_set(os1,(unsigned char*)str1,strlen(str1));
+       ASN1_OCTET_STRING_set(os2,(unsigned char*)str1,strlen(str1));
        i =i2d_ASN1_OCTET_STRING(os1,NULL);
        i+=i2d_ASN1_OCTET_STRING(os2,NULL);
        total=ASN1_object_size(1,i,V_ASN1_SEQUENCE);