try {
tblMle = getMleDetails(pcrData.getMleName(),
pcrData.getMleVersion(), pcrData.getOsName(),
pcrData.getOsVersion(), pcrData.getOemName());
if (tblMle == null && pcrData.getOemName() != null) {
throw new ASException(ErrorCode.WS_MLE_OEM_DOES_NOT_EXIST, pcrData.getMleName(), pcrData.getMleVersion(), pcrData.getOemName());
}
if (tblMle == null && pcrData.getOsName() != null) {
throw new ASException(ErrorCode.WS_MLE_OS_DOES_NOT_EXIST, pcrData.getMleName(), pcrData.getMleVersion(), pcrData.getOsName(),pcrData.getOsVersion());
}
// Now we need to check if PCR is already configured. If yes, then
// we ned to ask the user to use the Update option instead of create
tblPcr = getPCRWhiteListDetails(tblMle.getId(), pcrData.getPcrName());
if (tblPcr != null) {
throw new ASException(ErrorCode.WS_PCR_WHITELIST_ALREADY_EXISTS, pcrData.getPcrName());
}
/*
if (StringUtils.isNotBlank(pcrData.getOemName())) {
log.info("BIOS MLE, check the range of PCR value " + pcrData.getPcrName());
if (Integer.valueOf(pcrData.getPcrName()).intValue() > 5 || Integer.valueOf(pcrData.getPcrName()).intValue() < 0)
throw new ASException(ErrorCode.WS_MLE_PCR_NOT_VALID, pcrData.getPcrName());
} else {
log.info("VMM MLE, check the range of PCR value " + pcrData.getPcrName());
if (Integer.valueOf(pcrData.getPcrName()).intValue() > 20 || Integer.valueOf(pcrData.getPcrName()).intValue() < 17)
throw new ASException(ErrorCode.WS_MLE_PCR_NOT_VALID, pcrData.getPcrName());
} */
// In order to reuse the addPCRManifest function, we need to create a list and
// add a single entry into it using the manifest data that we got.
List<ManifestData> pcrWhiteList = new ArrayList<ManifestData>();
pcrWhiteList.add(new ManifestData(pcrData.getPcrName(), pcrData.getPcrDigest()));
// Now add the pcr to the database.
addPcrManifest(tblMle, pcrWhiteList);
} catch (ASException ase) {
throw ase;
} catch (Exception e) {
throw new ASException(e);
}
return "true";
}