]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Remove quadratic complexity from openvpn_base64_decode()
authorJann Horn <jann@thejh.net>
Wed, 16 Jul 2014 19:55:42 +0000 (21:55 +0200)
committerGert Doering <gert@greenie.muc.de>
Sun, 14 Sep 2014 18:51:38 +0000 (20:51 +0200)
commit25e1ec71dd150e803c0a25308c193fea124c7b7a
tree77df03be681aa64407b415e808def3f79ee0bc91
parentdf8ebb21ad1957ec013ab832a0f6c18e9d6744f6
Remove quadratic complexity from openvpn_base64_decode()

Every four input characters, openvpn_base64_decode called token_decode,
which in turn called strlen() on the remaining input. This means that
base64 decoding in openvpn had quadratic complexity.

All we really need to know is whether the token is complete, so replace
the check to check just that, and make the complexity linear wrt the
input length.

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <5408494D.7050407@fox-it.com>
URL: http://article.gmane.org/gmane.network.openvpn.devel/9016
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/base64.c