]> git.ipfire.org Git - thirdparty/suricata.git/commit
util/crypt: Add macro for max base64encode len
authorShivani Bhardwaj <shivanib134@gmail.com>
Thu, 3 Dec 2020 11:25:39 +0000 (16:55 +0530)
committerVictor Julien <vjulien@oisf.net>
Wed, 20 Apr 2022 21:15:45 +0000 (23:15 +0200)
commit59f6d970cd9acbe8af101130814315171bab4939
tree1eb8e3096b6c9a9d11eb2ac3dfea1363a30de1b0
parent1b6615da0175b0a8b7744f27de957cf0bf4c7b2d
util/crypt: Add macro for max base64encode len

Maximum length of a base64 encoded string can be 33% over the actual
length of the input string. The formula to best cover all the edge cases
is mathematically
(4 * (input_length + 2) / 3) + 1

Add a macro to calculate this for a given input length.

(cherry picked from commit 02942a123a525bb1ed97bba9242f1e08d54f0fb8)
src/util-crypt.h