diff --git a/.gitignore b/.gitignore index dcea8476..b468183f 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ SPECS/ RPM/ SRPM/ PLUGIN_SOURCE/ +*.tar.gz # C++ Files # *.o @@ -131,3 +132,6 @@ HIRS_AttestationCA/src/main/java/hirs/attestationca/configuration/provisionerTpm # these files are copied over by ProvisionerTPM2 CMake build HIRS_ProvisionerTPM2/config/logging.properties HIRS_ProvisionerTPM2/scripts/tpm_aca_provision + +# tcg_rim_tool files +tools/tcg_rim_tool/generated_swidTag.swidtag diff --git a/tools/tcg_rim_tool/package.sh b/tools/tcg_rim_tool/package.sh index a84faf85..d4636949 100755 --- a/tools/tcg_rim_tool/package.sh +++ b/tools/tcg_rim_tool/package.sh @@ -6,8 +6,8 @@ pushd $SCRIPT_DIR name="tcg_rim_tool" -tar -cf $name.tar build.gradle gradle* src/ docs/ rim_fields.json keystore.jks -gzip $name.tar +tar -cf $name.tar build.gradle gradle* src/ docs/ rim_fields.json keystore.jks scripts/ +gzip -f $name.tar if [ -d rpmbuild ]; then rm -rf rpmbuild fi diff --git a/tools/tcg_rim_tool/scripts/rimtool.sh b/tools/tcg_rim_tool/scripts/rimtool.sh new file mode 100644 index 00000000..30e731c1 --- /dev/null +++ b/tools/tcg_rim_tool/scripts/rimtool.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# Calls the the_tcg_rim_tool and passes in parameters +scriptDir=$(dirname -- "$(readlink -f -- "${BASH_SOURCE[0]}")") +baseDir=${scriptDir%/*} +jar="tcg_rim_tool-1.0.jar"; +java -jar $baseDir/$jar "$@" + diff --git a/tools/tcg_rim_tool/src/main/java/hirs/swid/utils/HashSwid.java b/tools/tcg_rim_tool/src/main/java/hirs/swid/utils/HashSwid.java index 1b33f6bf..ca366f6a 100644 --- a/tools/tcg_rim_tool/src/main/java/hirs/swid/utils/HashSwid.java +++ b/tools/tcg_rim_tool/src/main/java/hirs/swid/utils/HashSwid.java @@ -49,7 +49,7 @@ public class HashSwid { } /** - * This method creates the hash based on the provided algorithm and salt + * This method creates the hash based on the provided algorithm * only accessible through helper methods. * * This method assumes an input file that is small enough to read in its @@ -57,7 +57,6 @@ public class HashSwid { * getHashValue() below. * * @param filepath file contents to hash - * @param salt random value to make the hash stronger * @param sha the algorithm to use for the hash * @return */ diff --git a/tools/tcg_rim_tool/src/test/java/hirs/swid/TestSwidTagGateway.java b/tools/tcg_rim_tool/src/test/java/hirs/swid/TestSwidTagGateway.java index 5088f876..9976d4b1 100644 --- a/tools/tcg_rim_tool/src/test/java/hirs/swid/TestSwidTagGateway.java +++ b/tools/tcg_rim_tool/src/test/java/hirs/swid/TestSwidTagGateway.java @@ -39,7 +39,7 @@ public class TestSwidTagGateway { /** * This test corresponds to the arguments: - * -c base -k privateRimKey.pem -p RimSignCert.pem + * -c base -l TpmLog.bin -k privateRimKey.pem -p RimSignCert.pem */ @Test public void testCreateBaseWithCert() throws URISyntaxException { @@ -53,8 +53,7 @@ public class TestSwidTagGateway { /** * This test corresponds to the arguments: - * -c base - * -c base -a + * -c base -l TpmLog.bin */ @Test public void testCreateBaseWithoutCert() { @@ -66,7 +65,7 @@ public class TestSwidTagGateway { /** * This test corresponds to the arguments: - * -v -p RimSignCert.pem + * -v */ @Test public void testValidateSwidTag() { diff --git a/tools/tcg_rim_tool/src/test/resources/generated_no_cert.swidtag b/tools/tcg_rim_tool/src/test/resources/generated_no_cert.swidtag index 8ae83f21..96a73c73 100644 --- a/tools/tcg_rim_tool/src/test/resources/generated_no_cert.swidtag +++ b/tools/tcg_rim_tool/src/test/resources/generated_no_cert.swidtag @@ -1,11 +1,11 @@ - + - + @@ -17,14 +17,14 @@ - h/jXVVy84NklF+ym8qeNfDEohLKKNLhr35iZ6vage7M= + jpPZu16C8KjtwY2JpJuyR3SBc2XclVEaVsv/DgyZKTM= - huu759PPTMaugu+6/c3JAv/Cb6eCiRxK5i5Mx2IpptDDjbDh9P1931KPEivmG8eZHgbGRFDgUviB -qHcvd4A8KpIdx1GfebPBGBVqnAHvIgAQp1ZOMFIjtYsJTFKrwG12Yc7uA8qdGLCXZ8OlEvim3P/9 -VECXziVXAaEdC4IlaAt86XfbK+z5r2hFKSErYJZws45x1oZcBVXo9wZd7x0EyU0rMTGQbV5QbDsP -LOuWmG2t9jlR7Yu7gxJbhFrPJdI/Q6+JsmsnqKB47dVtXCp84lrlZg48S/nZ0OC62EmEHvzilx4C -y2fM/M0LbkZc5Ms8HD92YBsNF3UL3bHxnJT+YQ== + pWPozFWH2oytfgZse1Ai769c/cBFS/vapKj27asI8XDLdK8FkNs2K/+OTf4lScBiPLTCvWPIihoe +hielmV8dWZqvR2z09pr+yCF7q/E8sCGhQXSsVlNZjElMXk2Qz2c6C9XtRk4UNmSfTSYsKEm2AST4 +oh6da+x1CeSHipALfuZZrXwa2AMtc9yTNfqaQFBxRqEDeTypLwNQqdr9va2T8C9ZNnEzooTf5FWw +OUqc+Ewk5V9ZyOJ/0UdUxs40mGPpsIG90ikx59eu1A4qP4BzjHR3vrNbYDA4hBeIpDHC4vzwJrR4 +xqXw1SLqAm8ngL9Haj2Ww+y0PEZfo++JlOMZuQ== 2fdeb8e7d030a2209daa01861a964fedecf2bcc1 diff --git a/tools/tcg_rim_tool/src/test/resources/generated_with_cert.swidtag b/tools/tcg_rim_tool/src/test/resources/generated_with_cert.swidtag index 72e8e2f8..19468ee3 100644 --- a/tools/tcg_rim_tool/src/test/resources/generated_with_cert.swidtag +++ b/tools/tcg_rim_tool/src/test/resources/generated_with_cert.swidtag @@ -1,11 +1,11 @@ - + - + @@ -17,14 +17,14 @@ - h/jXVVy84NklF+ym8qeNfDEohLKKNLhr35iZ6vage7M= + jpPZu16C8KjtwY2JpJuyR3SBc2XclVEaVsv/DgyZKTM= - huu759PPTMaugu+6/c3JAv/Cb6eCiRxK5i5Mx2IpptDDjbDh9P1931KPEivmG8eZHgbGRFDgUviB -qHcvd4A8KpIdx1GfebPBGBVqnAHvIgAQp1ZOMFIjtYsJTFKrwG12Yc7uA8qdGLCXZ8OlEvim3P/9 -VECXziVXAaEdC4IlaAt86XfbK+z5r2hFKSErYJZws45x1oZcBVXo9wZd7x0EyU0rMTGQbV5QbDsP -LOuWmG2t9jlR7Yu7gxJbhFrPJdI/Q6+JsmsnqKB47dVtXCp84lrlZg48S/nZ0OC62EmEHvzilx4C -y2fM/M0LbkZc5Ms8HD92YBsNF3UL3bHxnJT+YQ== + pWPozFWH2oytfgZse1Ai769c/cBFS/vapKj27asI8XDLdK8FkNs2K/+OTf4lScBiPLTCvWPIihoe +hielmV8dWZqvR2z09pr+yCF7q/E8sCGhQXSsVlNZjElMXk2Qz2c6C9XtRk4UNmSfTSYsKEm2AST4 +oh6da+x1CeSHipALfuZZrXwa2AMtc9yTNfqaQFBxRqEDeTypLwNQqdr9va2T8C9ZNnEzooTf5FWw +OUqc+Ewk5V9ZyOJ/0UdUxs40mGPpsIG90ikx59eu1A4qP4BzjHR3vrNbYDA4hBeIpDHC4vzwJrR4 +xqXw1SLqAm8ngL9Haj2Ww+y0PEZfo++JlOMZuQ== CN=example.RIM.signer,OU=PCClient,O=Example,ST=VA,C=US diff --git a/tools/tcg_rim_tool/tcg_rim_tool.spec b/tools/tcg_rim_tool/tcg_rim_tool.spec index 8ffc676a..84230204 100644 --- a/tools/tcg_rim_tool/tcg_rim_tool.spec +++ b/tools/tcg_rim_tool/tcg_rim_tool.spec @@ -10,8 +10,7 @@ Source0: %{name}.tar.gz BuildRequires: java-headless >= 1:1.8.0 %description -This tool will generate a root RIM file for PC clients in accordance with the schema located at http://standards.iso.org/iso/19770/-2/2015/schema.xsd. The generated RIM can either be empty if no arguments are given, or contain a payload if an input file is provided. The tool can also verify a given RIMfile against the schema. Use -h or --help to see a list of commands and uses. - +This tool will generate a base RIM file for PC clients in accordance with the schema located at http://standards.iso.org/iso/19770/-2/2015/schema.xsd. The generated RIM can either be empty if no arguments are given, or contain a payload if an input file is provided. The tool can also verify a given RIMfile against the schema. Use -h or --help to see a list of commands and uses. %prep %setup -q -c -n %{name} @@ -23,15 +22,21 @@ rm -f /opt/hirs/rimtool/%{name}*.jar ./gradlew build %install -mkdir -p %{buildroot}/opt/hirs/rimtool/ +mkdir -p %{buildroot}/opt/hirs/rimtool/ %{buildroot}/usr/local/bin cp build/libs/%{name}-%{version}.jar %{buildroot}/opt/hirs/rimtool/ cp ./rim_fields.json %{buildroot}/opt/hirs/rimtool/ cp ./keystore.jks %{buildroot}/opt/hirs/rimtool/ +cp -r ./scripts/ %{buildroot}/opt/hirs/rimtool/ +ln -sf /opt/hirs/rimtool/scripts/rimtool.sh %{buildroot}/usr/local/bin/rim %files /opt/hirs/rimtool/%{name}-%{version}.jar /opt/hirs/rimtool/rim_fields.json /opt/hirs/rimtool/keystore.jks +/opt/hirs/rimtool/scripts +/usr/local/bin/rim + +%attr(755, root, root) /opt/hirs/rimtool/scripts/rimtool.sh %changelog * Mon Jun 15 2020 chubtub