Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openssl 1.1 support #51

Open
ignatenkobrain opened this issue Jan 22, 2017 · 2 comments
Open

openssl 1.1 support #51

ignatenkobrain opened this issue Jan 22, 2017 · 2 comments

Comments

@ignatenkobrain
Copy link

Unfortunately, build fails with openssl 1.1: https://bugzilla.redhat.com/show_bug.cgi?id=1383755

../util/utils.cpp: In static member function 'static qint64 Utils::computeRSAFingerprint(RSA*)':
../util/utils.cpp:283:17: error: invalid use of incomplete type 'RSA {aka struct rsa_st}'
     Q_ASSERT(key->n && key->e);
                 ^
/usr/include/qt5/QtCore/qglobal.h:720:54: note: in definition of macro 'Q_ASSERT'
 #    define Q_ASSERT(cond) do { } while ((false) && (cond))
                                                      ^~~~
In file included from /usr/include/openssl/bn.h:32:0,
                 from ../util/utils.h:36,
                 from ../util/utils.cpp:22:
/usr/include/openssl/ossl_typ.h:110:16: note: forward declaration of 'RSA {aka struct rsa_st}'
 typedef struct rsa_st RSA;
                ^~~~~~
In file included from /usr/include/qt5/QtCore/qnamespace.h:43:0,
                 from /usr/include/qt5/QtCore/qobjectdefs.h:48,
                 from /usr/include/qt5/QtCore/qobject.h:46,
                 from /usr/include/qt5/QtCore/QObject:1,
                 from ../util/utils.h:35,
                 from ../util/utils.cpp:22:
../util/utils.cpp:283:27: error: invalid use of incomplete type 'RSA {aka struct rsa_st}'
     Q_ASSERT(key->n && key->e);
                           ^
/usr/include/qt5/QtCore/qglobal.h:720:54: note: in definition of macro 'Q_ASSERT'
 #    define Q_ASSERT(cond) do { } while ((false) && (cond))
                                                      ^~~~
In file included from /usr/include/openssl/bn.h:32:0,
                 from ../util/utils.h:36,
                 from ../util/utils.cpp:22:
/usr/include/openssl/ossl_typ.h:110:16: note: forward declaration of 'RSA {aka struct rsa_st}'
 typedef struct rsa_st RSA;
                ^~~~~~
../util/utils.cpp:284:37: error: invalid use of incomplete type 'RSA {aka struct rsa_st}'
     qint32 l1 = serializeBignum (key->n, tempbuff, 4096);
                                     ^~
In file included from /usr/include/openssl/bn.h:32:0,
                 from ../util/utils.h:36,
                 from ../util/utils.cpp:22:
/usr/include/openssl/ossl_typ.h:110:16: note: forward declaration of 'RSA {aka struct rsa_st}'
 typedef struct rsa_st RSA;
                ^~~~~~
../util/utils.cpp:286:37: error: invalid use of incomplete type 'RSA {aka struct rsa_st}'
     qint32 l2 = serializeBignum (key->e, tempbuff + l1, 4096 - l1);
                                     ^~
In file included from /usr/include/openssl/bn.h:32:0,
                 from ../util/utils.h:36,
                 from ../util/utils.cpp:22:
/usr/include/openssl/ossl_typ.h:110:16: note: forward declaration of 'RSA {aka struct rsa_st}'
 typedef struct rsa_st RSA;
                ^~~~~~
g++ -c -pipe -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic -fno-delete-null-pointer-checks -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DLIBQTELEGRAM_LIBRARY -DQT_NO_DEBUG -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../../libqtelegram-aseman-edition-10.0.0-stable -I. -I/usr/include -I/usr/local/include -I/usr/include/qt5 -I/usr/include/qt5/QtMultimedia -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtNetwork -I/usr/include/qt5/QtCore -I. -I/usr/lib64/qt5/mkspecs/linux-g++ -o cryptoutils.o ../util/cryptoutils.cpp
make: *** [Makefile:8081: utils.o] Error 1
make: *** Waiting for unfinished jobs....
../util/cryptoutils.cpp: In member function 'qint32 CryptoUtils::encryptPacketBuffer(OutboundPkt&, void*)':
../util/cryptoutils.cpp:43:118: error: invalid use of incomplete type 'RSA {aka struct rsa_st}'
     return padRsaEncrypt((char *) p.buffer(), p.length() * 4, (char *) encryptBuffer, ENCRYPT_BUFFER_INTS * 4, pubKey->n, pubKey->e);
                                                                                                                      ^~
In file included from /usr/include/openssl/bn.h:32:0,
                 from ../../libqtelegram-aseman-edition-10.0.0-stable/core/outboundpkt.h:30,
                 from ../util/cryptoutils.h:26,
                 from ../util/cryptoutils.cpp:22:
/usr/include/openssl/ossl_typ.h:110:16: note: forward declaration of 'RSA {aka struct rsa_st}'
 typedef struct rsa_st RSA;
                ^~~~~~
../util/cryptoutils.cpp:43:129: error: invalid use of incomplete type 'RSA {aka struct rsa_st}'
     return padRsaEncrypt((char *) p.buffer(), p.length() * 4, (char *) encryptBuffer, ENCRYPT_BUFFER_INTS * 4, pubKey->n, pubKey->e);
                                                                                                                                 ^~
In file included from /usr/include/openssl/bn.h:32:0,
                 from ../../libqtelegram-aseman-edition-10.0.0-stable/core/outboundpkt.h:30,
                 from ../util/cryptoutils.h:26,
                 from ../util/cryptoutils.cpp:22:
/usr/include/openssl/ossl_typ.h:110:16: note: forward declaration of 'RSA {aka struct rsa_st}'
 typedef struct rsa_st RSA;
                ^~~~~~
../util/cryptoutils.cpp: In member function 'qint32 CryptoUtils::padRsaEncrypt(char*, qint32, char*, qint32, BIGNUM*, BIGNUM*)':
../util/cryptoutils.cpp:55:26: warning: 'int RAND_pseudo_bytes(unsigned char*, int)' is deprecated [-Wdeprecated-declarations]
     qint32 isSupported = RAND_pseudo_bytes ((uchar *) from + from_len, pad); // returns -1 if not supported
                          ^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/opensslconf.h:42:0,
                 from /usr/include/openssl/asn1.h:15,
                 from /usr/include/openssl/rsa.h:16,
                 from ../../libqtelegram-aseman-edition-10.0.0-stable/core/settings.h:80,
                 from ../util/cryptoutils.cpp:24:
/usr/include/openssl/rand.h:47:1: note: declared here
 DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
 ^
../util/cryptoutils.cpp:55:75: warning: 'int RAND_pseudo_bytes(unsigned char*, int)' is deprecated [-Wdeprecated-declarations]
     qint32 isSupported = RAND_pseudo_bytes ((uchar *) from + from_len, pad); // returns -1 if not supported
                                                                           ^
In file included from /usr/include/openssl/opensslconf.h:42:0,
                 from /usr/include/openssl/asn1.h:15,
                 from /usr/include/openssl/rsa.h:16,
                 from ../../libqtelegram-aseman-edition-10.0.0-stable/core/settings.h:80,
                 from ../util/cryptoutils.cpp:24:
/usr/include/openssl/rand.h:47:1: note: declared here
 DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
 ^
../util/cryptoutils.cpp:64:12: error: aggregate 'BIGNUM x' has incomplete type and cannot be defined
     BIGNUM x, y;
            ^
../util/cryptoutils.cpp:64:15: error: aggregate 'BIGNUM y' has incomplete type and cannot be defined
     BIGNUM x, y;
               ^
../util/cryptoutils.cpp:65:16: error: 'BN_init' was not declared in this scope
     BN_init (&x);
                ^
../util/cryptoutils.cpp: In member function 'qint32 CryptoUtils::padAESEncrypt(const char*, qint32, char*, qint32)':
../util/cryptoutils.cpp:152:34: warning: 'int RAND_pseudo_bytes(unsigned char*, int)' is deprecated [-Wdeprecated-declarations]
         qint32 isRandSupported = RAND_pseudo_bytes ((uchar *) from + fromLen, paddedSize - fromLen);
                                  ^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/opensslconf.h:42:0,
                 from /usr/include/openssl/asn1.h:15,
                 from /usr/include/openssl/rsa.h:16,
                 from ../../libqtelegram-aseman-edition-10.0.0-stable/core/settings.h:80,
                 from ../util/cryptoutils.cpp:24:
/usr/include/openssl/rand.h:47:1: note: declared here
 DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
 ^
../util/cryptoutils.cpp:152:99: warning: 'int RAND_pseudo_bytes(unsigned char*, int)' is deprecated [-Wdeprecated-declarations]
         qint32 isRandSupported = RAND_pseudo_bytes ((uchar *) from + fromLen, paddedSize - fromLen);
                                                                                                   ^
In file included from /usr/include/openssl/opensslconf.h:42:0,
                 from /usr/include/openssl/asn1.h:15,
                 from /usr/include/openssl/rsa.h:16,
                 from ../../libqtelegram-aseman-edition-10.0.0-stable/core/settings.h:80,
                 from ../util/cryptoutils.cpp:24:
/usr/include/openssl/rand.h:47:1: note: declared here
 DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
 ^
../util/cryptoutils.cpp: In member function 'qint32 CryptoUtils::checkPrime(BIGNUM*)':
../util/cryptoutils.cpp:169:16: warning: 'int BN_is_prime(const BIGNUM*, int, void (*)(int, int, void*), BN_CTX*, void*)' is deprecated [-Wdeprecated-declarations]
     qint32 r = BN_is_prime (p, BN_prime_checks, 0, BN_ctx, 0);
                ^~~~~~~~~~~
In file included from /usr/include/openssl/opensslconf.h:42:0,
                 from /usr/include/openssl/crypto.h:32,
                 from /usr/include/openssl/bn.h:33,
                 from ../../libqtelegram-aseman-edition-10.0.0-stable/core/outboundpkt.h:30,
                 from ../util/cryptoutils.h:26,
                 from ../util/cryptoutils.cpp:22:
/usr/include/openssl/bn.h:291:1: note: declared here
 DEPRECATEDIN_0_9_8(int
 ^
../util/cryptoutils.cpp:169:61: warning: 'int BN_is_prime(const BIGNUM*, int, void (*)(int, int, void*), BN_CTX*, void*)' is deprecated [-Wdeprecated-declarations]
     qint32 r = BN_is_prime (p, BN_prime_checks, 0, BN_ctx, 0);
                                                             ^
In file included from /usr/include/openssl/opensslconf.h:42:0,
                 from /usr/include/openssl/crypto.h:32,
                 from /usr/include/openssl/bn.h:33,
                 from ../../libqtelegram-aseman-edition-10.0.0-stable/core/outboundpkt.h:30,
                 from ../util/cryptoutils.h:26,
                 from ../util/cryptoutils.cpp:22:
/usr/include/openssl/bn.h:291:1: note: declared here
 DEPRECATEDIN_0_9_8(int
 ^
../util/cryptoutils.cpp: In member function 'qint32 CryptoUtils::checkDHParams(BIGNUM*, qint32)':
../util/cryptoutils.cpp:176:12: error: aggregate 'BIGNUM t' has incomplete type and cannot be defined
     BIGNUM t;
            ^
../util/cryptoutils.cpp:177:16: error: 'BN_init' was not declared in this scope
     BN_init (&t);
                ^
../util/cryptoutils.cpp:179:12: error: aggregate 'BIGNUM dh_g' has incomplete type and cannot be defined
     BIGNUM dh_g;
            ^~~~
../util/cryptoutils.cpp:211:12: error: aggregate 'BIGNUM b' has incomplete type and cannot be defined
     BIGNUM b;
            ^
../util/cryptoutils.cpp: In member function 'qint32 CryptoUtils::checkCalculatedParams(const BIGNUM*, const BIGNUM*, const BIGNUM*)':
../util/cryptoutils.cpp:232:12: error: aggregate 'BIGNUM one' has incomplete type and cannot be defined
     BIGNUM one;
            ^~~
../util/cryptoutils.cpp:233:17: error: 'BN_init' was not declared in this scope
     BN_init(&one);
                 ^
../util/cryptoutils.cpp:249:12: error: aggregate 'BIGNUM exp' has incomplete type and cannot be defined
     BIGNUM exp;
            ^~~
../util/cryptoutils.cpp:253:12: error: aggregate 'BIGNUM base' has incomplete type and cannot be defined
     BIGNUM base;
            ^~~~
../util/cryptoutils.cpp:258:12: error: aggregate 'BIGNUM lowLimit' has incomplete type and cannot be defined
     BIGNUM lowLimit;
            ^~~~~~~~
../util/cryptoutils.cpp:263:12: error: aggregate 'BIGNUM highLimit' has incomplete type and cannot be defined
     BIGNUM highLimit;
            ^~~~~~~~~
../util/cryptoutils.cpp: In member function 'QByteArray CryptoUtils::encryptFilePart(const QByteArray&, uchar*, uchar*)':
../util/cryptoutils.cpp:296:13: warning: 'int RAND_pseudo_bytes(unsigned char*, int)' is deprecated [-Wdeprecated-declarations]
             RAND_pseudo_bytes(out.data() + length, paddedSize - length);
             ^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/opensslconf.h:42:0,
                 from /usr/include/openssl/asn1.h:15,
                 from /usr/include/openssl/rsa.h:16,
                 from ../../libqtelegram-aseman-edition-10.0.0-stable/core/settings.h:80,
                 from ../util/cryptoutils.cpp:24:
/usr/include/openssl/rand.h:47:1: note: declared here
 DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
 ^
../util/cryptoutils.cpp:296:71: warning: 'int RAND_pseudo_bytes(unsigned char*, int)' is deprecated [-Wdeprecated-declarations]
             RAND_pseudo_bytes(out.data() + length, paddedSize - length);
                                                                       ^
In file included from /usr/include/openssl/opensslconf.h:42:0,
                 from /usr/include/openssl/asn1.h:15,
                 from /usr/include/openssl/rsa.h:16,
                 from ../../libqtelegram-aseman-edition-10.0.0-stable/core/settings.h:80,
                 from ../util/cryptoutils.cpp:24:
/usr/include/openssl/rand.h:47:1: note: declared here
 DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
 ^
../util/cryptoutils.cpp: In member function 'qint32 CryptoUtils::computeKeyFingerprint(const QByteArray&, const QByteArray&)':
../util/cryptoutils.cpp:329:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     qint32 keyFingerprint = (*(int *)md5) ^ (*(int *)(md5 + 4));
                                      ^~~
@no-identd
Copy link

How about ditching OpenSSL and replacing it with LibreSSL or BoringSSL?

@ignatenkobrain
Copy link
Author

How about... no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants