Bug 227542

Summary: devel/grpc: Fix build with LibreSSL < 2.7
Product: Ports & Packages Reporter: Tobias Kortkamp <tobik>
Component: Individual Port(s)Assignee: Tobias Kortkamp <tobik>
Status: Closed FIXED    
Severity: Affects Only Me CC: vanilla
Priority: --- Keywords: patch
Version: LatestFlags: vanilla: maintainer-feedback+
Hardware: Any   
OS: Any   
Attachments:
Description Flags
grpc.diff tobik: maintainer-approval? (vanilla)

Description Tobias Kortkamp freebsd_committer freebsd_triage 2018-04-16 06:08:29 UTC
Created attachment 192546 [details]
grpc.diff

Hi,

building grpc fails for me with DEFAULT_VERSIONS=ssl=libressl in
make.conf.  The attached patch fixes the build for me.

/usr/bin/c++  -DPB_FIELD_16BIT -Dgrpc_cronet_EXPORTS -Iinclude -I. -isystem /usr/local/include -Ithird_party/benchmark/include -Ithird_party/address_sorting/include -O2 -pipe -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -std=c++11 -O2 -pipe -fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem /usr/local/include -fPIC -MD -MT CMakeFiles/grpc_cronet.dir/src/core/tsi/alts/crypt/aes_gcm.cc.o -MF CMakeFiles/grpc_cronet.dir/src/core/tsi/alts/crypt/aes_gcm.cc.o.d -o CMakeFiles/grpc_cronet.dir/src/core/tsi/alts/crypt/aes_gcm.cc.o -c src/core/tsi/alts/crypt/aes_gcm.cc
src/core/tsi/alts/crypt/aes_gcm.cc:199:20: error: use of undeclared identifier 'HMAC_CTX_new'; did you mean 'BN_CTX_new'?
  HMAC_CTX* hmac = HMAC_CTX_new();
                   ^~~~~~~~~~~~
                   BN_CTX_new
/usr/local/include/openssl/bn.h:350:9: note: 'BN_CTX_new' declared here
BN_CTX *BN_CTX_new(void);
        ^
src/core/tsi/alts/crypt/aes_gcm.cc:199:13: error: cannot initialize a variable of type 'HMAC_CTX *' (aka 'hmac_ctx_st *') with an rvalue of type 'BN_CTX *' (aka 'bignum_ctx *')
  HMAC_CTX* hmac = HMAC_CTX_new();
            ^      ~~~~~~~~~~~~~~
2 errors generated.
ninja: build stopped: subcommand failed.
Comment 1 Vanilla I. Shu freebsd_committer freebsd_triage 2018-04-16 06:12:19 UTC
seems fine to me, please commit it, thanks.
Comment 2 Tobias Kortkamp freebsd_committer freebsd_triage 2018-04-16 08:03:38 UTC
Thanks!
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-04-16 08:04:25 UTC
A commit references this bug:

Author: tobik
Date: Mon Apr 16 08:03:30 UTC 2018
New revision: 467465
URL: https://svnweb.freebsd.org/changeset/ports/467465

Log:
  devel/grpc: Fix build with LibreSSL < 2.7

  PR:		227542
  Approved by:	vanilla (maintainer)

Changes:
  head/devel/grpc/files/patch-src_core_tsi_alts_crypt_aes__gcm.cc
  head/devel/grpc/files/patch-src_core_tsi_ssl__transport__security.cc