mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-20 01:36:22 +00:00
Prepare to use SHA256 fingerprints of certs.
First let's make clear we're currently using SHA1 & untangle the tlscerts API from fingerprint specific details. Related-to: https://github.com/profanity-im/profanity/issues/2068 Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
@@ -1157,14 +1157,13 @@ int
|
||||
sv_ev_certfail(const char* const errormsg, const TLSCertificate* cert)
|
||||
{
|
||||
// check profanity trusted certs
|
||||
if (tlscerts_exists(cert->fingerprint)) {
|
||||
if (tlscerts_exists(cert)) {
|
||||
cafile_add(cert);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// check current cert
|
||||
char* current_fp = tlscerts_get_current();
|
||||
if (current_fp && g_strcmp0(current_fp, cert->fingerprint) == 0) {
|
||||
if (tlscerts_current_fingerprint_equals(cert)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1195,11 +1194,11 @@ sv_ev_certfail(const char* const errormsg, const TLSCertificate* cert)
|
||||
|
||||
if (g_strcmp0(cmd, "/tls allow") == 0) {
|
||||
cons_show("Continuing with connection.");
|
||||
tlscerts_set_current(cert->fingerprint);
|
||||
tlscerts_set_current(cert);
|
||||
return 1;
|
||||
} else if (g_strcmp0(cmd, "/tls always") == 0) {
|
||||
cons_show("Adding %s to trusted certificates.", cert->fingerprint);
|
||||
if (!tlscerts_exists(cert->fingerprint)) {
|
||||
cons_show("Adding %s to trusted certificates.", cert->fingerprint_sha1);
|
||||
if (!tlscerts_exists(cert)) {
|
||||
tlscerts_add(cert);
|
||||
cafile_add(cert);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user