mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-15 16:04:37 +00:00
BUG/MINOR: jwt: use CRYPTO_memcmp() to compare HMACs
As Tim reported in github issue #1414, we ought to use a constant-time memcmp() when comparing hashes to avoid time-based attacks. Let's use CRYPTO_memcmp() since this code already depends on openssl. No backport is needed, this was just merged into 2.5.
This commit is contained in:
parent
468c000db0
commit
ce16db4145
@ -205,7 +205,7 @@ jwt_jwsverify_hmac(const struct jwt_ctx *ctx, const struct buffer *decoded_signa
|
||||
ctx->jose.length + ctx->claims.length + 1, signature, &signature_length);
|
||||
|
||||
if (hmac_res && signature_length == decoded_signature->data &&
|
||||
(memcmp(decoded_signature->area, signature, signature_length) == 0))
|
||||
(CRYPTO_memcmp(decoded_signature->area, signature, signature_length) == 0))
|
||||
retval = JWT_VRFY_OK;
|
||||
|
||||
free_trash_chunk(trash);
|
||||
|
Loading…
Reference in New Issue
Block a user