Bug 266763 - devel/libgit2 1.3.2 fails to build with libressl 3.5.3
Summary: devel/libgit2 1.3.2 fails to build with libressl 3.5.3
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Matthias Fechner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-02 14:00 UTC by tjlegg
Modified: 2022-11-07 15:45 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (mfechner)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tjlegg 2022-10-02 14:00:55 UTC
/wrkdirs/usr/ports/devel/libgit2/work/libgit2-1.3.2/deps/ntlmclient/crypt_openssl.c:136:40: error: use of undeclared identifier 'HMAC_CTX_cleanup'
        ntlm->crypt_ctx.hmac_ctx_cleanup_fn = HMAC_CTX_cleanup;
                                              ^
1 error generated.
ninja: build stopped: subcommand failed.
===> Compilation failed unexpectedly.
Comment 1 tjlegg 2022-10-02 15:09:59 UTC
HMAC_CTX_cleanup was deprecated in libressl 3.4 and removed in libressl 3.5

So looking at
https://github.com/libgit2/libgit2/blob/maint/v1.3/deps/ntlmclient/crypt_openssl.c

the if in line 57 just needs to be changed to exclude libressl >= 3.5
Comment 2 tjlegg 2022-10-02 15:14:14 UTC
Oooops. Line 47 not 57
Comment 3 tjlegg 2022-10-02 16:59:23 UTC
And here I am not looking at the line numbers in my error reports and existing patches. This is down in the else.

I added a crude if around just line 136
@@ -133,7 +133,9 @@ static bool ntlm_crypt_init_functions(ntlm_client *ntl
        ntlm->crypt_ctx.hmac_ctx_new_fn = HMAC_CTX_new;
        ntlm->crypt_ctx.hmac_ctx_free_fn = HMAC_CTX_free;
        ntlm->crypt_ctx.hmac_ctx_reset_fn = HMAC_CTX_reset;
+#if !LIBRESSL_VERSION_NUMBER
        ntlm->crypt_ctx.hmac_ctx_cleanup_fn = HMAC_CTX_cleanup;
+#endif
        ntlm->crypt_ctx.hmac_init_ex_fn = HMAC_Init_ex;
        ntlm->crypt_ctx.hmac_update_fn = HMAC_Update;
        ntlm->crypt_ctx.hmac_final_fn = HMAC_Final;

and it built successfully.
Comment 4 Matthias Fechner freebsd_committer 2022-10-09 06:59:09 UTC
Thanks, can you please report this upstream and put a link here?
If at was accepted upstream, please let me know, than I will include it into the ports too.
Comment 5 tjlegg 2022-10-10 12:30:20 UTC
(In reply to Matthias Fechner from comment #4)

Looks like my fix has already been pulled into upstream main. Perhaps not backported onto 1.3.x branch

https://github.com/libgit2/libgit2/pull/6157
Comment 6 Matthias Fechner freebsd_committer 2022-11-07 15:45:35 UTC
Fixed with commit bcbefcd5252c4603173bde6a7686026b72e711ec, thanks.