mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-18 12:39:28 +00:00
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.
40 lines
1.3 KiB
C
40 lines
1.3 KiB
C
/* Provenance: openssl/openssl X509_issuer_and_serial_hash (vuln).
|
|
* repo: openssl/openssl
|
|
* commit: c8c6e7438c03b2fc24e7ead460feeaef04911fb4
|
|
* parent: c8c6e7438c03b2fc24e7ead460feeaef04911fb4
|
|
* commit_url: https://github.com/openssl/openssl/commit/122a19ab48091c657f7cb1fb3af9fc07bd557bbf
|
|
* cve: CVE-2021-23841
|
|
* license: OpenSSL License
|
|
* function: X509_issuer_and_serial_hash
|
|
* relpath: crypto/x509/x509_cmp.c
|
|
*/
|
|
|
|
unsigned long X509_issuer_and_serial_hash(X509 *a)
|
|
{
|
|
unsigned long ret = 0;
|
|
EVP_MD_CTX *ctx = EVP_MD_CTX_new();
|
|
unsigned char md[16];
|
|
char *f;
|
|
|
|
if (ctx == NULL)
|
|
goto err;
|
|
f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0);
|
|
if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL))
|
|
goto err;
|
|
if (!EVP_DigestUpdate(ctx, (unsigned char *)f, strlen(f)))
|
|
goto err;
|
|
OPENSSL_free(f);
|
|
if (!EVP_DigestUpdate
|
|
(ctx, (unsigned char *)a->cert_info.serialNumber.data,
|
|
(unsigned long)a->cert_info.serialNumber.length))
|
|
goto err;
|
|
if (!EVP_DigestFinal_ex(ctx, &(md[0]), NULL))
|
|
goto err;
|
|
ret = (((unsigned long)md[0]) | ((unsigned long)md[1] << 8L) |
|
|
((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L)
|
|
) & 0xffffffffL;
|
|
err:
|
|
EVP_MD_CTX_free(ctx);
|
|
return ret;
|
|
}
|