- /* Note: when forming the encoding of the attributes we
- * shouldn't reorder them or this will break the signature.
- * This is done by using the IS_SEQUENCE flag.
- */
- i=i2d_ASN1_SET_OF_X509_ATTRIBUTE(sk,NULL,i2d_X509_ATTRIBUTE,
- V_ASN1_SET,V_ASN1_UNIVERSAL, IS_SEQUENCE);
- pp=OPENSSL_malloc(i);
- p=pp;
- i2d_ASN1_SET_OF_X509_ATTRIBUTE(sk,&p,i2d_X509_ATTRIBUTE,
- V_ASN1_SET,V_ASN1_UNIVERSAL, IS_SEQUENCE);
- EVP_VerifyUpdate(&mdc_tmp,pp,i);
-
- OPENSSL_free(pp);
+
+ alen = ASN1_item_i2d((ASN1_VALUE *)sk, &abuf,
+ &PKCS7_ATTR_VERIFY_it);
+ EVP_VerifyUpdate(&mdc_tmp, abuf, alen);
+
+ OPENSSL_free(abuf);