-/* $OpenBSD: ca.c,v 1.88 2022/07/08 19:51:11 tobhe Exp $ */
+/* $OpenBSD: ca.c,v 1.89 2022/11/07 22:39:52 tobhe Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
if (subj_name == NULL)
return (-1);
log_debug("%s: found CA %s", __func__, subj_name);
- free(subj_name);
+ OPENSSL_free(subj_name);
chain_len = ca_chain_by_issuer(store, subj, &id,
chain, nitems(chain));
return (-1);
log_debug("%s: found local certificate %s", __func__,
subj_name);
- free(subj_name);
+ OPENSSL_free(subj_name);
if ((buf = ca_x509_serialize(cert)) == NULL)
return (-1);
if (subj_name == NULL)
return (-1);
log_debug("%s: %s", __func__, subj_name);
- free(subj_name);
+ OPENSSL_free(subj_name);
if (ibuf_add(env->sc_certreq, md, len) != 0) {
ibuf_release(env->sc_certreq);
if (buflen == 0)
return (-1);
if (!EVP_Digest(buf, buflen, md, size, EVP_sha1(), NULL)) {
- free(buf);
+ OPENSSL_free(buf);
return (-1);
}
- free(buf);
+ OPENSSL_free(buf);
return (0);
}
(name = X509_NAME_oneline(subject, NULL, 0)) == NULL)
continue;
buflen = asprintf(&buf, "%s: %s\n", msg, name);
- free(name);
+ OPENSSL_free(name);
if (buflen == -1)
continue;
proc_compose(&env->sc_ps, PROC_CONTROL, IMSG_CTL_SHOW_CERTSTORE,
return (method);
}
+/*
+ * Return dynamically allocated buffer containing certificate name.
+ * The resulting buffer must be freed with OpenSSL_free().
+ */
char *
ca_asn1_name(uint8_t *asn1, size_t len)
{
if (subj_name == NULL)
goto err;
log_debug("%s: %s %.100s", __func__, subj_name, errstr);
- free(subj_name);
+ OPENSSL_free(subj_name);
}
err:
-/* $OpenBSD: crypto.c,v 1.39 2021/12/13 17:35:34 tobhe Exp $ */
+/* $OpenBSD: crypto.c,v 1.40 2022/11/07 22:39:52 tobhe Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
if (_dsa_verify_prepare(dsa, &ptr, &len, &freeme) < 0)
return (-1);
if (EVP_DigestVerifyFinal(dsa->dsa_ctx, ptr, len) != 1) {
- free(freeme);
+ OPENSSL_free(freeme);
ca_sslerror(__func__);
return (-1);
}
- free(freeme);
+ OPENSSL_free(freeme);
}
return (0);
-/* $OpenBSD: ikev2.c,v 1.356 2022/11/06 11:11:47 tobhe Exp $ */
+/* $OpenBSD: ikev2.c,v 1.357 2022/11/07 22:39:52 tobhe Exp $ */
/*
* Copyright (c) 2019 Tobias Heider <tobias.heider@stusta.de>
if ((str = ca_asn1_name(ptr, len)) == NULL)
return (-1);
if (strlcpy(idstr, str, idstrlen) >= idstrlen) {
- free(str);
+ OPENSSL_free(str);
return (-1);
}
- free(str);
+ OPENSSL_free(str);
break;
default:
/* XXX test */