Index: head/security/tpm-tools/Makefile =================================================================== --- head/security/tpm-tools/Makefile (revision 494474) +++ head/security/tpm-tools/Makefile (revision 494475) @@ -1,32 +1,34 @@ # Created by: Sebastian Schuetz # $FreeBSD$ PORTNAME= tpm-tools -PORTVERSION= 1.3.8 +PORTVERSION= 1.3.9.1 CATEGORIES= security MASTER_SITES= SF/trousers/${PORTNAME}/${PORTVERSION} MAINTAINER= hrs@FreeBSD.org COMMENT= Provides a basic set of TPM tools LICENSE= CPL LICENSE_NAME= Common Public License LICENSE_FILE= ${WRKSRC}/LICENSE LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept LIB_DEPENDS= libtspi.so:security/trousers -BUILD_DEPENDS= pkcsconf:security/opencryptoki +BUILD_DEPENDS= ${LOCALBASE}/sbin/pkcsconf:security/opencryptoki RUN_DEPENDS= ${LOCALBASE}/sbin/tcsd:security/trousers \ ${LOCALBASE}/lib/pkcs11/libopencryptoki.so:security/opencryptoki -USES= gettext gmake iconv libtool +USES= autoreconf gettext gmake iconv libtool ssl USE_LDCONFIG= YES + +NO_WRKSUBDIR= YES GNU_CONFIGURE= YES LIBS+= -L${LOCALBASE}/lib -lintl INSTALL_TARGET= install-strip post-patch: @${REINPLACE_CMD} '/^libtpm_unseal_la_LIBADD =/s/$$/ -lcrypto/' \ ${WRKSRC}/lib/Makefile.in .include Index: head/security/tpm-tools/distinfo =================================================================== --- head/security/tpm-tools/distinfo (revision 494474) +++ head/security/tpm-tools/distinfo (revision 494475) @@ -1,3 +1,3 @@ -TIMESTAMP = 1463578786 -SHA256 (tpm-tools-1.3.8.tar.gz) = 66eb4ff095542403db6b4bd4b574e8a5c08084fe4e9e5aa9a829ee84e20bea83 -SIZE (tpm-tools-1.3.8.tar.gz) = 473339 +TIMESTAMP = 1551571411 +SHA256 (tpm-tools-1.3.9.1.tar.gz) = 9cb714e2650826e2e932f65bc0ba9d61b927dc5fea47f2c2a2b64f0fdfcbfa68 +SIZE (tpm-tools-1.3.9.1.tar.gz) = 482859 Index: head/security/tpm-tools/files/patch-src-cmds-Makefile.am =================================================================== --- head/security/tpm-tools/files/patch-src-cmds-Makefile.am (revision 494474) +++ head/security/tpm-tools/files/patch-src-cmds-Makefile.am (nonexistent) @@ -1,11 +0,0 @@ ---- src/cmds/Makefile.am.orig 2011-08-15 17:52:08 UTC -+++ src/cmds/Makefile.am -@@ -30,7 +30,7 @@ else - AM_CPPFLAGS = -I$(top_srcdir)/include -D_LINUX - endif - --LDADD = $(top_builddir)/lib/libtpm_tspi.la -ltspi $(top_builddir)/lib/libtpm_unseal.la -ltpm_unseal -lcrypto -+LDADD = $(top_builddir)/lib/libtpm_tspi.la -ltspi $(top_builddir)/lib/libtpm_unseal.la -lcrypto - - tpm_sealdata_SOURCES = tpm_sealdata.c - tpm_unsealdata_SOURCES = tpm_unsealdata.c Property changes on: head/security/tpm-tools/files/patch-src-cmds-Makefile.am ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/security/tpm-tools/files/patch-src-data_mgmt-Makefile.in =================================================================== --- head/security/tpm-tools/files/patch-src-data_mgmt-Makefile.in (revision 494474) +++ head/security/tpm-tools/files/patch-src-data_mgmt-Makefile.in (nonexistent) @@ -1,11 +0,0 @@ ---- src/data_mgmt/Makefile.in.orig 2012-05-17 19:09:27 UTC -+++ src/data_mgmt/Makefile.in -@@ -274,7 +274,7 @@ noinst_HEADERS = data_common.h \ - # - # Common build flags - AM_CPPFLAGS = -I$(top_srcdir)/include -D_LINUX --LDADD = $(top_builddir)/lib/libtpm_pkcs11.la -ltspi -ldl -+LDADD = $(top_builddir)/lib/libtpm_pkcs11.la -ltspi - - # - # TPM Token initialization command Property changes on: head/security/tpm-tools/files/patch-src-data_mgmt-Makefile.in ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/security/tpm-tools/files/patch-src-cmds-Makefile.in =================================================================== --- head/security/tpm-tools/files/patch-src-cmds-Makefile.in (revision 494474) +++ head/security/tpm-tools/files/patch-src-cmds-Makefile.in (nonexistent) @@ -1,11 +0,0 @@ ---- src/cmds/Makefile.in.orig 2012-05-17 19:09:27 UTC -+++ src/cmds/Makefile.in -@@ -245,7 +245,7 @@ top_builddir = @top_builddir@ - top_srcdir = @top_srcdir@ - @TSS_LIB_IS_12_FALSE@AM_CPPFLAGS = -I$(top_srcdir)/include -D_LINUX - @TSS_LIB_IS_12_TRUE@AM_CPPFLAGS = -I$(top_srcdir)/include -D_LINUX -DTSS_LIB_IS_12 --LDADD = $(top_builddir)/lib/libtpm_tspi.la -ltspi $(top_builddir)/lib/libtpm_unseal.la -ltpm_unseal -lcrypto -+LDADD = $(top_builddir)/lib/libtpm_tspi.la -ltspi $(top_builddir)/lib/libtpm_unseal.la -lcrypto - tpm_sealdata_SOURCES = tpm_sealdata.c - tpm_unsealdata_SOURCES = tpm_unsealdata.c - all: all-am Property changes on: head/security/tpm-tools/files/patch-src-cmds-Makefile.in ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/security/tpm-tools/files/patch-lib-Makefile.in =================================================================== --- head/security/tpm-tools/files/patch-lib-Makefile.in (revision 494474) +++ head/security/tpm-tools/files/patch-lib-Makefile.in (nonexistent) @@ -1,20 +0,0 @@ ---- lib/Makefile.in.orig 2012-05-17 19:09:27 UTC -+++ lib/Makefile.in -@@ -298,7 +298,7 @@ libtpm_utils_la_SOURCES = tpm_utils.c \ - # - # TSPI interface library - libtpm_tspi_la_SOURCES = tpm_tspi.c --libtpm_tspi_la_LIBADD = libtpm_utils.la -ldl -+libtpm_tspi_la_LIBADD = libtpm_utils.la - @P11_SUPPORT_TRUE@libtpm_pkcs11_la_SOURCES = tpm_pkcs11.c - @P11_SUPPORT_TRUE@libtpm_pkcs11_la_LIBADD = libtpm_utils.la - -@@ -327,7 +327,7 @@ libtpm_tspi_la_LIBADD = libtpm_utils.la - # Unseal library - for addition to existing apps, counter part of seal cmd - libtpm_unseal_la_SOURCES = tpm_unseal.c - libtpm_unseal_la_LDFLAGS = -shared -version-info 1:0:0 --libtpm_unseal_la_LIBADD = -ltspi libtpm_tspi.la -+libtpm_unseal_la_LIBADD = -ltspi libtpm_tspi.la -lcrypto - all: all-am - - .SUFFIXES: Property changes on: head/security/tpm-tools/files/patch-lib-Makefile.in ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/security/tpm-tools/files/patch-lib-Makefile.am =================================================================== --- head/security/tpm-tools/files/patch-lib-Makefile.am (revision 494474) +++ head/security/tpm-tools/files/patch-lib-Makefile.am (revision 494475) @@ -1,11 +1,11 @@ ---- lib/Makefile.am.orig 2012-05-17 17:50:39 UTC +--- lib/Makefile.am.orig 2017-02-21 02:23:56 UTC +++ lib/Makefile.am @@ -44,7 +44,7 @@ libtpm_utils_la_SOURCES = tpm_utils.c \ # # TSPI interface library libtpm_tspi_la_SOURCES = tpm_tspi.c --libtpm_tspi_la_LIBADD = libtpm_utils.la -ldl -+libtpm_tspi_la_LIBADD = libtpm_utils.la +-libtpm_tspi_la_LIBADD = libtpm_utils.la -ldl @INTLLIBS@ ++libtpm_tspi_la_LIBADD = libtpm_utils.la @INTLLIBS@ # # PKCS#11 interface library Index: head/security/tpm-tools/files/patch-lib-tpm_utils.c =================================================================== --- head/security/tpm-tools/files/patch-lib-tpm_utils.c (revision 494474) +++ head/security/tpm-tools/files/patch-lib-tpm_utils.c (revision 494475) @@ -1,47 +1,46 @@ ---- lib/tpm_utils.c.orig 2010-09-30 17:28:09 UTC +--- lib/tpm_utils.c.orig 2017-02-21 01:23:56 UTC +++ lib/tpm_utils.c -@@ -55,6 +55,7 @@ genericOptHandler( int a_iNumArgs, char +@@ -55,6 +55,7 @@ genericOptHandler( int a_iNumArgs, char **a_pszArgs, CmdHelpFunction tCmdHelp = ( a_tCmdHelpFunction ) ? a_tCmdHelpFunction : logCmdHelp; +#ifdef __GCC char szShortOpts[strlen( pszGenShortOpts ) + ( ( a_pszShortOpts == NULL ) ? 0 : strlen( a_pszShortOpts ) ) + 1]; -@@ -64,12 +65,36 @@ genericOptHandler( int a_iNumArgs, char +@@ -64,12 +65,35 @@ genericOptHandler( int a_iNumArgs, char **a_pszArgs, int iOpt; int rc; +#else + int iOpt; + int rc; -+ + + char *szShortOpts; + int iNumShortOpts, iNumGenLongOpts; + struct option *sLongOpts; + + iNumShortOpts = strlen( pszGenShortOpts ) + -+ ( ( a_pszShortOpts == NULL ) ? 0 : strlen( a_pszShortOpts ) ); ++ ( ( a_pszShortOpts == NULL ) ? 0 : strlen( a_pszShortOpts ) ); + iNumGenLongOpts = sizeof( sGenLongOpts ) / sizeof( struct option ); + + szShortOpts = malloc(iNumShortOpts + 1); -+ sLongOpts = malloc((iNumGenLongOpts + a_iNumOpts + 1) -+ * sizeof(struct option)); ++ sLongOpts = malloc((iNumGenLongOpts + a_iNumOpts + 1) ++ * sizeof(struct option)); + if( (szShortOpts == NULL) || (sLongOpts == NULL) ) { + perror("malloc"); + return -1; + } +#endif - strcpy( szShortOpts, pszGenShortOpts); if ( a_pszShortOpts ) strcat( szShortOpts, a_pszShortOpts ); +#ifdef __GCC - memset( sLongOpts, 0, sizeof( sLongOpts ) ); + __memset( sLongOpts, 0, sizeof( sLongOpts ) ); +#else -+ memset( sLongOpts, 0, (iNumGenLongOpts + a_iNumOpts + 1) * sizeof(struct option)); ++ __memset( sLongOpts, 0, (iNumGenLongOpts + a_iNumOpts + 1) * sizeof(struct option)); +#endif memcpy( sLongOpts, sGenLongOpts, sizeof( sGenLongOpts ) ); if ( a_sLongOpts ) { memcpy( sLongOpts + iNumGenLongOpts, Index: head/security/tpm-tools/files/patch-src-data_mgmt-Makefile.am =================================================================== --- head/security/tpm-tools/files/patch-src-data_mgmt-Makefile.am (revision 494474) +++ head/security/tpm-tools/files/patch-src-data_mgmt-Makefile.am (revision 494475) @@ -1,11 +1,11 @@ ---- src/data_mgmt/Makefile.am.orig 2012-05-17 17:50:29 UTC +--- src/data_mgmt/Makefile.am.orig 2017-02-21 01:23:57 UTC +++ src/data_mgmt/Makefile.am @@ -38,7 +38,7 @@ noinst_HEADERS = data_common.h \ # Common build flags AM_CPPFLAGS = -I$(top_srcdir)/include -D_LINUX --LDADD = $(top_builddir)/lib/libtpm_pkcs11.la -ltspi -ldl -+LDADD = $(top_builddir)/lib/libtpm_pkcs11.la -ltspi +-LDADD = $(top_builddir)/lib/libtpm_pkcs11.la -ltspi -ldl @INTLLIBS@ ++LDADD = $(top_builddir)/lib/libtpm_pkcs11.la -ltspi @INTLLIBS@ # Index: head/security/tpm-tools/files/patch-src-data_mgmt-data_import.c =================================================================== --- head/security/tpm-tools/files/patch-src-data_mgmt-data_import.c (nonexistent) +++ head/security/tpm-tools/files/patch-src-data_mgmt-data_import.c (revision 494475) @@ -0,0 +1,79 @@ +--- src/data_mgmt/data_import.c.orig 2017-02-21 02:12:00 UTC ++++ src/data_mgmt/data_import.c +@@ -372,7 +372,7 @@ readX509Cert( const char *a_pszFile, + goto out; + } + +- if ( EVP_PKEY_type( pKey->type ) != EVP_PKEY_RSA ) { ++ if ( EVP_PKEY_type( EVP_PKEY_id(pKey) ) != EVP_PKEY_RSA ) { + logError( TOKEN_RSA_KEY_ERROR ); + + X509_free( pX509 ); +@@ -691,8 +691,8 @@ createRsaPubKeyObject( RSA *a_pRsa, + + int rc = -1; + +- int nLen = BN_num_bytes( a_pRsa->n ); +- int eLen = BN_num_bytes( a_pRsa->e ); ++ int nLen = BN_num_bytes( RSA_get0_n(a_pRsa) ); ++ int eLen = BN_num_bytes( RSA_get0_e(a_pRsa) ); + + CK_RV rv; + +@@ -732,8 +732,8 @@ createRsaPubKeyObject( RSA *a_pRsa, + } + + // Get binary representations of the RSA key information +- BN_bn2bin( a_pRsa->n, n ); +- BN_bn2bin( a_pRsa->e, e ); ++ BN_bn2bin( RSA_get0_n(a_pRsa), n ); ++ BN_bn2bin( RSA_get0_e(a_pRsa), e ); + + // Create the RSA public key object + rv = createObject( a_hSession, tAttr, ulAttrCount, a_hObject ); +@@ -760,14 +760,14 @@ createRsaPrivKeyObject( RSA *a_pRsa, + + int rc = -1; + +- int nLen = BN_num_bytes( a_pRsa->n ); +- int eLen = BN_num_bytes( a_pRsa->e ); +- int dLen = BN_num_bytes( a_pRsa->d ); +- int pLen = BN_num_bytes( a_pRsa->p ); +- int qLen = BN_num_bytes( a_pRsa->q ); +- int dmp1Len = BN_num_bytes( a_pRsa->dmp1 ); +- int dmq1Len = BN_num_bytes( a_pRsa->dmq1 ); +- int iqmpLen = BN_num_bytes( a_pRsa->iqmp ); ++ int nLen = BN_num_bytes( RSA_get0_n(a_pRsa) ); ++ int eLen = BN_num_bytes( RSA_get0_e(a_pRsa) ); ++ int dLen = BN_num_bytes( RSA_get0_d(a_pRsa) ); ++ int pLen = BN_num_bytes( RSA_get0_p(a_pRsa) ); ++ int qLen = BN_num_bytes( RSA_get0_q(a_pRsa) ); ++ int dmp1Len = BN_num_bytes( RSA_get0_dmp1(a_pRsa) ); ++ int dmq1Len = BN_num_bytes( RSA_get0_dmq1(a_pRsa) ); ++ int iqmpLen = BN_num_bytes( RSA_get0_iqmp(a_pRsa) ); + + CK_RV rv; + +@@ -821,14 +821,14 @@ createRsaPrivKeyObject( RSA *a_pRsa, + } + + // Get binary representations of the RSA key information +- BN_bn2bin( a_pRsa->n, n ); +- BN_bn2bin( a_pRsa->e, e ); +- BN_bn2bin( a_pRsa->d, d ); +- BN_bn2bin( a_pRsa->p, p ); +- BN_bn2bin( a_pRsa->q, q ); +- BN_bn2bin( a_pRsa->dmp1, dmp1 ); +- BN_bn2bin( a_pRsa->dmq1, dmq1 ); +- BN_bn2bin( a_pRsa->iqmp, iqmp ); ++ BN_bn2bin( RSA_get0_n(a_pRsa), n ); ++ BN_bn2bin( RSA_get0_e(a_pRsa), e ); ++ BN_bn2bin( RSA_get0_d(a_pRsa), d ); ++ BN_bn2bin( RSA_get0_p(a_pRsa), p ); ++ BN_bn2bin( RSA_get0_q(a_pRsa), q ); ++ BN_bn2bin( RSA_get0_dmp1(a_pRsa), dmp1 ); ++ BN_bn2bin( RSA_get0_dmq1(a_pRsa), dmq1 ); ++ BN_bn2bin( RSA_get0_iqmp(a_pRsa), iqmp ); + + // Create the RSA private key object + rv = createObject( a_hSession, tAttr, ulAttrCount, a_hObject ); Property changes on: head/security/tpm-tools/files/patch-src-data_mgmt-data_import.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/security/tpm-tools/files/patch-src-tpm_mgmt-tpm_nvcommon.c =================================================================== --- head/security/tpm-tools/files/patch-src-tpm_mgmt-tpm_nvcommon.c (revision 494474) +++ head/security/tpm-tools/files/patch-src-tpm_mgmt-tpm_nvcommon.c (revision 494475) @@ -1,24 +1,24 @@ ---- src/tpm_mgmt/tpm_nvcommon.c.orig 2011-08-17 12:20:35 UTC +--- src/tpm_mgmt/tpm_nvcommon.c.orig 2017-02-21 01:23:57 UTC +++ src/tpm_mgmt/tpm_nvcommon.c -@@ -140,8 +140,8 @@ int parseStringWithValues(const char *aA +@@ -140,8 +140,8 @@ int parseStringWithValues(const char *aArg, aArg); return -1; } -- if (!aArg[offset+numbytes] == '|' && -- !aArg[offset+numbytes] == 0) { -+ if (aArg[offset+numbytes] != '|' && +- if (aArg[offset+numbytes] == '|' || +- aArg[offset+numbytes] == 0) { ++ if (aArg[offset+numbytes] != '|' || + aArg[offset+numbytes] != 0) { logError(_("Illegal character following " "hexadecimal number in %s\n"), aArg + offset); -@@ -164,8 +164,8 @@ int parseStringWithValues(const char *aA +@@ -164,8 +164,8 @@ int parseStringWithValues(const char *aArg, return -1; } - if (!aArg[offset+numbytes] == '|' && - !aArg[offset+numbytes] == 0) { + if (aArg[offset+numbytes] != '|' && + aArg[offset+numbytes] != 0) { logError(_("Illegal character following decimal " "number in %s\n"), aArg + offset); Index: head/security/tpm-tools/files/patch-src-tpm_mgmt-tpm_nvwrite.c =================================================================== --- head/security/tpm-tools/files/patch-src-tpm_mgmt-tpm_nvwrite.c (revision 494474) +++ head/security/tpm-tools/files/patch-src-tpm_mgmt-tpm_nvwrite.c (revision 494475) @@ -1,27 +1,27 @@ ---- src/tpm_mgmt/tpm_nvwrite.c.orig 2011-08-17 12:20:35 UTC +--- src/tpm_mgmt/tpm_nvwrite.c.orig 2017-02-21 01:23:57 UTC +++ src/tpm_mgmt/tpm_nvwrite.c @@ -33,6 +33,7 @@ static BOOL nvindex_set; static unsigned int nvindex; static unsigned int offset; static unsigned int length; +static int lengthp; static int fillvalue = -1; static const char *filename; static BOOL passWellKnown; -@@ -60,6 +61,7 @@ static int parse(const int aOpt, const c +@@ -60,6 +61,7 @@ static int parse(const int aOpt, const char *aArg) if (parseHexOrDecimal(aArg, &length, 0, UINT_MAX, "length of data") != 0) return -1; + lengthp = 1; break; case 'n': @@ -220,7 +222,7 @@ int main(int argc, char **argv) close(fd); fd = -1; } else if (fillvalue >= 0) { - if (length < 0) { + if (lengthp == 0) { logError(_("Requiring size parameter.\n")); return -1; } Index: head/security/tpm-tools/files/patch-src-tpm_mgmt-tpm_present.c =================================================================== --- head/security/tpm-tools/files/patch-src-tpm_mgmt-tpm_present.c (revision 494474) +++ head/security/tpm-tools/files/patch-src-tpm_mgmt-tpm_present.c (revision 494475) @@ -1,14 +1,14 @@ ---- src/tpm_mgmt/tpm_present.c.orig 2012-05-17 17:49:58 UTC +--- src/tpm_mgmt/tpm_present.c.orig 2017-02-21 01:23:57 UTC +++ src/tpm_mgmt/tpm_present.c -@@ -168,9 +168,10 @@ static BOOL confirmLifeLock(TSS_HCONTEXT +@@ -168,9 +168,10 @@ static BOOL confirmLifeLock(TSS_HCONTEXT hContext, TSS TSS_HPOLICY hTpmPolicy; char *pwd = NULL; int pswd_len; - char rsp[5]; + char rsp[6]; int scanCount; + memset(&hTpmPolicy, 0, sizeof(hTpmPolicy)); //get status w/o owner auth (FAILS 1.1, should PASS 1.2) if (tpmGetStatus(hTpm, flags[cmdEnable].property, &bCmd) != TSS_SUCCESS