X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/e3d460c9de4426da6c630c3ae3f46173a99f82d8..07691282a056c4efea71e1e505527601e8cc166b:/OSX/libsecurity_smime/lib/cmsattr.c diff --git a/OSX/libsecurity_smime/lib/cmsattr.c b/OSX/libsecurity_smime/lib/cmsattr.c index 39c72172..8497904b 100644 --- a/OSX/libsecurity_smime/lib/cmsattr.c +++ b/OSX/libsecurity_smime/lib/cmsattr.c @@ -111,19 +111,23 @@ loser: OSStatus SecCmsAttributeAddValue(PLArenaPool *poolp, SecCmsAttribute *attr, CSSM_DATA_PTR value) { - CSSM_DATA copiedvalue; + CSSM_DATA_PTR copiedvalue; void *mark; PORT_Assert (poolp != NULL); mark = PORT_ArenaMark(poolp); - /* XXX we need an object memory model #$%#$%! */ - if (SECITEM_CopyItem(poolp, &copiedvalue, value) != SECSuccess) - goto loser; + if (value != NULL) { + if ((copiedvalue = SECITEM_AllocItem(poolp, NULL, value->Length)) == NULL) + goto loser; - if (SecCmsArrayAdd(poolp, (void ***)&(attr->values), (void *)&copiedvalue) != SECSuccess) - goto loser; + if (SECITEM_CopyItem(poolp, copiedvalue, value) != SECSuccess) + goto loser; + + if (SecCmsArrayAdd(poolp, (void ***)&(attr->values), (void *)copiedvalue) != SECSuccess) + goto loser; + } PORT_ArenaUnmark(poolp, mark); return SECSuccess; @@ -234,6 +238,7 @@ cms_attr_choose_attr_value_template(void *src_or_dest, Boolean encoding, const c switch (oiddata->offset) { case SEC_OID_PKCS9_SMIME_CAPABILITIES: case SEC_OID_SMIME_ENCRYPTION_KEY_PREFERENCE: + case SEC_OID_APPLE_HASH_AGILITY_V2: /* these guys need to stay DER-encoded */ default: /* same goes for OIDs that are not handled here */ @@ -257,6 +262,7 @@ cms_attr_choose_attr_value_template(void *src_or_dest, Boolean encoding, const c theTemplate = SEC_ASN1_GET(kSecAsn1OctetStringTemplate); break; case SEC_OID_PKCS9_SIGNING_TIME: + case SEC_OID_APPLE_EXPIRATION_TIME: encoded = PR_FALSE; theTemplate = SEC_ASN1_GET(kSecAsn1UTCTimeTemplate); // @@@ This should be a choice between UTCTime and GeneralizedTime -- mb break;