{"id":17921540,"url":"https://github.com/theopolis/sboot","last_synced_at":"2025-03-24T01:32:29.795Z","repository":{"id":6382631,"uuid":"7620247","full_name":"theopolis/sboot","owner":"theopolis","description":"Standalone libSboot for U-boot","archived":false,"fork":false,"pushed_at":"2013-01-17T05:56:49.000Z","size":172,"stargazers_count":22,"open_issues_count":1,"forks_count":6,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-19T01:07:07.928Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theopolis.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-15T07:04:43.000Z","updated_at":"2021-04-26T04:58:06.000Z","dependencies_parsed_at":"2022-07-28T22:39:03.012Z","dependency_job_id":null,"html_url":"https://github.com/theopolis/sboot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theopolis%2Fsboot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theopolis%2Fsboot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theopolis%2Fsboot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theopolis%2Fsboot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theopolis","download_url":"https://codeload.github.com/theopolis/sboot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245194504,"owners_count":20575766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-28T20:34:39.992Z","updated_at":"2025-03-24T01:32:27.756Z","avatar_url":"https://github.com/theopolis.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"libSboot -- Standalone\n\nThese libraries (libSboot, libTLCL) and TPM drivers provide a Secure Boot\nexample for U-boot. A source tree with libSboot built into mainline U-Boot\nis available at https://github.com/theopolis/u-boot-sboot.\n\nOverview:\n=========\n\nlibSboot provides an example 'Secured Boot' for U-Boot and a U-Boot Second\nPhase Loader (SPL). libSboot attempts to define an example of how a platform\ncan measure a pre-OS boot environment, thus providing a capability to\nensure that a libSboot-enforced OS is only loaded in an owner-authorized \nfashion. A 'Secure Boot' concept is a common means to ensure platform security\nand integrity; understand that there are many implementations of a 'Secure\nBoot'. \n\nThe pre-boot environment is defined as:\n- The U-Boot binary loaded by a SPL\n- EEPROM defining platform identification and configuration\n- Environment data read from an initial external source\n- Environment variables set via the U-Boot console\n- Commands interpreted via the U-Boot console\n- Flat Device Tree files \n- Initial Ram Disks and Ram Disks\n- An OS Kernel\n\nCurrently libSboot does not require augmentation (signatures or keys) to\ndata or configuration options for boot. It only requires patching U-Boot\nand SPL boot routines to measure and check platform state. This does not \nprovide the user with much robustness. A change to the pre-boot environment \nwill require interaction on the U-Boot console to 'reseal' the configuration. \nA more robust implementation would apply signature checking to data and options\nto provide flexible updates to the pre-boot environment.\n\nUnderstanding the implementation of libSboot:\n\nlibSboot uses a TPM v1.2 to implement a secure boot using a static root\nof trust measurement (SRTM). The static adjective implies a 'read-only' \nattribute, meaning libSboot expects its initialization to occur from ROM code. \nDuring this initialization libSboot performs a TPM_Start, TPM_SelfTest and \nchecks that the TPM is neither deactivated nor disabled. The TPM must have its\nNVRAM locked, meaning access control is enforced. Initialization then checks \neach PCR used to measure the pre-boot environment and verifies they are reset.\nFinally Physical Presence is asserted to satisfy NVRAM read/write permissions.\n\nThe sealed data for a securely measured pre-boot environment is stored in TPM\nNVRAM with a Physical Presence requirement for read and write. Note: the sealed \ndata is an encrypted blob, thus a Physical Presence requirement for reading is \nnot required. Though the Physical Presence requirement for writing is very \nimportant! If arbitrary sealed data can be written, then an attacker can measure \nand store from a compromised OS state. Because of this, libSboot must de-assert \nPhysical Presence and extend the PCRs with random data when libSboot finishes \nmeasuring or encounters an error. \n  \nlibSboot uses two sealed blobs stored in TPM NVRAM, one measured for the \npre-execution of U-Boot, the other for the OS. This enables flexibility within \nU-Boot to seal modifications to the pre-boot environment for the U-Boot environment, \nU-Boot console usage, OS kernel, etc. Modifications to U-Boot are more difficult, \nU-Boot can issue a re-seal of a new U-Boot binary, but first the PCR which \nmeasured the running U-Boot must be reset. This requires an authenticated TPM_Reset \ncommand. \n\nlibSboot will report to the console if an unseal fails, if libSboot is in 'enforce' \n(see below) mode then a failed unseal will halt execution. This implementation does \nnot depend on the sealed and unsealed data (meaning we can seal well-known data), \nit only depends on the TPM response (success/failure) of an unseal. Since libSboot \ndoes not require authentication during initialization, subsequent initializations \nwill normally fail. There are several ways to assure successful subsequent \ninitializations: (1) build a method for authenticating a TPM owner within the SRTM; \n(2) require hardware Physical Presence; (3) issue a TPM Reset before the OS reboots. \n\nSetup:\n======\n\n1. A working TPM.\n2. Ownership of TPM; libSboot uses the Storage Root Key (SRK) for sealing \nmeasurements; the TPM must be protected against a reset.\n3. TPM NVRAM locked.\n4. Two NVRAM defined indexes with Physical Presence required for Read/Write.\n5. Hardware write protection for the location of the SRTM (SPL).\n\nConfiguration Options:\n======================\n\n- TPM Drivers\n\n  CONFIG_TPM\n\n  This will build libtpm, a TPM device will also need to be configured.\n\n  CONFIG_TPM_I2C_ATMEL\n\n  This selects a TPM device (Atmel's AT97SC3204T I2C TPM). A device on an\n  I2C bus also needs to know it's bus ID and address. By default the first (0)\n  I2C bus will be used.\n\n  CONFIG_TPM_I2C_BUS\n\n  For boards with multiple I2C buses, you may configure the bus number the\n  TPM device is connected on.\n\n  CONFIG_TPM_I2C_ADDR\n\n  The address of the TPM on the I2C bus, usually specific to the device.\n\n  CONFIG_CMD_TPM\n\n  Enable the 'tpm' command within the U-Boot shell. The command accepts\n  space-delimited characters to send to the TPM.\n\n- libTLCL (TPM Lite Library)\n  This library provide the necessary TPM 1.2 Commands required for libSboot.\n  \n  CONFIG_TLCL_SEAL\n\n  Adds TlclSeal, TlclUnseal and related methods to libTLCL.\n\n  CONFIG_CMD_TPM_TLCL\n\n  Enable the 'tpm_tlcl' command within the U-Boot shell. This command\n  includes methods for testing the TPM. Warning! Some commands set permanent\n  configuration options on the TPM.\n\n- libSboot\n\n  CONFIG_SBOOT\n\n  Adds libSboot to U-Boot.\n\n  CONFIG_SPL_SBOOT_SUPPORT\n\n  Adds libSboot to SPL.\n\n  CONFIG_SBOOT_UBOOT_SEAL_INDEX\n\n  Sets the NVRAM index to Seal/Unseal well-known blob data bound to the PCR\n  values for a known-secure state before executing U-Boot. This option\n  value is only used if CONFIG_SPL_SBOOT_SUPPORT is enabled.\n\n  CONFIG_SBOOT_IMAGE_SEAL_INDEX\n\n  Same as above, but for the state within U-Boot before executing an\n  OS (kernel or otherwise).\n\n  CONFIG_SBOOT_DISABLE_CONSOLE_EXTEND\n\n  Prevent libSboot from measuring U-Boot console commands.\n  (Not Recommended!)\n\n  CONFIG_SBOOT_DISABLE_ENV_EXTEND\n\n  Prevent libSboot from measuring U-Boot environments.\n  This includes an external environment store, uEnv.txt, and environment\n  variables set via the U-Boot shell (or other commands).\n  (Not Recommended!)\n\n  CONFIG_SBOOT_ENFORCE\n\n  This will cause libSboot to halt execution if it fails to unseal for \n  U-Boot or the OS.\n\nNotes:\n======\n\nThis documentation is a work-in-progress.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheopolis%2Fsboot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheopolis%2Fsboot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheopolis%2Fsboot/lists"}