@@ -221,9 +221,9 @@ static int encrypted_file_internal_open(struct libos_encrypted_file* enc, PAL_HA
221
221
ret = - EACCES ;
222
222
goto out ;
223
223
}
224
- pf_mac_t opening_root_gmac ;
224
+ pf_mac_t opening_root_mac ;
225
225
pf_status_t pfs = pf_open (pal_handle , norm_path , size , PF_FILE_MODE_READ | PF_FILE_MODE_WRITE ,
226
- create , & enc -> volume -> key -> pf_key , & opening_root_gmac , & pf );
226
+ create , & enc -> volume -> key -> pf_key , & opening_root_mac , & pf );
227
227
unlock (& g_keys_lock );
228
228
if (PF_FAILURE (pfs )) {
229
229
log_warning ("pf_open failed: %s" , pf_strerror (pfs ));
@@ -233,7 +233,7 @@ static int encrypted_file_internal_open(struct libos_encrypted_file* enc, PAL_HA
233
233
/* rollback protection */
234
234
struct libos_encrypted_volume_state_map * file_state = NULL ;
235
235
log_debug ("file '%s' opened with MAC=" MAC_PRINTF_PATTERN , norm_path ,
236
- MAC_PRINTF_ARGS (opening_root_gmac )); // TODO (MST): remove me eventually?
236
+ MAC_PRINTF_ARGS (opening_root_mac )); // TODO (MST): remove me eventually?
237
237
lock (& (enc -> volume -> files_state_map_lock ));
238
238
/* - get current state */
239
239
HASH_FIND_STR (enc -> volume -> files_state_map , norm_path , file_state );
@@ -259,14 +259,14 @@ static int encrypted_file_internal_open(struct libos_encrypted_file* enc, PAL_HA
259
259
goto out_unlock_map ;
260
260
}
261
261
}
262
- if (memcmp (file_state -> last_seen_root_gmac , opening_root_gmac , sizeof (pf_mac_t )) != 0 ) {
262
+ if (memcmp (file_state -> last_seen_root_mac , opening_root_mac , sizeof (pf_mac_t )) != 0 ) {
263
263
log_error (
264
264
"file '%s' was seen before but in different inconsistent (rolled-back?) "
265
265
"state, expected MAC=" MAC_PRINTF_PATTERN
266
266
" but file had "
267
267
"MAC=" MAC_PRINTF_PATTERN ,
268
- norm_path , MAC_PRINTF_ARGS (file_state -> last_seen_root_gmac ),
269
- MAC_PRINTF_ARGS (opening_root_gmac ));
268
+ norm_path , MAC_PRINTF_ARGS (file_state -> last_seen_root_mac ),
269
+ MAC_PRINTF_ARGS (opening_root_mac ));
270
270
if (enc -> volume -> protection_mode != PF_ENCLAVE_LIFE_RB_PROTECTION_NONE ) {
271
271
pf_set_corrupted (pf );
272
272
ret = - EACCES ;
@@ -299,7 +299,7 @@ static int encrypted_file_internal_open(struct libos_encrypted_file* enc, PAL_HA
299
299
}
300
300
/* we do below unconditionally as we might recreate a deleted file or overwrite an existing
301
301
* one */
302
- memcpy (file_state -> last_seen_root_gmac , opening_root_gmac , sizeof (pf_mac_t ));
302
+ memcpy (file_state -> last_seen_root_mac , opening_root_mac , sizeof (pf_mac_t ));
303
303
file_state -> state = PF_FILE_STATE_ACTIVE ;
304
304
305
305
enc -> pf = pf ;
@@ -335,16 +335,16 @@ int parse_pf_key(const char* key_str, pf_key_t* pf_key) {
335
335
336
336
static void encrypted_file_internal_close (struct libos_encrypted_file * enc , bool fs_reachable ) {
337
337
assert (enc -> pf );
338
- pf_mac_t closing_root_gmac ;
339
- pf_status_t pfs = pf_close (enc -> pf , & closing_root_gmac );
338
+ pf_mac_t closing_root_mac ;
339
+ pf_status_t pfs = pf_close (enc -> pf , & closing_root_mac );
340
340
char * norm_path = NULL ;
341
341
int ret = uri_to_normalized_path (enc -> uri , & norm_path );
342
342
if (ret < 0 ) {
343
343
log_error ("Could not normalize uri %s while closing file (ret=%d)" , enc -> uri , ret );
344
344
} else {
345
345
log_debug ("%sreachable file '%s' closed with MAC=" MAC_PRINTF_PATTERN ,
346
346
(fs_reachable ? "" : "un" ), norm_path ,
347
- MAC_PRINTF_ARGS (closing_root_gmac )); // TODO (MST): remove me eventually?
347
+ MAC_PRINTF_ARGS (closing_root_mac )); // TODO (MST): remove me eventually?
348
348
lock (& (enc -> volume -> files_state_map_lock ));
349
349
struct libos_encrypted_volume_state_map * file_state = NULL ;
350
350
@@ -359,7 +359,7 @@ static void encrypted_file_internal_close(struct libos_encrypted_file* enc, bool
359
359
/* note: we only update if reachable in fileystem to prevent file-handles made
360
360
* unreachable via unlink or rename to modify state. We also do not touch it if
361
361
* earlier we determined this file is in inconsistent error state. */
362
- memcpy (file_state -> last_seen_root_gmac , closing_root_gmac , sizeof (pf_mac_t ));
362
+ memcpy (file_state -> last_seen_root_mac , closing_root_mac , sizeof (pf_mac_t ));
363
363
}
364
364
}
365
365
unlock (& (enc -> volume -> files_state_map_lock ));
@@ -818,8 +818,8 @@ int encrypted_file_rename(struct libos_encrypted_file* enc, const char* new_uri)
818
818
if (ret < 0 )
819
819
goto out ;
820
820
821
- pf_mac_t new_root_gmac ;
822
- pf_status_t pfs = pf_rename (enc -> pf , new_norm_path , & new_root_gmac );
821
+ pf_mac_t new_root_mac ;
822
+ pf_status_t pfs = pf_rename (enc -> pf , new_norm_path , & new_root_mac );
823
823
if (PF_FAILURE (pfs )) {
824
824
log_warning ("pf_rename failed: %s" , pf_strerror (pfs ));
825
825
ret = - EACCES ;
@@ -831,7 +831,7 @@ int encrypted_file_rename(struct libos_encrypted_file* enc, const char* new_uri)
831
831
log_warning ("PalStreamChangeName failed: %s" , pal_strerror (ret ));
832
832
833
833
/* We failed to rename the file. Try to restore the name in header. */
834
- pfs = pf_rename (enc -> pf , old_norm_path , & new_root_gmac );
834
+ pfs = pf_rename (enc -> pf , old_norm_path , & new_root_mac );
835
835
if (PF_FAILURE (pfs )) {
836
836
log_warning ("pf_rename (during cleanup) failed, the file might be unusable: %s" ,
837
837
pf_strerror (pfs ));
@@ -843,7 +843,7 @@ int encrypted_file_rename(struct libos_encrypted_file* enc, const char* new_uri)
843
843
/* update file state map */
844
844
log_debug ("file '%s' renamed to '%s' with MAC=" MAC_PRINTF_PATTERN , old_norm_path ,
845
845
new_norm_path ,
846
- MAC_PRINTF_ARGS (new_root_gmac )); // TODO (MST): remove me eventually?
846
+ MAC_PRINTF_ARGS (new_root_mac )); // TODO (MST): remove me eventually?
847
847
lock (& (enc -> volume -> files_state_map_lock ));
848
848
struct libos_encrypted_volume_state_map * old_file_state = NULL ;
849
849
HASH_FIND_STR (enc -> volume -> files_state_map , old_norm_path , old_file_state );
@@ -864,10 +864,10 @@ int encrypted_file_rename(struct libos_encrypted_file* enc, const char* new_uri)
864
864
new_norm_path = new_file_state -> norm_path ;
865
865
}
866
866
new_file_state -> state = old_file_state -> state ;
867
- memcpy (new_file_state -> last_seen_root_gmac , new_root_gmac , sizeof (pf_mac_t ));
867
+ memcpy (new_file_state -> last_seen_root_mac , new_root_mac , sizeof (pf_mac_t ));
868
868
old_file_state -> state = PF_FILE_STATE_DELETED ; /* note: this might remove error state from that
869
869
file but that is fine as it is deleted now. */
870
- memset (old_file_state -> last_seen_root_gmac , 0 , sizeof (pf_mac_t ));
870
+ memset (old_file_state -> last_seen_root_mac , 0 , sizeof (pf_mac_t ));
871
871
unlock (& (enc -> volume -> files_state_map_lock ));
872
872
873
873
free (enc -> uri );
@@ -905,13 +905,13 @@ int encrypted_file_unlink(struct libos_encrypted_file* enc) {
905
905
struct libos_encrypted_volume_state_map * file_state = NULL ;
906
906
HASH_FIND_STR (enc -> volume -> files_state_map , norm_path , file_state );
907
907
assert (file_state != NULL );
908
- pf_mac_t root_gmac_before_unlink ;
909
- memcpy (root_gmac_before_unlink , file_state -> last_seen_root_gmac , sizeof (pf_mac_t ));
908
+ pf_mac_t root_mac_before_unlink ;
909
+ memcpy (root_mac_before_unlink , file_state -> last_seen_root_mac , sizeof (pf_mac_t ));
910
910
file_state -> state = PF_FILE_STATE_DELETED ;
911
- memset (file_state -> last_seen_root_gmac , 0 , sizeof (pf_mac_t ));
911
+ memset (file_state -> last_seen_root_mac , 0 , sizeof (pf_mac_t ));
912
912
unlock (& (enc -> volume -> files_state_map_lock ));
913
913
log_debug ("file '%s' unlinked, previously with MAC=" MAC_PRINTF_PATTERN , norm_path ,
914
- MAC_PRINTF_ARGS (root_gmac_before_unlink )); // TODO (MST): remove me eventually?
914
+ MAC_PRINTF_ARGS (root_mac_before_unlink )); // TODO (MST): remove me eventually?
915
915
return 0 ;
916
916
}
917
917
0 commit comments