From: kemal <kemalinanc8@gmail.com>
To: 9front@9front.org
Subject: [9front] memory(2): mention tsmemcmp
Date: Thu, 29 Apr 2021 11:40:09 +0000 [thread overview]
Message-ID: <CABO6shcGY0MhXZ4tZabEgxK2KGMD9OKcSQEhSJ_fEodx2gv+JQ@mail.gmail.com> (raw)
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.
next reply other threads:[~2021-04-29 11:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 11:40 kemal [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CABO6shcGY0MhXZ4tZabEgxK2KGMD9OKcSQEhSJ_fEodx2gv+JQ@mail.gmail.com \
--to=kemalinanc8@gmail.com \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).