diff --git a/pkg/chunked/compression_linux.go b/pkg/chunked/compression_linux.go index 3bff52e795..580137fafe 100644 --- a/pkg/chunked/compression_linux.go +++ b/pkg/chunked/compression_linux.go @@ -250,7 +250,7 @@ func readZstdChunkedManifest(blobStream ImageSourceSeekable, blobSize int64, toc return nil, nil, nil, 0, err } - decodedTarSplit, err = decodeAndValidateBlob(tarSplit, footerData.LengthUncompressedTarSplit, footerData.ChecksumAnnotationTarSplit) + decodedTarSplit, err = decodeAndValidateBlob(tarSplit, footerData.LengthUncompressedTarSplit, toc.TarSplitDigest.String()) if err != nil { return nil, nil, nil, 0, err } diff --git a/pkg/chunked/internal/compression.go b/pkg/chunked/internal/compression.go index f52a07a9f8..d9643303e1 100644 --- a/pkg/chunked/internal/compression.go +++ b/pkg/chunked/internal/compression.go @@ -19,8 +19,9 @@ import ( ) type TOC struct { - Version int `json:"version"` - Entries []FileMetadata `json:"entries"` + Version int `json:"version"` + Entries []FileMetadata `json:"entries"` + TarSplitDigest digest.Digest `json:"tarSplitDigest,omitempty"` } type FileMetadata struct { @@ -85,7 +86,7 @@ func GetType(t byte) (string, error) { const ( ManifestChecksumKey = "io.github.containers.zstd-chunked.manifest-checksum" ManifestInfoKey = "io.github.containers.zstd-chunked.manifest-position" - TarSplitChecksumKey = "io.github.containers.zstd-chunked.tarsplit-checksum" + TarSplitChecksumKey = "io.github.containers.zstd-chunked.tarsplit-checksum" // Deprecated: Use the TOC.TarSplitDigest field instead, this one is not authenticated by ManifestChecksumKey. TarSplitInfoKey = "io.github.containers.zstd-chunked.tarsplit-position" // ManifestTypeCRFS is a manifest file compatible with the CRFS TOC file. @@ -134,8 +135,9 @@ func WriteZstdChunkedManifest(dest io.Writer, outMetadata map[string]string, off manifestOffset := offset + zstdSkippableFrameHeader toc := TOC{ - Version: 1, - Entries: metadata, + Version: 1, + Entries: metadata, + TarSplitDigest: tarSplitData.Digest, } json := jsoniter.ConfigCompatibleWithStandardLibrary