mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 13:21:29 +02:00
JWS functions are supposed to return 0 upon error or when nothing was produced. This was done in order to put easily the return value in trash->data without having to check the return value. However functions like a2base64url() or snprintf() could return a negative value, which would be casted in a unsigned int if this happen. This patch add checks on the JWS functions to ensure that no negative value can be returned, and change the prototype from int to size_t. This is also related to issue #3114. Must be backported to 3.2.
19 lines
840 B
C
19 lines
840 B
C
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
|
|
#ifndef _HAPROXY_JWK_H_
|
|
#define _HAPROXY_JWK_H_
|
|
|
|
#include <haproxy/openssl-compat.h>
|
|
#include <haproxy/jwt-t.h>
|
|
|
|
size_t bn2base64url(const BIGNUM *bn, char *dst, size_t dsize);
|
|
size_t EVP_PKEY_to_pub_jwk(EVP_PKEY *pkey, char *dst, size_t dsize);
|
|
enum jwt_alg EVP_PKEY_to_jws_alg(EVP_PKEY *pkey);
|
|
size_t jws_b64_payload(char *payload, char *dst, size_t dsize);
|
|
size_t jws_b64_protected(enum jwt_alg alg, char *kid, char *jwk, char *nonce, char *url, char *dst, size_t dsize);
|
|
size_t jws_b64_signature(EVP_PKEY *pkey, enum jwt_alg alg, char *b64protected, char *b64payload, char *dst, size_t dsize);
|
|
size_t jws_flattened(char *protected, char *payload, char *signature, char *dst, size_t dsize);
|
|
size_t jws_thumbprint(EVP_PKEY *pkey, char *dst, size_t dsize);
|
|
|
|
#endif /* ! _HAPROXY_JWK_H_ */
|