9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] memory(2): mention tsmemcmp
@ 2021-04-29 11:40 kemal
  2021-04-29 16:32 ` [9front] " kemal
  0 siblings, 1 reply; 10+ messages in thread
From: kemal @ 2021-04-29 11:40 UTC (permalink / raw)
  To: 9front

diff -r b341860aaa26 sys/man/2/memory
--- a/sys/man/2/memory	Sun Apr 25 21:49:01 2021 +0200
+++ b/sys/man/2/memory	Thu Apr 29 14:38:46 2021 +0300
@@ -24,6 +24,11 @@
 .PP
 .B
 void*	memset(void *s, int c, ulong n)
+.PP
+.B #include <libsec.h>
+.PP
+.B
+int	tsmemcmp(void *s1, void *s2, ulong n)
 .SH DESCRIPTION
 These functions operate efficiently on memory areas
 (arrays of bytes bounded by a count, not terminated by a zero byte).
@@ -103,6 +108,11 @@
 .IR c .
 It returns
 .IR s .
+.PP
+.I Tsmemcmp
+is a variant of
+.I memcmp
+that is safe against timing attacks.
 .SH SOURCE
 All these routines have portable C implementations in
 .BR /sys/src/libc/port .
@@ -124,3 +134,8 @@
 and
 .I memmove
 are handed a negative count, they abort.
+.PP
+.I Memcmp
+should not be used to compare sensitive data as it's vulnerable to
timing attacks. Instead,
+.I tsmemcmp
+should be used.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-05-15 10:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 11:40 [9front] memory(2): mention tsmemcmp kemal
2021-04-29 16:32 ` [9front] " kemal
2021-05-02 10:51   ` cinap_lenrek
2021-05-02 14:21     ` kemal
2021-05-04 10:40       ` umbraticus
2021-05-09 13:10         ` cinap_lenrek
2021-05-09 15:25           ` kemal
2021-05-09 16:10             ` hiro
2021-05-09 19:17               ` kemal
2021-05-15 10:40                 ` cinap_lenrek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).