src/pqc_bootloader/errors.py
| 1 | """Exception hierarchy for pqc-bootloader.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | |
| 6 | class BootloaderError(Exception): |
| 7 | """Base exception for all pqc-bootloader errors.""" |
| 8 | |
| 9 | |
| 10 | class FirmwareVerificationError(BootloaderError): |
| 11 | """Raised when a SignedFirmware fails cryptographic verification.""" |
| 12 | |
| 13 | |
| 14 | class UnknownKeyError(BootloaderError): |
| 15 | """Raised when a referenced key is not present in the KeyRing.""" |
| 16 | |
| 17 | |
| 18 | class UpdateChainError(BootloaderError): |
| 19 | """Raised when an UpdateChain link breaks continuity.""" |
| 20 | |
| 21 | |
| 22 | class MeasuredBootError(BootloaderError): |
| 23 | """Raised when a measured-boot PCR chain is inconsistent.""" |
| 24 | |
| 25 | |
| 26 | class KeyRingError(BootloaderError): |
| 27 | """Raised for KeyRing-level faults (duplicate add, malformed key).""" |
| 28 | |
| 29 | |
| 30 | class FirmwareRollbackError(UpdateChainError): |
| 31 | """Raised when attempting to roll the chain back to an older version.""" |
| 32 | |