Files
Open_Ultra_SAST/benchmarks/pairs/vfc/openssl-cve-2026-42768-pkcs7_decrypt_rinfo/fixed.c
T
Marius Ciepluch 0116f9bea6 feat(real-world-vfc-slice): add labeled OpenSSL/Firefox/Chromium/curl pair corpus
Harvest 176 isolated vuln-vs-fix functions (109 CVEs, 352 training rows)
into benchmarks/pairs/vfc with provenance and a JSONL training manifest.
Score the slice as an honesty dashboard (ousast pairs --slice vfc);
keep the pair gate on the local fixtures only.
2026-09-04 16:45:38 +02:00

48 lines
1.2 KiB
C

/* Provenance: openssl/openssl pkcs7_decrypt_rinfo (fixed).
* repo: openssl/openssl
* commit: d5030cdf32d6cd27bd964a0cb7aed2b7cb713369
* parent: f04d65692dd8109be9f387ce2ddd9fb1ab612b6b
* commit_url: https://github.com/openssl/openssl/commit/d5030cdf32d6cd27bd964a0cb7aed2b7cb713369
* cve: CVE-2026-42768
* license: Apache-2.0
* function: pkcs7_decrypt_rinfo
* relpath: crypto/pkcs7/pk7_doit.c
*/
static int pkcs7_decrypt_rinfo(unsigned char **pek, int *peklen,
PKCS7_RECIP_INFO *ri, EVP_PKEY *pkey,
size_t fixlen)
{
EVP_PKEY_CTX *pctx = NULL;
unsigned char *ek = NULL;
size_t eklen;
int ret = -1;
const PKCS7_CTX *ctx = ri->ctx;
pctx = EVP_PKEY_CTX_new_from_pkey(ossl_pkcs7_ctx_get0_libctx(ctx), pkey,
ossl_pkcs7_ctx_get0_propq(ctx));
if (pctx == NULL)
return -1;
if (EVP_PKEY_decrypt_init(pctx) <= 0)
goto err;
ret = evp_pkey_decrypt_alloc(pctx, &ek, &eklen, fixlen,
ASN1_STRING_get0_data(ri->enc_key), ASN1_STRING_length(ri->enc_key));
if (ret <= 0)
goto err;
ret = 1;
OPENSSL_clear_free(*pek, *peklen);
*pek = ek;
*peklen = (int)eklen;
err:
EVP_PKEY_CTX_free(pctx);
if (!ret)
OPENSSL_free(ek);
return ret;
}