Hi! >>>>> On Fri, 16 Nov 2018 20:32:28 +0200, Yauheni Kaliuta wrote: [...] Yeah, cleanup on error for the values allocated below. But the main question is in general if the way of linking is possible. > + > + > + sno_bn = ASN1_INTEGER_to_BN(sno, NULL); > + if (sno_bn == NULL) > + goto err; > + > + len = BN_num_bytes(sno_bn); > + key_id_str = malloc(len); > + BN_bn2bin(sno_bn, key_id_str); > + > + sig_info->key_id = (const char *)key_id_str; > + sig_info->key_id_len = len; > + > + issuer_str = x509_name_to_str(issuer); > + if (issuer_str != NULL) { > + sig_info->signer = issuer_str; > + sig_info->signer_len = strlen(issuer_str); > + } > + > + sig_info->algo = NULL; > + > + X509_ALGOR_get0(&o, NULL, NULL, dig_alg); > + > + sig_info->hash_algo = pkey_hash_algo[obj_to_hash_algo(o)]; > + sig_info->id_type = pkey_id_type[modsig->id_type]; > + > + pvt = malloc(sizeof(*pvt)); > + if (pvt == NULL) > + goto err; > + > + pvt->cms = cms; > + pvt->key_id = key_id_str; > + pvt->sno = sno_bn; > + sig_info->private = pvt; > + > + sig_info->free = pkcs7_free; > + > + return true; > + > +err: > + CMS_ContentInfo_free(cms); > + return false; > +} > + -- WBR, Yauheni Kaliuta