git: de17add7e619 - main - www/hiawatha: Add missing patches to fix build

From: Neel Chauhan <nc_at_FreeBSD.org>
Date: Thu, 01 Sep 2022 21:52:30 UTC
The branch main has been updated by nc:

URL: https://cgit.FreeBSD.org/ports/commit/?id=de17add7e61938a2a4dd4052f10a6209a08aedda

commit de17add7e61938a2a4dd4052f10a6209a08aedda
Author:     Neel Chauhan <nc@FreeBSD.org>
AuthorDate: 2022-09-01 21:52:28 +0000
Commit:     Neel Chauhan <nc@FreeBSD.org>
CommitDate: 2022-09-01 21:52:28 +0000

    www/hiawatha: Add missing patches to fix build
---
 www/hiawatha/files/patch-src_tls.c    | 25 +++++++++++++++++++++++++
 www/hiawatha/files/patch-src_wigwam.c | 23 +++++++++++++++++++++++
 www/hiawatha/files/patch-src_xslt.c   | 12 ++++++++++++
 3 files changed, 60 insertions(+)

diff --git a/www/hiawatha/files/patch-src_tls.c b/www/hiawatha/files/patch-src_tls.c
new file mode 100644
index 000000000000..e7723e37d069
--- /dev/null
+++ b/www/hiawatha/files/patch-src_tls.c
@@ -0,0 +1,25 @@
+--- src/tls.c.orig	2022-01-22 12:16:26 UTC
++++ src/tls.c
+@@ -322,7 +322,7 @@ int tls_load_key_cert(char *file, mbedtls_pk_context *
+ 	}
+ 	mbedtls_pk_init(*private_key);
+ 
+-	if ((result = mbedtls_pk_parse_keyfile(*private_key, file, NULL, mbedtls_psa_get_random, MBEDTLS_PSA_RANDOM_STATE)) != 0) {
++	if ((result = mbedtls_pk_parse_keyfile(*private_key, file, NULL)) != 0) {
+ 		print_tls_error(result, "Error loading private key from %s", file);
+ 		return -1;
+ 	}
+@@ -436,11 +436,13 @@ int tls_accept(int *sock, mbedtls_ssl_context *context
+ 
+ 	result = TLS_HANDSHAKE_OKE;
+ 	while ((handshake = mbedtls_ssl_handshake(context)) != 0) {
++#ifndef __FreeBSD__
+ 		if (handshake == MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE) {
+ 			mbedtls_ssl_free(context);
+ 			result = TLS_HANDSHAKE_NO_MATCH;
+ 			break;
+ 		}
++#endif
+ 
+ 		if ((handshake != MBEDTLS_ERR_SSL_WANT_READ) && (handshake != MBEDTLS_ERR_SSL_WANT_WRITE)) {
+ 			mbedtls_ssl_free(context);
diff --git a/www/hiawatha/files/patch-src_wigwam.c b/www/hiawatha/files/patch-src_wigwam.c
new file mode 100644
index 000000000000..47266fdadfa9
--- /dev/null
+++ b/www/hiawatha/files/patch-src_wigwam.c
@@ -0,0 +1,23 @@
+--- src/wigwam.c.orig	2022-08-31 17:25:16 UTC
++++ src/wigwam.c
+@@ -582,7 +582,7 @@ int check_main_config(char *config_dir) {
+ 		/* Private key check
+ 		 */
+ 		mbedtls_pk_init(&private_key);
+-		if (mbedtls_pk_parse_keyfile(&private_key, needle->value, NULL, mbedtls_psa_get_random, MBEDTLS_PSA_RANDOM_STATE) != 0) {
++		if (mbedtls_pk_parse_keyfile(&private_key, needle->value, NULL) != 0) {
+ 			printf("Error loading private key from %s.\n", needle->value);
+ 			errors++;
+ 			goto next_crt;
+@@ -601,9 +601,11 @@ int check_main_config(char *config_dir) {
+ 			goto next_crt;
+ 		}
+ 
++#ifndef __FreeBSD__
+ 		if (certificate.MBEDTLS_PRIVATE(sig_md) < MBEDTLS_MD_SHA256) {
+ 			printf("Warning: the certificate signature algoritm in %s should at least be SHA256.\n", needle->value);
+ 		}
++#endif
+ 
+ next_crt:
+ 		last_file = needle->value;
diff --git a/www/hiawatha/files/patch-src_xslt.c b/www/hiawatha/files/patch-src_xslt.c
new file mode 100644
index 000000000000..349b8aa8e3e1
--- /dev/null
+++ b/www/hiawatha/files/patch-src_xslt.c
@@ -0,0 +1,12 @@
+--- src/xslt.c.orig	2019-02-18 18:34:36 UTC
++++ src/xslt.c
+@@ -277,7 +277,9 @@ void init_xslt_module() {
+ /* XSLT transform functions
+  */
+ void init_xslt_module() {
++#ifndef __FreeBSD__
+ 	xmlInitMemory();
++#endif
+ 	xmlInitParser();
+ }
+