[Pkg-privacy-maintainers] Bug#828533: ricochet-im: FTBFS with openssl 1.1.0
Sascha Steinbiss
satta at debian.org
Wed Aug 10 15:53:27 UTC 2016
Control: tag -1 + patch
Hi,
> OpenSSL 1.1.0 is about to released. During a rebuild of all packages using
> OpenSSL this package fail to build. A log of that build can be found at:
> https://breakpoint.cc/openssl-1.1-rebuild-2016-05-29/Attempted/ricochet-im_1.1.2-1_amd64-20160529-1532
I have come up with a patch working around the API changes, now allowing
to build with both the old and the new OpenSSL. However, I would like to
check it with upstream first. See
https://github.com/ricochet-im/ricochet/pull/444.
Cheers
Sascha
--
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.
-------------- next part --------------
Description: add support for OpenSSL 1.1
OpenSSL 1.1 introduces some API changes that make various structures
opaque, requiring accessors to get and set fields inside. This patch
uses the appropriate accessors if necessary to allow building with
OpenSSL versions 1.1 _and_ lower.
Author: Sascha Steinbiss <satta at debian.org>
Forwarded: https://github.com/ricochet-im/ricochet/pull/444
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -78,7 +78,11 @@
initTranslation();
/* Initialize OpenSSL's allocator */
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
CRYPTO_malloc_init();
+#else
+ OPENSSL_malloc_init();
+#endif
/* Seed the OpenSSL RNG */
if (!SecureRNG::seed())
--- a/src/utils/CryptoKey.cpp
+++ b/src/utils/CryptoKey.cpp
@@ -35,9 +35,19 @@
#include "Useful.h"
#include <QtDebug>
#include <QFile>
+#include <openssl/bn.h>
#include <openssl/bio.h>
#include <openssl/pem.h>
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q)
+{
+ *p = r->p;
+ *q = r->q;
+}
+#define RSA_bits(o) (BN_num_bits((o)->n))
+#endif
+
void base32_encode(char *dest, unsigned destlen, const char *src, unsigned srclen);
bool base32_decode(char *dest, unsigned destlen, const char *src, unsigned srclen);
@@ -120,12 +130,14 @@
bool CryptoKey::isPrivate() const
{
- return isLoaded() && d->key->p != 0;
+ const BIGNUM *p, *q;
+ RSA_get0_factors(d->key, &p, &q);
+ return isLoaded() && (p != 0);
}
int CryptoKey::bits() const
{
- return isLoaded() ? BN_num_bits(d->key->n) : 0;
+ return isLoaded() ? RSA_bits(d->key) : 0;
}
QByteArray CryptoKey::publicKeyDigest() const
More information about the Pkg-privacy-maintainers
mailing list