From owner-svn-ports-all@freebsd.org Wed Oct 10 19:28:19 2018 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5451D10B9F5C; Wed, 10 Oct 2018 19:28:19 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F39E28EA04; Wed, 10 Oct 2018 19:28:18 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1321253F1; Wed, 10 Oct 2018 19:28:18 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9AJSI43026753; Wed, 10 Oct 2018 19:28:18 GMT (envelope-from antoine@FreeBSD.org) Received: (from antoine@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9AJSIU6026748; Wed, 10 Oct 2018 19:28:18 GMT (envelope-from antoine@FreeBSD.org) Message-Id: <201810101928.w9AJSIU6026748@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: antoine set sender to antoine@FreeBSD.org using -f From: Antoine Brodin Date: Wed, 10 Oct 2018 19:28:18 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r481766 - in head/net/liboauth: . files X-SVN-Group: ports-head X-SVN-Commit-Author: antoine X-SVN-Commit-Paths: in head/net/liboauth: . files X-SVN-Commit-Revision: 481766 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Oct 2018 19:28:19 -0000 Author: antoine Date: Wed Oct 10 19:28:18 2018 New Revision: 481766 URL: https://svnweb.freebsd.org/changeset/ports/481766 Log: Fix build with openssl 1.1.1 PR: 225919 Submitted by: Nathan Owens Obtained from: https://github.com/x42/liboauth/issues/9 With hat: portmgr Added: head/net/liboauth/files/ head/net/liboauth/files/patch-src_hash.c (contents, props changed) Modified: head/net/liboauth/Makefile Modified: head/net/liboauth/Makefile ============================================================================== --- head/net/liboauth/Makefile Wed Oct 10 19:19:19 2018 (r481765) +++ head/net/liboauth/Makefile Wed Oct 10 19:28:18 2018 (r481766) @@ -2,7 +2,7 @@ PORTNAME= liboauth PORTVERSION= 1.0.3 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= net MASTER_SITES= SF/${PORTNAME} @@ -12,13 +12,11 @@ COMMENT= C library implementing the OAuth Core standar LICENSE= MIT LICENSE_FILE= ${WRKSRC}/COPYING.MIT -BROKEN_SSL= openssl-devel -BROKEN_SSL_REASON_openssl-devel= error: variable has incomplete type 'EVP_MD_CTX' (aka 'struct evp_md_ctx_st') - LIB_DEPENDS= libcurl.so:ftp/curl USES= libtool pkgconfig ssl USE_LDCONFIG= yes + GNU_CONFIGURE= yes MAKE_ARGS= pkgconfigdir="${PREFIX}/libdata/pkgconfig" INSTALL_TARGET= install-strip Added: head/net/liboauth/files/patch-src_hash.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/liboauth/files/patch-src_hash.c Wed Oct 10 19:28:18 2018 (r481766) @@ -0,0 +1,137 @@ +--- src/hash.c.orig 2013-10-04 13:02:50 UTC ++++ src/hash.c +@@ -362,6 +362,11 @@ looser: + #include "oauth.h" // base64 encode fn's. + #include + ++#if OPENSSL_VERSION_NUMBER < 0x10100000 ++#define EVP_MD_CTX_new EVP_MD_CTX_create ++#define EVP_MD_CTX_free EVP_MD_CTX_destroy ++#endif ++ + char *oauth_sign_hmac_sha1 (const char *m, const char *k) { + return(oauth_sign_hmac_sha1_raw (m, strlen(m), k, strlen(k))); + } +@@ -386,7 +391,7 @@ char *oauth_sign_rsa_sha1 (const char *m + unsigned char *sig = NULL; + unsigned char *passphrase = NULL; + unsigned int len=0; +- EVP_MD_CTX md_ctx; ++ EVP_MD_CTX *md_ctx; + + EVP_PKEY *pkey; + BIO *in; +@@ -399,24 +404,32 @@ char *oauth_sign_rsa_sha1 (const char *m + return xstrdup("liboauth/OpenSSL: can not read private key"); + } + ++ md_ctx = EVP_MD_CTX_new(); ++ if (md_ctx == NULL) { ++ return xstrdup("liboauth/OpenSSL: failed to allocate EVP_MD_CTX"); ++ } ++ ++ + len = EVP_PKEY_size(pkey); + sig = (unsigned char*)xmalloc((len+1)*sizeof(char)); + +- EVP_SignInit(&md_ctx, EVP_sha1()); +- EVP_SignUpdate(&md_ctx, m, strlen(m)); +- if (EVP_SignFinal (&md_ctx, sig, &len, pkey)) { ++ EVP_SignInit(md_ctx, EVP_sha1()); ++ EVP_SignUpdate(md_ctx, m, strlen(m)); ++ if (EVP_SignFinal (md_ctx, sig, &len, pkey)) { + char *tmp; + sig[len] = '\0'; + tmp = oauth_encode_base64(len,sig); + OPENSSL_free(sig); + EVP_PKEY_free(pkey); ++ EVP_MD_CTX_free(md_ctx); + return tmp; + } ++ EVP_MD_CTX_free(md_ctx); + return xstrdup("liboauth/OpenSSL: rsa-sha1 signing failed"); + } + + int oauth_verify_rsa_sha1 (const char *m, const char *c, const char *s) { +- EVP_MD_CTX md_ctx; ++ EVP_MD_CTX *md_ctx; + EVP_PKEY *pkey; + BIO *in; + X509 *cert = NULL; +@@ -437,13 +450,18 @@ int oauth_verify_rsa_sha1 (const char *m + return -2; + } + ++ md_ctx = EVP_MD_CTX_new(); ++ if (md_ctx == NULL) { ++ return -2; ++ } ++ + b64d= (unsigned char*) xmalloc(sizeof(char)*strlen(s)); + slen = oauth_decode_base64(b64d, s); + +- EVP_VerifyInit(&md_ctx, EVP_sha1()); +- EVP_VerifyUpdate(&md_ctx, m, strlen(m)); +- err = EVP_VerifyFinal(&md_ctx, b64d, slen, pkey); +- EVP_MD_CTX_cleanup(&md_ctx); ++ EVP_VerifyInit(md_ctx, EVP_sha1()); ++ EVP_VerifyUpdate(md_ctx, m, strlen(m)); ++ err = EVP_VerifyFinal(md_ctx, b64d, slen, pkey); ++ EVP_MD_CTX_free(md_ctx); + EVP_PKEY_free(pkey); + xfree(b64d); + return (err); +@@ -455,35 +473,41 @@ int oauth_verify_rsa_sha1 (const char *m + */ + char *oauth_body_hash_file(char *filename) { + unsigned char fb[BUFSIZ]; +- EVP_MD_CTX ctx; ++ EVP_MD_CTX *ctx; + size_t len=0; + unsigned char *md; + FILE *F= fopen(filename, "r"); + if (!F) return NULL; + +- EVP_MD_CTX_init(&ctx); +- EVP_DigestInit(&ctx,EVP_sha1()); ++ ctx = EVP_MD_CTX_new(); ++ if (ctx == NULL) { ++ return xstrdup("liboauth/OpenSSL: failed to allocate EVP_MD_CTX"); ++ } ++ EVP_DigestInit(ctx,EVP_sha1()); + while (!feof(F) && (len=fread(fb,sizeof(char),BUFSIZ, F))>0) { +- EVP_DigestUpdate(&ctx, fb, len); ++ EVP_DigestUpdate(ctx, fb, len); + } + fclose(F); + len=0; + md=(unsigned char*) xcalloc(EVP_MD_size(EVP_sha1()),sizeof(unsigned char)); +- EVP_DigestFinal(&ctx, md,(unsigned int*) &len); +- EVP_MD_CTX_cleanup(&ctx); ++ EVP_DigestFinal(ctx, md,(unsigned int*) &len); ++ EVP_MD_CTX_free(ctx); + return oauth_body_hash_encode(len, md); + } + + char *oauth_body_hash_data(size_t length, const char *data) { +- EVP_MD_CTX ctx; ++ EVP_MD_CTX *ctx; + size_t len=0; + unsigned char *md; + md=(unsigned char*) xcalloc(EVP_MD_size(EVP_sha1()),sizeof(unsigned char)); +- EVP_MD_CTX_init(&ctx); +- EVP_DigestInit(&ctx,EVP_sha1()); +- EVP_DigestUpdate(&ctx, data, length); +- EVP_DigestFinal(&ctx, md,(unsigned int*) &len); +- EVP_MD_CTX_cleanup(&ctx); ++ ctx = EVP_MD_CTX_new(); ++ if (ctx == NULL) { ++ return xstrdup("liboauth/OpenSSL: failed to allocate EVP_MD_CTX"); ++ } ++ EVP_DigestInit(ctx,EVP_sha1()); ++ EVP_DigestUpdate(ctx, data, length); ++ EVP_DigestFinal(ctx, md,(unsigned int*) &len); ++ EVP_MD_CTX_free(ctx); + return oauth_body_hash_encode(len, md); + } +