summaryrefslogtreecommitdiff
path: root/src/lib/eet
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-01-04 17:44:13 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-01-04 17:47:38 +0900
commit2842165415a637939d24aa3e4a40fec0bba84f42 (patch)
treea86fa7f744ca914f7df35e565a28fffb4caa5b95 /src/lib/eet
parent0ac95c40bcac812d1249b53814b94ccda3603cf9 (diff)
openssl 1.1 build break fixes
this fixes building against openssl 1.1 since it broke api in various ways by hiding structs and deprecating api's (this causes warnings not breaks unlike the struct hiding). this adapts to these changes and makes efl build again. @fix
Diffstat (limited to 'src/lib/eet')
-rw-r--r--src/lib/eet/eet_cipher.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lib/eet/eet_cipher.c b/src/lib/eet/eet_cipher.c
index cf9ef71a56..ea4880edcb 100644
--- a/src/lib/eet/eet_cipher.c
+++ b/src/lib/eet/eet_cipher.c
@@ -475,7 +475,11 @@ eet_identity_sign(FILE *fp,
475 gnutls_datum_t signum = { NULL, 0 }; 475 gnutls_datum_t signum = { NULL, 0 };
476 gnutls_privkey_t privkey; 476 gnutls_privkey_t privkey;
477# else /* ifdef HAVE_GNUTLS */ 477# else /* ifdef HAVE_GNUTLS */
478# if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
479 EVP_MD_CTX *md_ctx;
480# else
478 EVP_MD_CTX md_ctx; 481 EVP_MD_CTX md_ctx;
482# endif
479 unsigned int sign_len = 0; 483 unsigned int sign_len = 0;
480 int cert_len = 0; 484 int cert_len = 0;
481# endif /* ifdef HAVE_GNUTLS */ 485# endif /* ifdef HAVE_GNUTLS */
@@ -561,12 +565,24 @@ eet_identity_sign(FILE *fp,
561 } 565 }
562 566
563 /* Do the signature. */ 567 /* Do the signature. */
568#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
569 md_ctx = EVP_MD_CTX_new();
570 EVP_SignInit(md_ctx, EVP_sha1());
571 EVP_SignUpdate(md_ctx, data, st_buf.st_size);
572 err = EVP_SignFinal(md_ctx,
573 sign,
574 (unsigned int *)&sign_len,
575 key->private_key);
576 EVP_MD_CTX_free(md_ctx);
577#else
564 EVP_SignInit(&md_ctx, EVP_sha1()); 578 EVP_SignInit(&md_ctx, EVP_sha1());
565 EVP_SignUpdate(&md_ctx, data, st_buf.st_size); 579 EVP_SignUpdate(&md_ctx, data, st_buf.st_size);
566 err = EVP_SignFinal(&md_ctx, 580 err = EVP_SignFinal(&md_ctx,
567 sign, 581 sign,
568 (unsigned int *)&sign_len, 582 (unsigned int *)&sign_len,
569 key->private_key); 583 key->private_key);
584 EVP_MD_CTX_cleanup(&md_ctx);
585#endif
570 if (err != 1) 586 if (err != 1)
571 { 587 {
572 ERR_print_errors_fp(stdout); 588 ERR_print_errors_fp(stdout);
@@ -738,7 +754,11 @@ eet_identity_check(const void *data_base,
738 const unsigned char *tmp; 754 const unsigned char *tmp;
739 EVP_PKEY *pkey; 755 EVP_PKEY *pkey;
740 X509 *x509; 756 X509 *x509;
757#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
758 EVP_MD_CTX *md_ctx;
759#else
741 EVP_MD_CTX md_ctx; 760 EVP_MD_CTX md_ctx;
761#endif
742 int err; 762 int err;
743 763
744 /* Strange but d2i_X509 seems to put 0 all over the place. */ 764 /* Strange but d2i_X509 seems to put 0 all over the place. */
@@ -757,9 +777,18 @@ eet_identity_check(const void *data_base,
757 } 777 }
758 778
759 /* Verify the signature */ 779 /* Verify the signature */
780#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
781 md_ctx = EVP_MD_CTX_new();
782 EVP_VerifyInit(md_ctx, EVP_sha1());
783 EVP_VerifyUpdate(md_ctx, data_base, data_length);
784 err = EVP_VerifyFinal(md_ctx, sign, sign_len, pkey);
785 EVP_MD_CTX_free(md_ctx);
786#else
760 EVP_VerifyInit(&md_ctx, EVP_sha1()); 787 EVP_VerifyInit(&md_ctx, EVP_sha1());
761 EVP_VerifyUpdate(&md_ctx, data_base, data_length); 788 EVP_VerifyUpdate(&md_ctx, data_base, data_length);
762 err = EVP_VerifyFinal(&md_ctx, sign, sign_len, pkey); 789 err = EVP_VerifyFinal(&md_ctx, sign, sign_len, pkey);
790 EVP_MD_CTX_cleanup(&md_ctx);
791#endif
763 792
764 X509_free(x509); 793 X509_free(x509);
765 EVP_PKEY_free(pkey); 794 EVP_PKEY_free(pkey);