crypto/tls,regexp: remove always-nil error results

These were harmless, but added unnecessary verbosity to the code.
This can happen as a result of refactors: for example,
the method sessionState used to return errors in some cases.

Change-Id: I4e6dacc01ae6a49b528c672979f95cbb86795a85
Reviewed-on: https://go-review.googlesource.com/c/go/+/528995
Reviewed-by: Leo Isla <islaleo93@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Olivier Mengué <olivier.mengue@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
This commit is contained in:
Daniel Martí 2023-09-17 21:46:35 +01:00
parent 0cb1694084
commit 8d53a491d1
5 changed files with 9 additions and 21 deletions

View file

@ -837,13 +837,11 @@ func (c *Conn) sendSessionTicket(earlyData bool) error {
m := new(newSessionTicketMsgTLS13)
state, err := c.sessionState()
if err != nil {
return err
}
state := c.sessionState()
state.secret = psk
state.EarlyData = earlyData
if c.config.WrapSession != nil {
var err error
m.label, err = c.config.WrapSession(c.connectionStateLocked(), state)
if err != nil {
return err
@ -865,8 +863,7 @@ func (c *Conn) sendSessionTicket(earlyData bool) error {
// The value is not stored anywhere; we never need to check the ticket age
// because 0-RTT is not supported.
ageAdd := make([]byte, 4)
_, err = c.config.rand().Read(ageAdd)
if err != nil {
if _, err := c.config.rand().Read(ageAdd); err != nil {
return err
}
m.ageAdd = binary.LittleEndian.Uint32(ageAdd)