Import mbedtls-1.3.16 as security/mbedtls1.

This is based on security/mbedtls and only meant for compatibility
with software that doesn't support mbedtls>=2 yet (mainly requires
the PolarSSL compatibility layer).
This commit is contained in:
fhajny 2016-06-16 09:21:11 +00:00
parent 0622bfc9e7
commit 8da3ce9bdd
9 changed files with 323 additions and 0 deletions

5
security/mbedtls1/DESCR Normal file
View file

@ -0,0 +1,5 @@
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.
This package holds the maintenance 1.3.x branch of mbedtls.

View file

@ -0,0 +1,38 @@
# $NetBSD: Makefile,v 1.1 2016/06/16 09:21:11 fhajny Exp $
#
DISTNAME= mbedtls-1.3.16-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}
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"

118
security/mbedtls1/PLIST Normal file
View file

@ -0,0 +1,118 @@
@comment $NetBSD: PLIST,v 1.1 2016/06/16 09:21:11 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

View file

@ -0,0 +1,20 @@
# $NetBSD: buildlink3.mk,v 1.1 2016/06/16 09:21:11 fhajny Exp $
BUILDLINK_TREE+= mbedtls
.if !defined(MBEDTLS_BUILDLINK3_MK)
MBEDTLS_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.mbedtls+= mbedtls>=0.10.0<2
BUILDLINK_PKGSRCDIR.mbedtls?= ../../security/mbedtls1
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

View file

@ -0,0 +1,9 @@
$NetBSD: distinfo,v 1.1 2016/06/16 09:21:11 fhajny Exp $
SHA1 (mbedtls-1.3.16-gpl.tgz) = 775486e7af1112bbc623f122353e48cb3a8f76a9
RMD160 (mbedtls-1.3.16-gpl.tgz) = a82c58eaed15940c77fa1d84911ba433e351c7d1
SHA512 (mbedtls-1.3.16-gpl.tgz) = bf21e7ece8f609e80fd5f5b1af7f4da1d76e4d38e03cb5a57c9398e43b3186c68f258cceb64ec2f5d0959401956666f77de01cab921a61a9805ca688c61467a1
Size (mbedtls-1.3.16-gpl.tgz) = 1760112 bytes
SHA1 (patch-Makefile) = 80698e16a397133de134ab582016b9e91ad652f0
SHA1 (patch-library_Makefile) = 551854fbdd91ae180f1d5408869a556ff0c39d1a
SHA1 (patch-programs_test_CMakeLists.txt) = 94ce731d81f1584c406e3b295c84fd6a5c327a50

View file

@ -0,0 +1,40 @@
# $NetBSD: options.mk,v 1.1 2016/06/16 09:21:11 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

View file

@ -0,0 +1,64 @@
$NetBSD: patch-Makefile,v 1.1 2016/06/16 09:21:11 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

View file

@ -0,0 +1,15 @@
$NetBSD: patch-library_Makefile,v 1.1 2016/06/16 09:21:11 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 $@ -> $?"

View file

@ -0,0 +1,14 @@
$NetBSD: patch-programs_test_CMakeLists.txt,v 1.1 2016/06/16 09:21:11 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