mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-01-30 16:13:55 +00:00
Updated the code to pull all the files from a swid tag file directory and a rim log file directory, instead of a single file.
This commit is contained in:
parent
bfeff6c867
commit
6eefb393a3
@ -743,18 +743,19 @@ public abstract class AbstractAttestationCertificateAuthority
|
|||||||
Pattern pattern = Pattern.compile("([^\\s]+(\\.(?i)(rimpcr|rimel|bin|log))$)");
|
Pattern pattern = Pattern.compile("([^\\s]+(\\.(?i)(rimpcr|rimel|bin|log))$)");
|
||||||
Matcher matcher;
|
Matcher matcher;
|
||||||
|
|
||||||
if (dv.hasSwidfile()) {
|
if (dv.getSwidfileCount() > 0) {
|
||||||
|
for (ByteString swidFile : dv.getSwidfileList()) {
|
||||||
try {
|
try {
|
||||||
dbBaseRim = BaseReferenceManifest.select(referenceManifestManager)
|
dbBaseRim = BaseReferenceManifest.select(referenceManifestManager)
|
||||||
.includeArchived()
|
.includeArchived()
|
||||||
.byHashCode(Arrays.hashCode(dv.getSwidfile().toByteArray()))
|
.byHashCode(Arrays.hashCode(swidFile.toByteArray()))
|
||||||
.getRIM();
|
.getRIM();
|
||||||
|
|
||||||
if (dbBaseRim == null) {
|
if (dbBaseRim == null) {
|
||||||
dbBaseRim = new BaseReferenceManifest(
|
dbBaseRim = new BaseReferenceManifest(
|
||||||
String.format("%s.swidtag",
|
String.format("%s.swidtag",
|
||||||
clientName),
|
clientName),
|
||||||
dv.getSwidfile().toByteArray());
|
swidFile.toByteArray());
|
||||||
|
|
||||||
BaseReferenceManifest base = (BaseReferenceManifest) dbBaseRim;
|
BaseReferenceManifest base = (BaseReferenceManifest) dbBaseRim;
|
||||||
for (SwidResource swid : base.parseResource()) {
|
for (SwidResource swid : base.parseResource()) {
|
||||||
@ -766,7 +767,7 @@ public abstract class AbstractAttestationCertificateAuthority
|
|||||||
dbBaseRim = new BaseReferenceManifest(
|
dbBaseRim = new BaseReferenceManifest(
|
||||||
String.format("%s.swidtag",
|
String.format("%s.swidtag",
|
||||||
clientName),
|
clientName),
|
||||||
dv.getSwidfile().toByteArray());
|
swidFile.toByteArray());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -782,19 +783,21 @@ public abstract class AbstractAttestationCertificateAuthority
|
|||||||
LOG.error(ioEx);
|
LOG.error(ioEx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (dv.hasLogfile()) {
|
if (dv.getLogfileCount() > 0) {
|
||||||
|
for (ByteString logFile : dv.getLogfileList()) {
|
||||||
try {
|
try {
|
||||||
support = SupportReferenceManifest.select(referenceManifestManager)
|
support = SupportReferenceManifest.select(referenceManifestManager)
|
||||||
.includeArchived()
|
.includeArchived()
|
||||||
.byHashCode(Arrays.hashCode(dv.getLogfile().toByteArray()))
|
.byHashCode(Arrays.hashCode(logFile.toByteArray()))
|
||||||
.getRIM();
|
.getRIM();
|
||||||
|
|
||||||
if (support == null) {
|
if (support == null) {
|
||||||
support = new SupportReferenceManifest(
|
support = new SupportReferenceManifest(
|
||||||
String.format("%s.rimel",
|
String.format("%s.rimel",
|
||||||
clientName),
|
clientName),
|
||||||
dv.getLogfile().toByteArray());
|
logFile.toByteArray());
|
||||||
support.setPlatformManufacturer(dv.getHw().getManufacturer());
|
support.setPlatformManufacturer(dv.getHw().getManufacturer());
|
||||||
support.setPlatformModel(dv.getHw().getProductName());
|
support.setPlatformModel(dv.getHw().getProductName());
|
||||||
support.setTagId(tagId);
|
support.setTagId(tagId);
|
||||||
@ -817,6 +820,7 @@ public abstract class AbstractAttestationCertificateAuthority
|
|||||||
LOG.error(ioEx);
|
LOG.error(ioEx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (dv.hasLivelog()) {
|
if (dv.hasLivelog()) {
|
||||||
fileName = String.format("%s.measurement",
|
fileName = String.format("%s.measurement",
|
||||||
|
@ -54,7 +54,7 @@ if [ -d "$RIM_FILE_LOCATION" ]; then
|
|||||||
echo "tcg.rim.dir=$RIM_FILE_LOCATION" > "$TCG_BOOT_FILE"
|
echo "tcg.rim.dir=$RIM_FILE_LOCATION" > "$TCG_BOOT_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$TAG_FILE_LOCATION" ]; then
|
if [ -d "$SWIDTAG_FILE_LOCATION" ]; then
|
||||||
echo "tcg.swidtag.dir=$SWIDTAG_FILE_LOCATION" >> "$TCG_BOOT_FILE"
|
echo "tcg.swidtag.dir=$SWIDTAG_FILE_LOCATION" >> "$TCG_BOOT_FILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -89,13 +89,21 @@ int provision() {
|
|||||||
const std::string& swid_dir = props.get("tcg.swidtag.dir", "");
|
const std::string& swid_dir = props.get("tcg.swidtag.dir", "");
|
||||||
try {
|
try {
|
||||||
rim_files = hirs::file_utils::search_directory(rim_dir);
|
rim_files = hirs::file_utils::search_directory(rim_dir);
|
||||||
dv.set_logfile(rim_files);
|
for (const auto& rims : rim_files) {
|
||||||
|
if (rims != "") {
|
||||||
|
dv.add_logfile(rims);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (HirsRuntimeException& hirsRuntimeException) {
|
} catch (HirsRuntimeException& hirsRuntimeException) {
|
||||||
logger.error(hirsRuntimeException.what());
|
logger.error(hirsRuntimeException.what());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
swidtag_files = hirs::file_utils::search_directory(swid_dir);
|
swidtag_files = hirs::file_utils::search_directory(swid_dir);
|
||||||
dv.set_swidfile(swidtag_files);
|
for (const auto& swidtag : swidtag_files) {
|
||||||
|
if (swidtag != "") {
|
||||||
|
dv.add_swidfile(swidtag);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (HirsRuntimeException& hirsRuntimeException) {
|
} catch (HirsRuntimeException& hirsRuntimeException) {
|
||||||
logger.error(hirsRuntimeException.what());
|
logger.error(hirsRuntimeException.what());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user