"bytes"
"context"
"crypto"
+ "crypto/hkdf"
"crypto/hmac"
- "crypto/internal/fips140/hkdf"
"crypto/internal/fips140/mlkem"
"crypto/internal/fips140/tls13"
"crypto/rsa"
confTranscript.Write(hs.serverHello.original[:30])
confTranscript.Write(make([]byte, 8))
confTranscript.Write(hs.serverHello.original[38:])
- acceptConfirmation := tls13.ExpandLabel(hs.suite.hash.New,
- hkdf.Extract(hs.suite.hash.New, hs.echContext.innerHello.random, nil),
- "ech accept confirmation",
- confTranscript.Sum(nil),
- 8,
- )
+ h := hs.suite.hash.New
+ prk, err := hkdf.Extract(h, hs.echContext.innerHello.random, nil)
+ if err != nil {
+ c.sendAlert(alertInternalError)
+ return err
+ }
+ acceptConfirmation := tls13.ExpandLabel(h, prk, "ech accept confirmation", confTranscript.Sum(nil), 8)
if subtle.ConstantTimeCompare(acceptConfirmation, hs.serverHello.random[len(hs.serverHello.random)-8:]) == 1 {
hs.hello = hs.echContext.innerHello
c.serverName = c.config.ServerName
copy(hrrHello, hs.serverHello.original)
hrrHello = bytes.Replace(hrrHello, hs.serverHello.encryptedClientHello, make([]byte, 8), 1)
confTranscript.Write(hrrHello)
- acceptConfirmation := tls13.ExpandLabel(hs.suite.hash.New,
- hkdf.Extract(hs.suite.hash.New, hs.echContext.innerHello.random, nil),
- "hrr ech accept confirmation",
- confTranscript.Sum(nil),
- 8,
- )
+ h := hs.suite.hash.New
+ prk, err := hkdf.Extract(h, hs.echContext.innerHello.random, nil)
+ if err != nil {
+ c.sendAlert(alertInternalError)
+ return err
+ }
+ acceptConfirmation := tls13.ExpandLabel(h, prk, "hrr ech accept confirmation", confTranscript.Sum(nil), 8)
if subtle.ConstantTimeCompare(acceptConfirmation, hs.serverHello.encryptedClientHello) == 1 {
hello = hs.echContext.innerHello
c.serverName = c.config.ServerName
"bytes"
"context"
"crypto"
+ "crypto/hkdf"
"crypto/hmac"
- "crypto/internal/fips140/hkdf"
"crypto/internal/fips140/mlkem"
"crypto/internal/fips140/tls13"
"crypto/internal/hpke"
if err := transcriptMsg(helloRetryRequest, confTranscript); err != nil {
return nil, err
}
- acceptConfirmation := tls13.ExpandLabel(hs.suite.hash.New,
- hkdf.Extract(hs.suite.hash.New, hs.clientHello.random, nil),
- "hrr ech accept confirmation",
- confTranscript.Sum(nil),
- 8,
- )
+ h := hs.suite.hash.New
+ prf, err := hkdf.Extract(h, hs.clientHello.random, nil)
+ if err != nil {
+ c.sendAlert(alertInternalError)
+ return nil, err
+ }
+ acceptConfirmation := tls13.ExpandLabel(h, prf, "hrr ech accept confirmation", confTranscript.Sum(nil), 8)
helloRetryRequest.encryptedClientHello = acceptConfirmation
}
return err
}
// compute the acceptance message
- acceptConfirmation := tls13.ExpandLabel(hs.suite.hash.New,
- hkdf.Extract(hs.suite.hash.New, hs.clientHello.random, nil),
- "ech accept confirmation",
- echTranscript.Sum(nil),
- 8,
- )
+ h := hs.suite.hash.New
+ prk, err := hkdf.Extract(h, hs.clientHello.random, nil)
+ if err != nil {
+ c.sendAlert(alertInternalError)
+ return err
+ }
+ acceptConfirmation := tls13.ExpandLabel(h, prk, "ech accept confirmation", echTranscript.Sum(nil), 8)
copy(hs.hello.random[32-8:], acceptConfirmation)
}