Fix encoding bug in i2c_ASN1_INTEGER
[openssl.git] / crypto / asn1 / asn_mime.c
index 97e5b34579a70e5ea5bead59aebdc2b771730247..e810345579e23ada85308e34b8e223c181694bb6 100644 (file)
@@ -78,7 +78,6 @@ typedef struct {
 } MIME_PARAM;
 
 DECLARE_STACK_OF(MIME_PARAM)
-IMPLEMENT_STACK_OF(MIME_PARAM)
 
 typedef struct {
     char *name;                 /* Name of line e.g. "content-type" */
@@ -87,7 +86,6 @@ typedef struct {
 } MIME_HEADER;
 
 DECLARE_STACK_OF(MIME_HEADER)
-IMPLEMENT_STACK_OF(MIME_HEADER)
 
 static int asn1_output_data(BIO *out, BIO *data, ASN1_VALUE *val, int flags,
                             const ASN1_ITEM *it);
@@ -288,7 +286,8 @@ int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
     if ((flags & SMIME_DETACHED) && data) {
         /* We want multipart/signed */
         /* Generate a random boundary */
-        RAND_pseudo_bytes((unsigned char *)bound, 32);
+        if (RAND_bytes((unsigned char *)bound, 32) <= 0)
+            return 0;
         for (i = 0; i < 32; i++) {
             c = bound[i] & 0xf;
             if (c < 10)
@@ -651,8 +650,7 @@ static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret)
                 BIO_write(bpart, linebuf, len);
         }
     }
-    if (bpart != NULL)
-        BIO_free(bpart);
+    BIO_free(bpart);
     return 0;
 }