func GetSecureBoot() bool {
	if _, data, err := attributes.ReadEfivars("SecureBoot"); err == nil {
		b, _ := data.ReadByte()
		if b == 1 {
			return true
		}
	}
	return false
}
GetSecureBoot returns if secure boot has been enabled on the machine.
package efi
import (
	"bytes"
	"crypto/rsa"
	"crypto/x509"
	"encoding/binary"
	"fmt"
	"log"
	"github.com/foxboron/go-uefi/efi/attributes"
	"github.com/foxboron/go-uefi/efi/device"
	"github.com/foxboron/go-uefi/efi/pecoff"
	"github.com/foxboron/go-uefi/efi/signature"
	"github.com/foxboron/go-uefi/efi/util"
	"github.com/pkg/errors"
)
var ValidAttributes = map[string]attributes.Attributes{
	"SetupMode": attributes.EFI_VARIABLE_NON_VOLATILE |
		attributes.EFI_VARIABLE_BOOTSERVICE_ACCESS,
	"PK": attributes.EFI_VARIABLE_NON_VOLATILE |
		attributes.EFI_VARIABLE_BOOTSERVICE_ACCESS |
		attributes.EFI_VARIABLE_RUNTIME_ACCESS |
		attributes.EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS,
	"KEK": attributes.EFI_VARIABLE_NON_VOLATILE |
		attributes.EFI_VARIABLE_BOOTSERVICE_ACCESS |
		attributes.EFI_VARIABLE_RUNTIME_ACCESS |
		attributes.EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS,
	"db": attributes.EFI_VARIABLE_NON_VOLATILE |
		attributes.EFI_VARIABLE_BOOTSERVICE_ACCESS |
		attributes.EFI_VARIABLE_RUNTIME_ACCESS |
		attributes.EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS,
	"dbx": attributes.EFI_VARIABLE_NON_VOLATILE |
		attributes.EFI_VARIABLE_BOOTSERVICE_ACCESS |
		attributes.EFI_VARIABLE_RUNTIME_ACCESS |
		attributes.EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS,
}
func GetBootOrder() []string {
	ret := []string{}
	_, data, _ := attributes.ReadEfivars("BootOrder")
	for i := 0; i < data.Len(); i += 2 {
		b := make([]byte, 2)
		data.Read(b)
		val := binary.BigEndian.Uint16([]byte{b[1], b[0]})
		ret = append(ret, fmt.Sprintf("Boot%04x\n", val))
	}
	return ret
}
func GetBootEntry(entry string) *device.EFILoadOption {
	_, f, _ := attributes.ReadEfivars(entry)
	loadOption := device.ParseEFILoadOption(f)
	loadOption.FilePath = device.ParseDevicePath(f)
	return loadOption
}
func GetSetupMode() bool {
	if _, data, err := attributes.ReadEfivars("SetupMode"); err == nil {
		b, _ := data.ReadByte()
		if b == 1 {
			return true
		}
	}
	return false
}