Skip to content

Commit

Permalink
crypto/internal/hpke: replace x/crypto/hkdf with crypto/internal/fips…
Browse files Browse the repository at this point in the history
…/hkdf

Change-Id: Id69e8e3a7dd61ca33489140eb76771b176a9ea4a
Reviewed-on: https://go-review.googlesource.com/c/go/+/629057
Reviewed-by: Russ Cox <[email protected]>
Auto-Submit: Filippo Valsorda <[email protected]>
TryBot-Bypass: Filippo Valsorda <[email protected]>
Commit-Queue: Filippo Valsorda <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
  • Loading branch information
FiloSottile authored and gopherbot committed Nov 19, 2024
1 parent ad072b3 commit a332689
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 104 deletions.
9 changes: 2 additions & 7 deletions src/crypto/internal/hpke/hpke.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (
"crypto/aes"
"crypto/cipher"
"crypto/ecdh"
"crypto/internal/fips/hkdf"
"crypto/rand"
"errors"
"internal/byteorder"
"math/bits"

"golang.org/x/crypto/chacha20poly1305"
"golang.org/x/crypto/hkdf"
)

// testingOnlyGenerateKey is only used during testing, to provide
Expand All @@ -42,12 +42,7 @@ func (kdf *hkdfKDF) LabeledExpand(suiteID []byte, randomKey []byte, label string
labeledInfo = append(labeledInfo, suiteID...)
labeledInfo = append(labeledInfo, label...)
labeledInfo = append(labeledInfo, info...)
out := make([]byte, length)
n, err := hkdf.Expand(kdf.hash.New, randomKey, labeledInfo).Read(out)
if err != nil || n != int(length) {
panic("hpke: LabeledExpand failed unexpectedly")
}
return out
return hkdf.Expand(kdf.hash.New, randomKey, labeledInfo, int(length))
}

// dhKEM implements the KEM specified in RFC 9180, Section 4.1.
Expand Down
1 change: 0 additions & 1 deletion src/go/build/deps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ var depsRules = `
< golang.org/x/crypto/chacha20
< golang.org/x/crypto/internal/poly1305
< golang.org/x/crypto/chacha20poly1305
< golang.org/x/crypto/hkdf
< crypto/internal/hpke
< crypto/x509/internal/macos
< crypto/x509/pkix;
Expand Down
95 changes: 0 additions & 95 deletions src/vendor/golang.org/x/crypto/hkdf/hkdf.go

This file was deleted.

1 change: 0 additions & 1 deletion src/vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ golang.org/x/crypto/chacha20
golang.org/x/crypto/chacha20poly1305
golang.org/x/crypto/cryptobyte
golang.org/x/crypto/cryptobyte/asn1
golang.org/x/crypto/hkdf
golang.org/x/crypto/internal/alias
golang.org/x/crypto/internal/poly1305
# golang.org/x/net v0.27.1-0.20240722181819-765c7e89b3bd
Expand Down

0 comments on commit a332689

Please sign in to comment.