memory(2): mention tsmemcmp (thanks kemal)
This commit is contained in:
parent
e72da62915
commit
013b2cad19
1 changed files with 22 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
.TH MEMORY 2
|
.TH MEMORY 2
|
||||||
.SH NAME
|
.SH NAME
|
||||||
memccpy, memchr, memcmp, memcpy, memmove, memset \- memory operations
|
memccpy, memchr, memcmp, memcpy, memmove, memset, tsmemcmp \- memory operations
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B #include <u.h>
|
.B #include <u.h>
|
||||||
.br
|
.br
|
||||||
|
@ -24,6 +24,11 @@ void* memmove(void *s1, void *s2, ulong n)
|
||||||
.PP
|
.PP
|
||||||
.B
|
.B
|
||||||
void* memset(void *s, int c, ulong n)
|
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
|
.SH DESCRIPTION
|
||||||
These functions operate efficiently on memory areas
|
These functions operate efficiently on memory areas
|
||||||
(arrays of bytes bounded by a count, not terminated by a zero byte).
|
(arrays of bytes bounded by a count, not terminated by a zero byte).
|
||||||
|
@ -103,11 +108,22 @@ to the value of byte
|
||||||
.IR c .
|
.IR c .
|
||||||
It returns
|
It returns
|
||||||
.IR s .
|
.IR s .
|
||||||
|
.PP
|
||||||
|
.I Tsmemcmp
|
||||||
|
is a variant of
|
||||||
|
.I memcmp
|
||||||
|
that is safe against timing attacks.
|
||||||
|
It does not stop when it sees a difference, this way it's runtime is function of
|
||||||
|
.I n
|
||||||
|
and not something that can lead clues to attackers.
|
||||||
.SH SOURCE
|
.SH SOURCE
|
||||||
All these routines have portable C implementations in
|
All these routines have portable C implementations in
|
||||||
.BR /sys/src/libc/port .
|
.BR /sys/src/libc/port .
|
||||||
Most also have machine-dependent assembly language implementations in
|
Most also have machine-dependent assembly language implementations in
|
||||||
.BR /sys/src/libc/$objtype .
|
.BR /sys/src/libc/$objtype .
|
||||||
|
.I Tsmemcmp
|
||||||
|
is found on
|
||||||
|
.BR /sys/src/libsec/port/tsmemcmp.c .
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.IR strcat (2)
|
.IR strcat (2)
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
|
@ -124,3 +140,8 @@ If
|
||||||
and
|
and
|
||||||
.I memmove
|
.I memmove
|
||||||
are handed a negative count, they abort.
|
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.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue