From c039b52fc3d7c225fe8b6f88f21df83ac26d5984 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 31 Dec 2017 09:06:42 +0100 Subject: libc: constant time implementation for encode(2) routines, fix base32 the string encoding functions touch secret key material in a bunch of places (devtls, devcap), so make sure we do not leak information by cache timing side channels, making the encoding and decoding routines constant time. we also expose the alphabets through encXchr()/decXchr() functions so caller can find the end of a encoded string before calling decode function (for libmp). the base32 encoding was broken in several ways. inputs lengths of len%5 == [2,3,4] had output truncated and it was using non-standard alphabet. documenting the alphabet change in the manpage. --- sys/include/libc.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sys/include/libc.h') diff --git a/sys/include/libc.h b/sys/include/libc.h index 33d0dbaef..98226dc05 100644 --- a/sys/include/libc.h +++ b/sys/include/libc.h @@ -369,6 +369,12 @@ extern int dec32(uchar*, int, char*, int); extern int enc32(char*, int, uchar*, int); extern int dec16(uchar*, int, char*, int); extern int enc16(char*, int, uchar*, int); +extern int dec64chr(int); +extern int enc64chr(int); +extern int dec32chr(int); +extern int enc32chr(int); +extern int dec16chr(int); +extern int enc16chr(int); extern int encodefmt(Fmt*); extern void exits(char*); extern double frexp(double, int*); -- cgit v1.2.3