]> git.ipfire.org Git - thirdparty/haproxy.git/commit
CLEANUP: jwt: Remove the use of a trash buffer in jwt_jwsverify_hmac()
authorTim Duesterhus <tim@bastelstu.be>
Mon, 18 Oct 2021 16:40:28 +0000 (18:40 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 28 Oct 2021 07:45:48 +0000 (09:45 +0200)
commitc87d3c21bf6969e05ad86a15d01a055da6f23bee
tree09f3f6c9f2d4bd7fa508a80ec23c065325b11615
parent24b8d693b202b01b649f64ed878d8f9dd1b242e4
CLEANUP: jwt: Remove the use of a trash buffer in jwt_jwsverify_hmac()

The OpenSSL documentation (https://www.openssl.org/docs/man1.1.0/man3/HMAC.html)
specifies:

> It places the result in md (which must have space for the output of the hash
> function, which is no more than EVP_MAX_MD_SIZE bytes). If md is NULL, the
> digest is placed in a static array. The size of the output is placed in
> md_len, unless it is NULL. Note: passing a NULL value for md to use the
> static array is not thread safe.

`EVP_MAX_MD_SIZE` appears to be defined as `64`, so let's simply use a stack
buffer to avoid the whole memory management.
src/jwt.c