Compatability fixes for OpenSSL 1.1

This commit is contained in:
Iwan Timmer 2017-04-26 20:00:09 +02:00
parent 415c2efe87
commit d46fe49c57
4 changed files with 8 additions and 5 deletions

View File

@ -1,7 +1,7 @@
find_package(LibUUID REQUIRED) find_package(LibUUID REQUIRED)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
find_package(CURL REQUIRED) find_package(CURL REQUIRED)
find_package(OpenSSL REQUIRED) find_package(OpenSSL 1.1 REQUIRED)
find_package(EXPAT REQUIRED) find_package(EXPAT REQUIRED)
pkg_check_modules(AVAHI REQUIRED avahi-client) pkg_check_modules(AVAHI REQUIRED avahi-client)

View File

@ -494,12 +494,15 @@ int gs_pair(PSERVER_DATA server, char* pin) {
char client_secret_data[16]; char client_secret_data[16];
RAND_bytes(client_secret_data, 16); RAND_bytes(client_secret_data, 16);
const ASN1_BIT_STRING *asnSignature;
X509_get0_signature(&asnSignature, NULL, cert);
char challenge_response[16 + 256 + 16]; char challenge_response[16 + 256 + 16];
char challenge_response_hash[32]; char challenge_response_hash[32];
char challenge_response_hash_enc[32]; char challenge_response_hash_enc[32];
char challenge_response_hex[65]; char challenge_response_hex[65];
memcpy(challenge_response, challenge_response_data + hash_length, 16); memcpy(challenge_response, challenge_response_data + hash_length, 16);
memcpy(challenge_response + 16, cert->signature->data, 256); memcpy(challenge_response + 16, asnSignature->data, 256);
memcpy(challenge_response + 16 + 256, client_secret_data, 16); memcpy(challenge_response + 16 + 256, client_secret_data, 16);
if (server->serverMajorVersion >= 7) if (server->serverMajorVersion >= 7)
SHA256(challenge_response, 16 + 256 + 16, challenge_response_hash); SHA256(challenge_response, 16 + 256 + 16, challenge_response_hash);

View File

@ -18,6 +18,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <openssl/crypto.h>
#include <openssl/pem.h> #include <openssl/pem.h>
#include <openssl/conf.h> #include <openssl/conf.h>
#include <openssl/pkcs12.h> #include <openssl/pkcs12.h>
@ -42,7 +43,7 @@ CERT_KEY_PAIR mkcert_generate() {
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
SSLeay_add_all_algorithms(); OpenSSL_add_all_algorithms();
ERR_load_crypto_strings(); ERR_load_crypto_strings();
mkcert(&x509, &pkey, NUM_BITS, SERIAL, NUM_YEARS); mkcert(&x509, &pkey, NUM_BITS, SERIAL, NUM_YEARS);
@ -54,7 +55,6 @@ CERT_KEY_PAIR mkcert_generate() {
#endif #endif
CRYPTO_cleanup_all_ex_data(); CRYPTO_cleanup_all_ex_data();
CRYPTO_mem_leaks(bio_err);
BIO_free(bio_err); BIO_free(bio_err);
return (CERT_KEY_PAIR) {x509, pkey, p12}; return (CERT_KEY_PAIR) {x509, pkey, p12};

@ -1 +1 @@
Subproject commit dcdfcd55e575e7f73e813e338fe9ab11ed1211a7 Subproject commit 27213a167808e85824cc4e2163c7dcaaadf64e50