Documentation
¶
Overview ¶
Package modelwrap defines the Modelwrap (MWP) and Encrypted Modelwrap (EMWP) artifact format: the cryptographic constants, the artifact reference grammar, the deterministic identity derivations, and the key derivation used by both the packer and the consumer. See SPEC.md for the full format specification.
Index ¶
Constants ¶
const ( VerityFormat = 1 VerityHashAlgorithm = "sha256" VerityDataBlockSize = 4096 VerityHashBlockSize = 4096 )
dm-verity format parameters. These are passed explicitly to veritysetup so tool default changes never silently alter the artifact format.
const ( EMWPCipher = "aes-xts-plain64" EMWPKeySizeBits = 512 EMWPKeyBytes = EMWPKeySizeBits / 8 EMWPMasterKeyBytes = 64 EMWPSectorSize = 4096 EMWPKeyDeriveInfo = "tinfoil/emwp/dm-crypt-key/v1" )
EMWP dm-crypt parameters.
const ( GPTSectorSize = 512 EMWPPartitionStartSector = 2048 EMWPGPTTrailingSectors = 40 )
EMWP GPT disk image geometry. The encrypted payload partition starts at a fixed sector so ciphertext placement is deterministic.
Variables ¶
This section is empty.
Functions ¶
func DeriveKey ¶
func DeriveKey(masterKey []byte, ref *ArtifactRef) ([]byte, error)
DeriveKey derives the per-artifact dm-crypt key from the EMWP master key using HKDF-SHA256 with the artifact ID as salt.
func HashDir ¶
HashDir computes a deterministic content hash over a model directory tree, used as the revision for local model directories.
func ParseMasterKey ¶
ParseMasterKey decodes and validates a base64-encoded EMWP master key.
Types ¶
type ArtifactRef ¶
ArtifactRef is a parsed artifact reference of the form rootHash_hashOffset_uuid. For MWP artifacts the UUID is the dm-verity superblock UUID; for EMWP artifacts it is the GPT PARTUUID of the encrypted payload partition.
func ParseRef ¶
func ParseRef(ref string) (*ArtifactRef, error)
ParseRef parses and validates a rootHash_hashOffset_uuid reference.
func (*ArtifactRef) ArtifactID ¶
func (r *ArtifactRef) ArtifactID() string
ArtifactID returns the rootHash_uuid identity used as the HKDF salt for EMWP key derivation, binding the derived key to one specific artifact.
func (*ArtifactRef) String ¶
func (r *ArtifactRef) String() string
String returns the canonical rootHash_hashOffset_uuid form.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
modelwrap
command
Command modelwrap packs model weights into MWP/EMWP artifacts.
|
Command modelwrap packs model weights into MWP/EMWP artifacts. |
|
Package unwrap implements the consumer side of the Modelwrap protocol: opening dm-crypt and dm-verity mappings over MWP/EMWP artifacts and mounting the verified filesystem read-only.
|
Package unwrap implements the consumer side of the Modelwrap protocol: opening dm-crypt and dm-verity mappings over MWP/EMWP artifacts and mounting the verified filesystem read-only. |
|
Package wrap implements the Modelwrap packer: it builds deterministic EROFS images of model directories, wraps them with dm-verity (MWP), and optionally encrypts them into a GPT disk image with dm-crypt (EMWP).
|
Package wrap implements the Modelwrap packer: it builds deterministic EROFS images of model directories, wraps them with dm-verity (MWP), and optionally encrypts them into a GPT disk image with dm-crypt (EMWP). |