Skip to content

Commit

Permalink
Add SHA384
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodruff <[email protected]>
  • Loading branch information
ret2libc authored and woodruffw committed Jan 18, 2024
1 parent ae1382e commit 6e7d374
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/cosign/tlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ func rekorEntryHashAlgorithm(checksum crypto.SignerOpts) string {
switch checksum.HashFunc() {
case crypto.SHA256:
return models.HashedrekordV001SchemaDataHashAlgorithmSha256
case crypto.SHA384:
return models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / Run unit tests (ubuntu-latest)

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / e2e-tsa-mtls (ubuntu-latest)

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / e2e-secrets (ubuntu-latest)

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / Verify Docgen

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / attest / verify-attestation test (v1.25.x, air-gap)

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / attest / verify-attestation test (v1.25.x, remote)

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / e2e tests (v1.25.x)

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / e2e-kms

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / e2e tests (v1.26.x)

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / build (macos-latest)

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / e2e tests (v1.24.x)

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / e2e tests (v1.27.x)

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / lint

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384) (typecheck)

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / lint

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384) (typecheck)

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / lint

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384) (typecheck)

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / Run PowerShell E2E tests

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384

Check failure on line 275 in pkg/cosign/tlog.go

View workflow job for this annotation

GitHub Actions / Run e2e tests

undefined: models.HashedrekordV001SchemaDataHashAlgorithmSha384
case crypto.SHA512:
return models.HashedrekordV001SchemaDataHashAlgorithmSha512
default:
Expand Down
7 changes: 5 additions & 2 deletions pkg/cosign/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,9 @@ func VerifyBundle(sig oci.Signature, co *CheckOpts) (bool, error) {
case crypto.SHA256:
h := sha256.Sum256(payload)
payloadHash = hex.EncodeToString(h[:])
case crypto.SHA384:
h := sha512.Sum384(payload)
payloadHash = hex.EncodeToString(h[:])
case crypto.SHA512:
h := sha512.Sum512(payload)
payloadHash = hex.EncodeToString(h[:])
Expand Down Expand Up @@ -1267,8 +1270,8 @@ func extractEntryImpl(bundleBody string) (rekor_types.EntryImpl, error) {

func HashAlgorithmToCryptoHash(hashAlgorithm string) crypto.Hash {
switch hashAlgorithm {
case "sha256":
return crypto.SHA256
case "sha384":
return crypto.SHA384
case "sha512":
return crypto.SHA512
default:
Expand Down

0 comments on commit 6e7d374

Please sign in to comment.