summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--security/mbedtls/DESCR3
-rw-r--r--security/mbedtls/Makefile39
-rw-r--r--security/mbedtls/PLIST118
-rw-r--r--security/mbedtls/buildlink3.mk20
-rw-r--r--security/mbedtls/distinfo8
-rw-r--r--security/mbedtls/options.mk40
-rw-r--r--security/mbedtls/patches/patch-Makefile64
-rw-r--r--security/mbedtls/patches/patch-library_Makefile15
-rw-r--r--security/mbedtls/patches/patch-programs_test_CMakeLists.txt14
9 files changed, 321 insertions, 0 deletions
diff --git a/security/mbedtls/DESCR b/security/mbedtls/DESCR
new file mode 100644
index 00000000000..88b6fb091d2
--- /dev/null
+++ b/security/mbedtls/DESCR
@@ -0,0 +1,3 @@
+mbed TLS (formerly known as PolarSSL) makes it trivially easy for developers
+to include cryptographic and SSL/TLS capabilities in their (embedded)
+products, facilitating this functionality with a minimal coding footprint.
diff --git a/security/mbedtls/Makefile b/security/mbedtls/Makefile
new file mode 100644
index 00000000000..020ba745041
--- /dev/null
+++ b/security/mbedtls/Makefile
@@ -0,0 +1,39 @@
+# $NetBSD: Makefile,v 1.1 2015/06/12 09:05:05 fhajny Exp $
+#
+
+DISTNAME= mbedtls-1.3.11-gpl
+PKGNAME= ${DISTNAME:-gpl=}
+CATEGORIES= security devel
+MASTER_SITES= https://tls.mbed.org/download/
+EXTRACT_SUFX= .tgz
+
+MAINTAINER= pkgsrc-users@NetBSD.org
+HOMEPAGE= https://tls.mbed.org/
+COMMENT= Lightweight, modular cryptographic and SSL/TLS library
+LICENSE= gnu-gpl-v2
+
+CONFLICTS+= polarssl-[0-9]*
+SUPERSEDES+= polarssl-[0-9]*
+
+WRKSRC= ${WRKDIR}/${PKGNAME_NOREV}
+USE_CMAKE= yes
+USE_LANGUAGES= c
+USE_TOOLS+= gmake perl pkg-config
+
+GCC_REQD+= 4.4
+REPLACE_PERL= tests/scripts/*.pl
+
+.include "options.mk"
+
+CMAKE_ARGS+= -DUSE_SHARED_MBEDTLS_LIBRARY=ON
+MAKE_ENV+= RANLIB=${RANLIB:Q}
+TEST_TARGET= check
+
+LDFLAGS.SunOS+= -lsocket
+
+post-install:
+ ${CHMOD} -x ${DESTDIR}${PREFIX}/lib/libmbedtls.a
+ ${SETENV} ${SH} ${WRKSRC}/scripts/polarssl_symlinks.sh ${DESTDIR}${PREFIX}/lib
+
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/security/mbedtls/PLIST b/security/mbedtls/PLIST
new file mode 100644
index 00000000000..672327523c3
--- /dev/null
+++ b/security/mbedtls/PLIST
@@ -0,0 +1,118 @@
+@comment $NetBSD: PLIST,v 1.1 2015/06/12 09:05:05 fhajny Exp $
+${PLIST.tools}bin/aescrypt2
+${PLIST.tools}bin/benchmark
+${PLIST.tools}bin/cert_app
+${PLIST.tools}bin/cert_req
+${PLIST.tools}bin/cert_write
+${PLIST.tools}bin/crl_app
+${PLIST.tools}bin/crypt_and_hash
+${PLIST.tools}bin/dh_client
+${PLIST.tools}bin/dh_genprime
+${PLIST.tools}bin/dh_server
+${PLIST.tools}bin/gen_entropy
+${PLIST.tools}bin/gen_key
+${PLIST.tools}bin/gen_random_ctr_drbg
+${PLIST.tools}bin/gen_random_havege
+${PLIST.tools}bin/generic_sum
+${PLIST.tools}bin/hello
+${PLIST.tools}bin/key_app
+${PLIST.tools}bin/md5sum
+${PLIST.tools}bin/mini_client
+${PLIST.tools}bin/mpi_demo
+${PLIST.tools}${PLIST.tests}bin/o_p_test
+${PLIST.tools}bin/pem2der
+${PLIST.tools}bin/pk_decrypt
+${PLIST.tools}bin/pk_encrypt
+${PLIST.tools}bin/pk_sign
+${PLIST.tools}bin/pk_verify
+${PLIST.tools}bin/req_app
+${PLIST.tools}bin/rsa_decrypt
+${PLIST.tools}bin/rsa_encrypt
+${PLIST.tools}bin/rsa_genkey
+${PLIST.tools}bin/rsa_sign
+${PLIST.tools}bin/rsa_verify
+${PLIST.tools}bin/selftest
+${PLIST.tools}bin/sha1sum
+${PLIST.tools}bin/sha2sum
+${PLIST.tools}bin/ssl_cert_test
+${PLIST.tools}bin/ssl_client1
+${PLIST.tools}bin/ssl_client2
+${PLIST.tools}bin/ssl_fork_server
+${PLIST.tools}bin/ssl_mail_client
+${PLIST.tools}bin/ssl_pthread_server
+${PLIST.tools}bin/ssl_server
+${PLIST.tools}bin/ssl_test
+${PLIST.tools}bin/strerror
+include/polarssl/aes.h
+include/polarssl/aesni.h
+include/polarssl/arc4.h
+include/polarssl/asn1.h
+include/polarssl/asn1write.h
+include/polarssl/base64.h
+include/polarssl/bignum.h
+include/polarssl/blowfish.h
+include/polarssl/bn_mul.h
+include/polarssl/camellia.h
+include/polarssl/ccm.h
+include/polarssl/certs.h
+include/polarssl/check_config.h
+include/polarssl/cipher.h
+include/polarssl/cipher_wrap.h
+include/polarssl/compat-1.2.h
+include/polarssl/config.h
+include/polarssl/ctr_drbg.h
+include/polarssl/debug.h
+include/polarssl/des.h
+include/polarssl/dhm.h
+include/polarssl/ecdh.h
+include/polarssl/ecdsa.h
+include/polarssl/ecp.h
+include/polarssl/entropy.h
+include/polarssl/entropy_poll.h
+include/polarssl/error.h
+include/polarssl/gcm.h
+include/polarssl/havege.h
+include/polarssl/hmac_drbg.h
+include/polarssl/md.h
+include/polarssl/md2.h
+include/polarssl/md4.h
+include/polarssl/md5.h
+include/polarssl/md_wrap.h
+include/polarssl/memory.h
+include/polarssl/memory_buffer_alloc.h
+include/polarssl/net.h
+include/polarssl/oid.h
+include/polarssl/openssl.h
+include/polarssl/padlock.h
+include/polarssl/pbkdf2.h
+include/polarssl/pem.h
+include/polarssl/pk.h
+include/polarssl/pk_wrap.h
+include/polarssl/pkcs11.h
+include/polarssl/pkcs12.h
+include/polarssl/pkcs5.h
+include/polarssl/platform.h
+include/polarssl/ripemd160.h
+include/polarssl/rsa.h
+include/polarssl/sha1.h
+include/polarssl/sha256.h
+include/polarssl/sha512.h
+include/polarssl/ssl.h
+include/polarssl/ssl_cache.h
+include/polarssl/ssl_ciphersuites.h
+include/polarssl/threading.h
+include/polarssl/timing.h
+include/polarssl/version.h
+include/polarssl/x509.h
+include/polarssl/x509_crl.h
+include/polarssl/x509_crt.h
+include/polarssl/x509_csr.h
+include/polarssl/xtea.h
+lib/libmbedtls.a
+lib/libmbedtls.so
+lib/libmbedtls.so.${PKGVERSION}
+lib/libmbedtls.so.9
+lib/libpolarssl.a
+lib/libpolarssl.so
+lib/libpolarssl.so.${PKGVERSION}
+lib/libpolarssl.so.9
diff --git a/security/mbedtls/buildlink3.mk b/security/mbedtls/buildlink3.mk
new file mode 100644
index 00000000000..7b3b9b8fcaa
--- /dev/null
+++ b/security/mbedtls/buildlink3.mk
@@ -0,0 +1,20 @@
+# $NetBSD: buildlink3.mk,v 1.1 2015/06/12 09:05:05 fhajny Exp $
+
+BUILDLINK_TREE+= mbedtls
+
+.if !defined(MBEDTLS_BUILDLINK3_MK)
+MBEDTLS_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.mbedtls+= mbedtls>=0.10.0
+BUILDLINK_PKGSRCDIR.mbedtls?= ../../security/mbedtls
+
+pkgbase := mbedtls
+.include "../../mk/pkg-build-options.mk"
+
+.if !empty(PKG_BUILD_OPTIONS.mbedtls:Mzlib)
+.include "../../devel/zlib/buildlink3.mk"
+.endif
+
+.endif # MBEDTLS_BUILDLINK3_MK
+
+BUILDLINK_TREE+= -mbedtls
diff --git a/security/mbedtls/distinfo b/security/mbedtls/distinfo
new file mode 100644
index 00000000000..807c329ddef
--- /dev/null
+++ b/security/mbedtls/distinfo
@@ -0,0 +1,8 @@
+$NetBSD: distinfo,v 1.1 2015/06/12 09:05:05 fhajny Exp $
+
+SHA1 (mbedtls-1.3.11-gpl.tgz) = 3948084c9d3312b381d458b06d9a2066c3cc0184
+RMD160 (mbedtls-1.3.11-gpl.tgz) = 66448e7d5ca41e7c64f55bdb3e4b9ec9d1ec3205
+Size (mbedtls-1.3.11-gpl.tgz) = 1731809 bytes
+SHA1 (patch-Makefile) = 80698e16a397133de134ab582016b9e91ad652f0
+SHA1 (patch-library_Makefile) = 551854fbdd91ae180f1d5408869a556ff0c39d1a
+SHA1 (patch-programs_test_CMakeLists.txt) = 94ce731d81f1584c406e3b295c84fd6a5c327a50
diff --git a/security/mbedtls/options.mk b/security/mbedtls/options.mk
new file mode 100644
index 00000000000..0799f83a0d9
--- /dev/null
+++ b/security/mbedtls/options.mk
@@ -0,0 +1,40 @@
+# $NetBSD: options.mk,v 1.1 2015/06/12 09:05:05 fhajny Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.mbedtls
+PKG_SUPPORTED_OPTIONS= mbedtls-tools tests zlib
+PKG_SUGGESTED_OPTIONS+= # XXX: blank, though the package has "tests" by default
+
+PLIST_VARS+= tests tools
+
+.if defined(PKG_OPTIONS.polarssl)
+PKG_LEGACY_OPTIONS+= ${PKG_OPTIONS.polarssl}
+PKG_OPTIONS_DEPRECATED_WARNINGS+= "Deprecated variable PKG_OPTIONS.polarssl used, use "${PKG_OPTIONS_VAR:Q}" instead."
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mmbedtls-tools)
+CMAKE_ARGS+= -DENABLE_PROGRAMS=ON
+PLIST.tools= yes
+.else
+CMAKE_ARGS+= -DENABLE_PROGRAMS=OFF
+.endif
+
+.if !empty(PKG_OPTIONS:Mtests)
+. if !empty(PKG_OPTIONS:Mmbedtls-tools)
+. include "../../security/openssl/buildlink3.mk"
+CMAKE_ARGS+= -DENABLE_TESTING=ON
+PLIST.tests= yes
+. else
+PKG_FAIL_REASON+= "option tests needs option mbedtls-tools"
+. endif
+.else
+CMAKE_ARGS+= -DENABLE_TESTING=OFF
+.endif
+
+.if !empty(PKG_OPTIONS:Mzlib)
+.include "../../devel/zlib/buildlink3.mk"
+CMAKE_ARGS+= -DENABLE_ZLIB_SUPPORT=ON
+.else
+CMAKE_ARGS+= -DENABLE_ZLIB_SUPPORT=OFF
+.endif
diff --git a/security/mbedtls/patches/patch-Makefile b/security/mbedtls/patches/patch-Makefile
new file mode 100644
index 00000000000..4abb99a33ec
--- /dev/null
+++ b/security/mbedtls/patches/patch-Makefile
@@ -0,0 +1,64 @@
+$NetBSD: patch-Makefile,v 1.1 2015/06/12 09:05:05 fhajny Exp $
+
+Fix DESTDIR for pkgsrc.
+
+--- Makefile.orig 2015-06-04 12:49:19.000000000 +0000
++++ Makefile
+@@ -1,6 +1,5 @@
+
+-DESTDIR=/usr/local
+-PREFIX=mbedtls_
++APPPREFIX=mbedtls_
+ OLDPREFIX=polarssl_
+
+ .SILENT:
+@@ -19,35 +18,35 @@ tests: lib
+ $(MAKE) -C tests
+
+ install:
+- mkdir -p $(DESTDIR)/include/polarssl
+- cp -r include/polarssl $(DESTDIR)/include
++ mkdir -p $(DESTDIR)$(PREFIX)/include/polarssl
++ cp -r include/polarssl $(DESTDIR)$(PREFIX)/include
+
+- mkdir -p $(DESTDIR)/lib
+- cp -RP library/libpolarssl.* library/libmbedtls.* $(DESTDIR)/lib
++ mkdir -p $(DESTDIR)$(PREFIX)/lib
++ cp -RP library/libpolarssl.* library/libmbedtls.* $(DESTDIR)$(PREFIX)/lib
+
+- mkdir -p $(DESTDIR)/bin
++ mkdir -p $(DESTDIR)$(PREFIX)/bin
+ for p in programs/*/* ; do \
+ if [ -x $$p ] && [ ! -d $$p ] ; \
+ then \
+- f=$(PREFIX)`basename $$p` ; \
++ f=$(APPPREFIX)`basename $$p` ; \
+ o=$(OLDPREFIX)`basename $$p` ; \
+- cp $$p $(DESTDIR)/bin/$$f ; \
+- ln -sf $$f $(DESTDIR)/bin/$$o ; \
++ cp $$p $(DESTDIR)$(PREFIX)/bin/$$f ; \
++ ln -sf $$f $(DESTDIR)$(PREFIX)/bin/$$o ; \
+ fi \
+ done
+
+ uninstall:
+- rm -rf $(DESTDIR)/include/polarssl
+- rm -f $(DESTDIR)/lib/libpolarssl.*
+- rm -f $(DESTDIR)/lib/libmbedtls.*
++ rm -rf $(DESTDIR)$(PREFIX)/include/polarssl
++ rm -f $(DESTDIR)$(PREFIX)/lib/libpolarssl.*
++ rm -f $(DESTDIR)$(PREFIX)/lib/libmbedtls.*
+
+ for p in programs/*/* ; do \
+ if [ -x $$p ] && [ ! -d $$p ] ; \
+ then \
+- f=$(PREFIX)`basename $$p` ; \
++ f=$(APPPREFIX)`basename $$p` ; \
+ o=$(OLDPREFIX)`basename $$p` ; \
+- rm -f $(DESTDIR)/bin/$$f ; \
+- rm -f $(DESTDIR)/bin/$$o ; \
++ rm -f $(DESTDIR)$(PREFIX)/bin/$$f ; \
++ rm -f $(DESTDIR)$(PREFIX)/bin/$$o ; \
+ fi \
+ done
+
diff --git a/security/mbedtls/patches/patch-library_Makefile b/security/mbedtls/patches/patch-library_Makefile
new file mode 100644
index 00000000000..27e435d0f37
--- /dev/null
+++ b/security/mbedtls/patches/patch-library_Makefile
@@ -0,0 +1,15 @@
+$NetBSD: patch-library_Makefile,v 1.1 2015/06/12 09:05:05 fhajny Exp $
+
+Call ranlib instead of non-portable 'ar s'.
+
+--- library/Makefile.orig 2015-06-04 12:49:19.000000000 +0000
++++ library/Makefile
+@@ -95,7 +95,7 @@ libmbedtls.a: $(OBJS)
+ echo " AR $@"
+ $(AR) rc $@ $(OBJS)
+ echo " RL $@"
+- $(AR) s $@
++ $(RANLIB) $@
+
+ libpolarssl.$(DLEXT): libmbedtls.$(DLEXT)
+ echo " LN $@ -> $?"
diff --git a/security/mbedtls/patches/patch-programs_test_CMakeLists.txt b/security/mbedtls/patches/patch-programs_test_CMakeLists.txt
new file mode 100644
index 00000000000..5eb32f9e6a1
--- /dev/null
+++ b/security/mbedtls/patches/patch-programs_test_CMakeLists.txt
@@ -0,0 +1,14 @@
+$NetBSD: patch-programs_test_CMakeLists.txt,v 1.1 2015/06/12 09:05:05 fhajny Exp $
+
+Make OpenSSL optional.
+
+--- programs/test/CMakeLists.txt.orig 2015-06-04 12:49:19.000000000 +0000
++++ programs/test/CMakeLists.txt
+@@ -1,4 +1,6 @@
+-FIND_PACKAGE(OpenSSL)
++if(ENABLE_TESTING)
++ FIND_PACKAGE(OpenSSL)
++endif(ENABLE_TESTING)
+
+ set(libs
+ mbedtls