@@ -149,10 +149,10 @@ impl MemoryLayout {
149149
150150 /// Offsets an address in the confidential memory by a given number of bytes. Returns an error if the resulting
151151 /// address is outside the confidential memory region or exceeds the given upper bound.
152- #[ rr:: trust_me ]
152+ #[ rr:: only_spec ]
153153 #[ rr:: ok]
154154 /// Precondition: The offset address is in confidential memory.
155- #[ rr:: requires( "address.2 + offset_in_bytes < self.(conf_end) .2" ) ]
155+ #[ rr:: requires( "address.2 + offset_in_bytes < upper_bound .2" ) ]
156156 /// Precondition: The bounds we are checking are within confidential memory.
157157 #[ rr:: requires( "upper_bound.2 ≤ self.(conf_end).2" ) ]
158158 /// Postcondition: Then we can correctly offset the address and ensure it is in confidential
@@ -162,7 +162,7 @@ impl MemoryLayout {
162162 & self , address : & ConfidentialMemoryAddress , offset_in_bytes : usize , upper_bound : * const usize ,
163163 ) -> Result < ConfidentialMemoryAddress , Error > {
164164 ensure ! ( upper_bound <= self . confidential_memory_end, Error :: AddressNotInConfidentialMemory ( ) ) ?;
165- Ok ( self . confidential_address_at_offset ( address , offset_in_bytes ) ?)
165+ Ok ( address . add ( offset_in_bytes , upper_bound ) . map_err ( |_| Error :: AddressNotInConfidentialMemory ( ) ) ?)
166166 }
167167
168168 /// Offsets an address in the non-confidential memory by given number of bytes. Returns an error if the resulting
@@ -199,8 +199,8 @@ impl MemoryLayout {
199199 // We can safely cast the below offset to usize because the constructor guarantees that the confidential memory
200200 // range is valid, and so the memory size must be a valid usize
201201 let memory_size = ptr_byte_offset ( self . confidential_memory_end , self . confidential_memory_start ) as usize ;
202- let usize_alligned_offsets = ( 0 ..memory_size) . step_by ( core:: mem:: size_of :: < usize > ( ) ) ;
203- usize_alligned_offsets . for_each ( |offset_in_bytes| {
202+ let usize_aligned_offsets = ( 0 ..memory_size) . step_by ( core:: mem:: size_of :: < usize > ( ) ) ;
203+ usize_aligned_offsets . for_each ( |offset_in_bytes| {
204204 let _ = ptr_byte_add_mut ( self . confidential_memory_start , offset_in_bytes, self . confidential_memory_end )
205205 . and_then ( |ptr| Ok ( unsafe { ptr. write_volatile ( 0 ) } ) ) ;
206206 } ) ;
0 commit comments