loader/apple.c
VOID RotateCsrValue(VOID) {
    UINT32       CurrentValue, TargetCsr;
    UINT32_LIST  *ListItem;
    EFI_GUID     CsrGuid = CSR_GUID;
    EFI_STATUS   Status;

    Status = GetCsrStatus(&CurrentValue);
    if ((Status == EFI_SUCCESS) && GlobalConfig.CsrValues) {
        ListItem = GlobalConfig.CsrValues;
        while ((ListItem != NULL) && (ListItem->Value != CurrentValue))
            ListItem = ListItem->Next;
        if (ListItem == NULL || ListItem->Next == NULL) {
            TargetCsr = GlobalConfig.CsrValues->Value;
        } else {
            TargetCsr = ListItem->Next->Value;
        }
        Status = EfivarSetRaw(&CsrGuid, L"csr-active-config", (CHAR8 *) &TargetCsr, 4, TRUE);
        if (Status == EFI_SUCCESS)
            RecordgCsrStatus(TargetCsr, TRUE);
        else
            SPrint(gCsrStatus, 255, L" Error setting System Integrity Protection code.");
    } // if
}
// Find the current CSR status and reset it to the next one in the
// GlobalConfig.CsrValues list, or to the first value if the current
// value is not on the list.
Find the current CSR status and reset it to the next one in the
GlobalConfig.CsrValues list, or to the first value if the current
value is not on the list.
Find the current CSR status and reset it to the next one in the GlobalConfig . CsrValues list or to the first value if the current value is not on the list .
VOID RotateCsrValue(VOID) {
    UINT32       CurrentValue, TargetCsr;
    UINT32_LIST  *ListItem;
    EFI_GUID     CsrGuid = CSR_GUID;
    EFI_STATUS   Status;
    Status = GetCsrStatus(&CurrentValue);
    if ((Status == EFI_SUCCESS) && GlobalConfig.CsrValues) {
        ListItem = GlobalConfig.CsrValues;
        while ((ListItem != NULL) && (ListItem->Value != CurrentValue))
            ListItem = ListItem->Next;
        if (ListItem == NULL || ListItem->Next == NULL) {
            TargetCsr = GlobalConfig.CsrValues->Value;
        } else {
            TargetCsr = ListItem->Next->Value;
        }
        Status = EfivarSetRaw(&CsrGuid, L"csr-active-config", (CHAR8 *) &TargetCsr, 4, TRUE);
        if (Status == EFI_SUCCESS)
            RecordgCsrStatus(TargetCsr, TRUE);
        else
            SPrint(gCsrStatus, 255, L" Error setting System Integrity Protection code.");
    } 
}
VOID RotateCsrValue ( VOID ) { UINT32 CurrentValue , TargetCsr ; UINT32_LIST * ListItem ; EFI_GUID CsrGuid = CSR_GUID ; EFI_STATUS Status ; Status = GetCsrStatus ( & CurrentValue ) ; if ( ( Status == EFI_SUCCESS ) && GlobalConfig . CsrValues ) { ListItem = GlobalConfig . CsrValues ; while ( ( ListItem != NULL ) && ( ListItem -> Value != CurrentValue ) ) ListItem = ListItem -> Next ; if ( ListItem == NULL || ListItem -> Next == NULL ) { TargetCsr = GlobalConfig . CsrValues -> Value ; } else { TargetCsr = ListItem -> Next -> Value ; } Status = EfivarSetRaw ( & CsrGuid , L" " , ( CHAR8 * ) & TargetCsr , 4 , TRUE ) ; if ( Status == EFI_SUCCESS ) RecordgCsrStatus ( TargetCsr , TRUE ) ; else SPrint ( gCsrStatus , 255 , L" " ) ; } }
Find the current CSR status and reset it to the next one in the
GlobalConfig.CsrValues list, or to the first value if the current
value is not on the list.
Find the current CSR status and reset it to the next one in the GlobalConfig . CsrValues list or to the first value if the current value is not on the list .
// if