summaryrefslogtreecommitdiff
path: root/sys/include/libc.h
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2017-12-31 09:06:42 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2017-12-31 09:06:42 +0100
commitc039b52fc3d7c225fe8b6f88f21df83ac26d5984 (patch)
treebed796d3111679d359851521644fbbee2378f200 /sys/include/libc.h
parentee89c82dd35475b93dd67773b7d10e461921a734 (diff)
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.
Diffstat (limited to 'sys/include/libc.h')
-rw-r--r--sys/include/libc.h6
1 files changed, 6 insertions, 0 deletions
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*);