pidgin/pidgin

887efbd652d8
certificate: Use public key fingerprint to compare certificates

This fixes an issue with google talk's certificates and gnutls, where the root
certificate in the provided chain is a slightly different version of the one
that is usually present in the certificate stores, but the SubjectPublicKeyInfo
section is the same.

This adds a PurpleCertificateScheme function, compare_pubkeys, and its wrapper
purple_certificate_compare_pubkeys().

This is only implemented for gnutls, since the NSS plugin only uses the NSS
certificate validation code. Even if that path was reachable from a plugin that
doesn't implement this method, it would return FALSE and behave as if this bug
was never fixed.

The gnutls implementation uses the gnutls_x509_crt_get_key_id() function,
which returns a hash of the SubjectPublicKeyInfo section of the certificate.

In gnutls versions older than 3.4.1, this may be a SHA1 hash, but after that
version SHA256 support was added (without much fanfare - the documentation
barely mentions this at all), and we just use the constant for the best known
algo, which for current versions is just SHA256. Older versions ignore that
flag parameter.

The whole comparison is modeled after the private _gnutls_check_if_same_key(),
which checks if both certificates have the same DN ("unique id") and does a
memcmp() of the raw SPKI section. We don't have direct access to the raw SPKI
section but comparing their fingerprints is good enough.
syntax: glob
.DS_Store
syntax: regexp
(.*/)?TAGS$
(.*/)?\.svn
.*.swp
.*/?.*\.pc$
.*/?Makefile(\.in)?$
.*/?Makefile\.am\.mingw$
.*/perl/common/[^/]+\.c$
.*/perl/common/blib.*
.*/perl/common/pm_to_blib$
.*/perl/common/MYMETA\.(json|yml)
.*~$
.*\.a$
.*\.asc$
.*\.bak$
.*\.bs$
.*\.def$
\.deps
.*\.dll$
.*\.exe$
.*\.g?mo$
.*\.la$
\.libs
.*\.lo$
.*\.loT$
.*\.o$
.*\.orig$
.*\.pyc$
.*\.pyo$
.*\.rej$
.*\.so$
Doxyfile(\.mingw)?$
VERSION$
aclocal.m4
autogen.args
autom4te.*\.cache
compile
config.cache
config.guess
config.h$
config.h.in
config.log
config.status
config.sub
configure$
depcomp
doc/finch.1$
doc/html
doc/pidgin.1$
finch/finch$
finch/libgnt/gntmarshal.c
finch/libgnt/gntmarshal.h
install-sh
intltool-.*
libpurple/dbus-bindings.c
libpurple/dbus-signals.c
libpurple/dbus-types.c
libpurple/dbus-types.h
libpurple/example/nullclient
libpurple/data/gconf/purple.schemas$
libpurple/marshallers.[ch]
libpurple/plugins/dbus-example-bindings.c
libpurple/plugins/perl/common/Makefile.PL$
libpurple/plugins/perl/common/Makefile.old
libpurple/plugins/perl/common/const-c.inc
libpurple/plugins/perl/common/const-xs.inc
libpurple/plugins/perl/common/lib
libpurple/purple-client-bindings.c
libpurple/purple-client-bindings.h
libpurple/purple-client-example
libpurple/purple.h$
libpurple/tests/check_libpurple
libpurple/tests/libpurple..
libpurple/version.h$
libpurple/win32/libpurplerc.rc$
libtool
local.mak
ltmain.sh
missing
mkinstalldirs
package_revision.h
package_revision_raw.txt
pidgin-*.*.*-dbgsym$
pidgin-*.*.*-dbgsym.zip$
pidgin-*.*.*-win32-bin.zip$
pidgin-*.*.*-win32bin$
pidgin-.*.tar.bz2
pidgin-.*.tar.gz
pidgin-[0-9a-z.-]+/
pidgin.apspec$
pidgin.spec$
pidgin/pidgin$
pidgin/data/pidgin.appdata.xml$
pidgin/data/pidgin.desktop$
pidgin/data/pidgin.desktop.in$
pidgin/pixmaps/emotes/default/24/theme
pidgin/pixmaps/emotes/none/theme
pidgin/pixmaps/emotes/small/16/theme
pidgin/plugins/musicmessaging/music-messaging-bindings.c
pidgin/plugins/perl/common/Makefile.PL$
pidgin/plugins/perl/common/Makefile.old
pidgin/win32/nsis/gtk-runtime-*.*.*.*.zip
pidgin/win32/nsis/gtk_runtime_stage$
pidgin/win32/nsis/langmacros.nsh
pidgin/win32/nsis/nsis_translations.desktop
pidgin/win32/nsis/pidgin-spellcheck-preselect.nsh
pidgin/win32/nsis/pidgin-spellcheck.nsh
pidgin/win32/nsis/pidgin-translations.nsh$
pidgin/win32/nsis/translations
pidgin/win32/pidgin_dll_rc.rc$
pidgin/win32/pidgin_exe_rc.rc$
po/Makefile.in.in
po/POTFILES$
po/missing
po/notexist
po/pidgin.pot
po/stamp-it
stamp-h1
test-driver
win32-install-dir(\.release)?
share/ca-certs/cacert.pem
share/ca-certs/certdata.txt