Skip to content

Commit 145858d

Browse files
committed
www/tomcat-native2: new port
PR: 276736 Approved by: jrm (mentor) Tested by: jonc@chen.org.nz Differential Revision: https://reviews.freebsd.org/D44824
1 parent e5b6e9e commit 145858d

File tree

7 files changed

+133
-0
lines changed

7 files changed

+133
-0
lines changed

‎www/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,6 +2384,7 @@
23842384
SUBDIR += tokyopromenade
23852385
SUBDIR += tomcat-devel
23862386
SUBDIR += tomcat-native
2387+
SUBDIR += tomcat-native2
23872388
SUBDIR += tomcat101
23882389
SUBDIR += tomcat85
23892390
SUBDIR += tomcat9

‎www/tomcat-native2/Makefile‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
PORTNAME= tomcat-native
2+
DISTVERSION= 2.0.7
3+
CATEGORIES= www java
4+
MASTER_SITES= https://archive.apache.org/dist/tomcat/tomcat-connectors/native/${PORTVERSION}/source/
5+
PKGNAMESUFFIX= 2
6+
DISTNAME= ${PORTNAME}-${PORTVERSION}-src
7+
8+
MAINTAINER= michaelo@apache.org
9+
COMMENT= Tomcat native library
10+
WWW= https://tomcat.apache.org/native-doc/
11+
12+
LICENSE= APACHE20
13+
14+
LIB_DEPENDS= libapr-1.so:devel/apr1
15+
16+
USES= libtool ssl
17+
USE_JAVA= yes
18+
USE_LDCONFIG= yes
19+
GNU_CONFIGURE= yes
20+
CONFIGURE_ARGS= --with-apr=${LOCALBASE} \
21+
--with-java-home=${JAVA_HOME} \
22+
--with-ssl=${OPENSSLBASE} \
23+
--disable-openssl-version-check
24+
25+
WRKSRC= ${WRKDIR}/${DISTNAME}/native
26+
27+
SOVERSION= ${PORTVERSION:E}
28+
MAJORVERSION= ${PORTVERSION:R:R}
29+
PLIST_FILES= lib/libtcnative-${MAJORVERSION}.so \
30+
lib/libtcnative-${MAJORVERSION}.so.0 \
31+
lib/libtcnative-${MAJORVERSION}.so.0.0.${SOVERSION}
32+
33+
post-install:
34+
${RM} ${STAGEDIR}${PREFIX}/lib/libtcnative-${MAJORVERSION}.a
35+
${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libtcnative-${MAJORVERSION}.so.0.0.${SOVERSION}
36+
37+
.include <bsd.port.mk>

‎www/tomcat-native2/distinfo‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
TIMESTAMP = 1713346420
2+
SHA256 (tomcat-native-2.0.7-src.tar.gz) = 2c5afc7edc383e47660647e9a7071ad81f58e51c7f765c12f7e7afc9203b2d4d
3+
SIZE (tomcat-native-2.0.7-src.tar.gz) = 538131
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--- include/ssl_private.h.orig 2024-02-04 19:32:52 UTC
2+
+++ include/ssl_private.h
3+
@@ -46,9 +46,6 @@
4+
#include <openssl/x509v3.h>
5+
#include <openssl/dh.h>
6+
#include <openssl/bn.h>
7+
-#ifndef LIBRESSL_VERSION_NUMBER
8+
-#include <openssl/provider.h>
9+
-#endif
10+
/* Avoid tripping over an engine build installed globally and detected
11+
* when the user points at an explicit non-engine flavor of OpenSSL
12+
*/
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
--- src/ssl.c.orig 2024-02-04 19:32:52 UTC
2+
+++ src/ssl.c
3+
@@ -395,30 +395,14 @@ TCN_IMPLEMENT_CALL(void, SSL, randSet)(TCN_STDARGS, js
4+
5+
TCN_IMPLEMENT_CALL(jint, SSL, fipsModeGet)(TCN_STDARGS)
6+
{
7+
-#if defined(LIBRESSL_VERSION_NUMBER)
8+
UNREFERENCED(o);
9+
- /* LibreSSL doesn't support FIPS */
10+
- return 0;
11+
+#ifdef OPENSSL_FIPS
12+
+ return FIPS_mode();
13+
#else
14+
- EVP_MD *md;
15+
- const OSSL_PROVIDER *provider;
16+
- const char *name;
17+
- UNREFERENCED(o);
18+
+ /* FIPS is unavailable */
19+
+ tcn_ThrowException(e, "FIPS was not available to tcnative at build time. You will need to re-build tcnative against an OpenSSL with FIPS.");
20+
21+
- // Maps the OpenSSL 3. x onwards behaviour to theOpenSSL 1.x API
22+
-
23+
- // Checks that FIPS is the default provider
24+
- md = EVP_MD_fetch(NULL, "SHA-512", NULL);
25+
- provider = EVP_MD_get0_provider(md);
26+
- name = OSSL_PROVIDER_get0_name(provider);
27+
- // Clean up
28+
- EVP_MD_free(md);
29+
-
30+
- if (strcmp("fips", name)) {
31+
- return 0;
32+
- } else {
33+
- return 1;
34+
- }
35+
+ return 0;
36+
#endif
37+
}
38+
39+
@@ -427,8 +411,22 @@ TCN_IMPLEMENT_CALL(jint, SSL, fipsModeSet)(TCN_STDARGS
40+
int r = 0;
41+
UNREFERENCED(o);
42+
43+
- /* This method should never be called when using Tomcat Native 2.x onwards */
44+
- tcn_ThrowException(e, "fipsModeSet is not supported in Tomcat Native 2.x onwards.");
45+
+#ifdef OPENSSL_FIPS
46+
+ if(1 != (r = (jint)FIPS_mode_set((int)mode))) {
47+
+ /* arrange to get a human-readable error message */
48+
+ unsigned long err = SSL_ERR_get();
49+
+ char msg[256];
50+
+
51+
+ /* ERR_load_crypto_strings() already called in initialize() */
52+
+
53+
+ ERR_error_string_n(err, msg, 256);
54+
+
55+
+ tcn_ThrowException(e, msg);
56+
+ }
57+
+#else
58+
+ /* FIPS is unavailable */
59+
+ tcn_ThrowException(e, "FIPS was not available to tcnative at build time. You will need to re-build tcnative against an OpenSSL with FIPS.");
60+
+#endif
61+
62+
return r;
63+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--- src/sslutils.c.orig 2024-02-04 19:32:52 UTC
2+
+++ src/sslutils.c
3+
@@ -946,11 +946,7 @@ static OCSP_RESPONSE *get_ocsp_response(apr_pool_t *p,
4+
int ok = 0;
5+
apr_socket_t *apr_sock = NULL;
6+
apr_pool_t *mp;
7+
-#ifdef LIBRESSL_VERSION_NUMBER
8+
if (OCSP_parse_url(url, &hostname, &c_port, &path, &use_ssl) == 0)
9+
-#else
10+
- if (OSSL_HTTP_parse_url(url, &use_ssl, NULL, &hostname, &c_port, NULL, &path, NULL, NULL) == 0)
11+
-#endif
12+
goto end;
13+
14+
if (sscanf(c_port, "%d", &port) != 1)

‎www/tomcat-native2/pkg-descr‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The Apache Tomcat Native Library is an optional component for use with Apache
2+
Tomcat that allows Tomcat to use OpenSSL as a replacement for JSSE to support
3+
TLS connections.

0 commit comments

Comments
 (0)