Skip to content

crypto/hmac: Don't check length in Equal #16336

Description

@leonklingele

As crypto/hmac.Equal is relying on crypto/subtle.ConstantTimeCompare, which already checks the length of the two byte slices, we do not need such a length check in crypto/hmac.Equal.

crypto/subtle.ConstantTimeCompare: https://github.com/golang/go/blob/master/src/crypto/subtle/constant_time.go#L12
crypto/hmac.Equal: https://github.com/golang/go/blob/master/src/crypto/hmac/hmac.go#L97

I think the length check was used in crypto/hmac.Equal as it was previously not included in crypto/subtle.ConstantTimeCompare.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions