summaryrefslogtreecommitdiff
path: root/src/certificate.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-11-10 09:53:52 +0000
committerCarl Hetherington <cth@carlh.net>2016-11-10 11:22:37 +0000
commitf3f25108a1ea5ef90e6fc172dca56cf55befe772 (patch)
tree17d46abe41b323bcf50504a950b6affecbc319e8 /src/certificate.cc
parent4c2fb8ea9d3c02ea5243122201eb8282daac5adb (diff)
Fix build with OpenSSL 1.1 and later.
Diffstat (limited to 'src/certificate.cc')
-rw-r--r--src/certificate.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/certificate.cc b/src/certificate.cc
index fbe3a80d..64fb3626 100644
--- a/src/certificate.cc
+++ b/src/certificate.cc
@@ -355,6 +355,7 @@ Certificate::serial () const
return st;
}
+/** @return thumbprint of the to-be-signed portion of this certificate */
string
Certificate::thumbprint () const
{
@@ -362,7 +363,13 @@ Certificate::thumbprint () const
uint8_t buffer[8192];
uint8_t* p = buffer;
+
+#if OPENSSL_VERSION_NUMBER > 0x10100000L
+#warning "Using new OpenSSL API"
+ i2d_re_X509_tbs(_certificate, &p);
+#else
i2d_X509_CINF (_certificate->cert_info, &p);
+#endif
unsigned int const length = p - buffer;
if (length > sizeof (buffer)) {
throw MiscError ("buffer too small to generate thumbprint");