@@ -43,10 +43,7 @@ contract KmsAuth is
4343 mapping (bytes32 => bool ) public kmsAllowedDeviceIds;
4444
4545 // Mapping of allowed image measurements
46- mapping (bytes32 => bool ) public appAllowedImages;
47-
48- // Mapping of allowed KMS compose hashes
49- mapping (bytes32 => bool ) public appAllowedSystemMrs;
46+ mapping (bytes32 => bool ) public allowedOsImages;
5047
5148 // Sequence number for app IDs - per user
5249 mapping (address => uint256 ) public nextAppSequence;
@@ -58,10 +55,8 @@ contract KmsAuth is
5855 event KmsAggregatedMrRemoved (bytes32 mrAggregated );
5956 event KmsDeviceAdded (bytes32 deviceId );
6057 event KmsDeviceRemoved (bytes32 deviceId );
61- event AppImageMrAdded (bytes32 mrImage );
62- event AppImageMrRemoved (bytes32 mrImage );
63- event AppSystemMrAdded (bytes32 mrSystem );
64- event AppSystemMrRemoved (bytes32 mrSystem );
58+ event OsImageHashAdded (bytes32 osImageHash );
59+ event OsImageHashRemoved (bytes32 osImageHash );
6560 event GatewayAppIdSet (string gatewayAppId );
6661
6762 /// @custom:oz-upgrades-unsafe-allow constructor
@@ -150,27 +145,15 @@ contract KmsAuth is
150145 }
151146
152147 // Function to register an image measurement
153- function addAppImageMr (bytes32 mrImage ) external onlyOwner {
154- appAllowedImages[mrImage ] = true ;
155- emit AppImageMrAdded (mrImage );
148+ function addOsImageHash (bytes32 osImageHash ) external onlyOwner {
149+ allowedOsImages[osImageHash ] = true ;
150+ emit OsImageHashAdded (osImageHash );
156151 }
157152
158153 // Function to deregister an image measurement
159- function removeAppImageMr (bytes32 mrImage ) external onlyOwner {
160- appAllowedImages[mrImage] = false ;
161- emit AppImageMrRemoved (mrImage);
162- }
163-
164- // Function to register a system MR measurement
165- function addAppSystemMr (bytes32 mrSystem ) external onlyOwner {
166- appAllowedSystemMrs[mrSystem] = true ;
167- emit AppSystemMrAdded (mrSystem);
168- }
169-
170- // Function to deregister a system MR measurement
171- function removeAppSystemMr (bytes32 mrSystem ) external onlyOwner {
172- appAllowedSystemMrs[mrSystem] = false ;
173- emit AppSystemMrRemoved (mrSystem);
154+ function removeOsImageHash (bytes32 osImageHash ) external onlyOwner {
155+ allowedOsImages[osImageHash] = false ;
156+ emit OsImageHashRemoved (osImageHash);
174157 }
175158
176159 // Function to check if KMS is allowed to boot
@@ -185,6 +168,11 @@ contract KmsAuth is
185168 return (false , "TCB status is not up to date " );
186169 }
187170
171+ // Check if the OS image is allowed
172+ if (! allowedOsImages[bootInfo.osImageHash]) {
173+ return (false , "OS image is not allowed " );
174+ }
175+
188176 // Check if the aggregated MR is allowed
189177 if (! kmsAllowedAggregatedMrs[bootInfo.mrAggregated]) {
190178 return (false , "Aggregated MR not allowed " );
@@ -208,11 +196,8 @@ contract KmsAuth is
208196 }
209197
210198 // Check aggregated MR and image measurements
211- if (
212- ! appAllowedSystemMrs[bootInfo.mrSystem] &&
213- ! appAllowedImages[bootInfo.mrImage]
214- ) {
215- return (false , "Neither system MR nor image is allowed " );
199+ if (! allowedOsImages[bootInfo.osImageHash]) {
200+ return (false , "OS image is not allowed " );
216201 }
217202
218203 // Ask the app controller if the app is allowed to boot
0 commit comments