Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Mar 2021 20:56:01 +0000 (UTC)
From:      Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r569597 - in head/security/nettle: . files
Message-ID:  <202103302056.12UKu1lT065243@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sunpoet
Date: Tue Mar 30 20:56:01 2021
New Revision: 569597
URL: https://svnweb.freebsd.org/changeset/ports/569597

Log:
  Build and install example applications
  
  - Bump PORTREVISION for package change

Added:
  head/security/nettle/files/
  head/security/nettle/files/patch-examples-nettle-openssl.c   (contents, props changed)
Modified:
  head/security/nettle/Makefile
  head/security/nettle/pkg-plist

Modified: head/security/nettle/Makefile
==============================================================================
--- head/security/nettle/Makefile	Tue Mar 30 20:32:57 2021	(r569596)
+++ head/security/nettle/Makefile	Tue Mar 30 20:56:01 2021	(r569597)
@@ -3,6 +3,7 @@
 
 PORTNAME=	nettle
 PORTVERSION=	3.7.2
+PORTREVISION=	1
 CATEGORIES=	security
 MASTER_SITES=	GNU \
 		https://www.lysator.liu.se/~nisse/archive/
@@ -30,6 +31,9 @@ INFO=		nettle
 
 OPTIONS_DEFINE=	DOCS EXAMPLES
 
+EXAMPLES_CFLAGS=	-I${OPENSSLINC}
+EXAMPLES_USES=		ssl
+
 .include <bsd.port.options.mk>
 
 .if ${ARCH} == "sparc64"
@@ -37,12 +41,14 @@ CONFIGURE_ENV+=	CCPIC=-fPIC
 .endif
 
 post-patch:
-	@${REINPLACE_CMD} -e '/SUBDIRS = / s| examples||' ${WRKSRC}/Makefile.in
 	@${REINPLACE_CMD} -e '/libdir=/ s|lib32|lib|' ${WRKSRC}/configure
 .if ${ARCH} == "mips64"
 	@${REINPLACE_CMD} -e 's|__sgi|__unix__|' ${WRKSRC}/configure
 .endif
 
+post-patch-EXAMPLES-off:
+	@${REINPLACE_CMD} -e '/SUBDIRS = / s| examples||' ${WRKSRC}/Makefile.in
+
 post-install:
 	${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/lib*.so
 
@@ -52,6 +58,7 @@ post-install-DOCS-on:
 
 post-install-EXAMPLES-on:
 	${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+	cd ${WRKSRC}/examples && ${INSTALL_PROGRAM} base16dec base16enc base64dec base64enc ecc-benchmark hogweed-benchmark nettle-benchmark random-prime rsa-decrypt rsa-encrypt rsa-keygen rsa-sign rsa-verify ${STAGEDIR}${EXAMPLESDIR}
 	${INSTALL_DATA} ${WRKSRC}/examples/*.[ch] ${STAGEDIR}${EXAMPLESDIR}
 
 .include <bsd.port.mk>

Added: head/security/nettle/files/patch-examples-nettle-openssl.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/security/nettle/files/patch-examples-nettle-openssl.c	Tue Mar 30 20:56:01 2021	(r569597)
@@ -0,0 +1,49 @@
+--- examples/nettle-openssl.c.orig	2021-03-21 08:32:25 UTC
++++ examples/nettle-openssl.c
+@@ -374,6 +374,7 @@ openssl_hash_update(void *p,
+   EVP_DigestUpdate(ctx->evp, src, length);
+ }
+ 
++#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ #define OPENSSL_HASH(NAME, name)					\
+ static void								\
+ openssl_##name##_init(void *p)						\
+@@ -404,6 +405,38 @@ nettle_openssl_##name = {						\
+   openssl_hash_update,							\
+   openssl_##name##_digest						\
+ };
++#else
++#define OPENSSL_HASH(NAME, name)					\
++static void								\
++openssl_##name##_init(void *p)						\
++{									\
++  struct openssl_hash_ctx *ctx = p;					\
++  if ((ctx->evp = EVP_MD_CTX_create()) == NULL)			\
++    return;								\
++									\
++  EVP_DigestInit(ctx->evp, EVP_##name());				\
++}									\
++									\
++static void								\
++openssl_##name##_digest(void *p,					\
++		    size_t length, uint8_t *dst)			\
++{									\
++  struct openssl_hash_ctx *ctx = p;					\
++  assert(length == NAME##_DIGEST_LENGTH);				\
++									\
++  EVP_DigestFinal(ctx->evp, dst, NULL);					\
++  EVP_DigestInit(ctx->evp, EVP_##name());				\
++}									\
++									\
++const struct nettle_hash						\
++nettle_openssl_##name = {						\
++  "openssl " #name, sizeof(struct openssl_hash_ctx),			\
++  NAME##_DIGEST_LENGTH, NAME##_CBLOCK,					\
++  openssl_##name##_init,						\
++  openssl_hash_update,							\
++  openssl_##name##_digest						\
++};
++#endif
+ 
+ OPENSSL_HASH(MD5, md5)
+ OPENSSL_HASH(SHA, sha1)

Modified: head/security/nettle/pkg-plist
==============================================================================
--- head/security/nettle/pkg-plist	Tue Mar 30 20:32:57 2021	(r569596)
+++ head/security/nettle/pkg-plist	Tue Mar 30 20:56:01 2021	(r569597)
@@ -83,23 +83,36 @@ libdata/pkgconfig/nettle.pc
 %%PORTDOCS%%%%DOCSDIR%%/README
 %%PORTDOCS%%%%DOCSDIR%%/nettle.html
 %%PORTDOCS%%%%DOCSDIR%%/nettle.pdf
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/base16dec
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/base16dec.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/base16enc
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/base16enc.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/base64dec
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/base64dec.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/base64enc
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/base64enc.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ecc-benchmark
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/ecc-benchmark.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/hogweed-benchmark
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/hogweed-benchmark.c
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/io.c
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/io.h
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/nettle-benchmark
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/nettle-benchmark.c
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/nettle-openssl.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/random-prime
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/random-prime.c
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/read_rsa_key.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/rsa-decrypt
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/rsa-decrypt.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/rsa-encrypt
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/rsa-encrypt.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/rsa-keygen
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/rsa-keygen.c
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/rsa-session.h
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/rsa-sign
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/rsa-sign.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/rsa-verify
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/rsa-verify.c
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/timing.c
 %%PORTEXAMPLES%%%%EXAMPLESDIR%%/timing.h



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103302056.12UKu1lT065243>