File: byte_start.3

package info (click to toggle)
libowfat 0.34-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,288 kB
  • sloc: ansic: 20,181; makefile: 16
file content (20 lines) | stat: -rw-r--r-- 743 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
.TH byte_start 3
.SH NAME
byte_start \- find out if string b is prefix of string a
.SH SYNTAX
.B #include <libowfat/byte.h>

int \fBbyte_start\fP(const char *\fIa\fR,size_t \fIalen\fR,const char *\fIb\fR,size_t blen);
.SH DESCRIPTION
\fIbyte_start\fR returns 1 if \fIalen\fR >= \fIblen\fR and the first \fIblen\fR bytes from
\fIa\fR and \fIb\fR are equal.

When \fIblen\fR is too large or the strings are different, \fIbyte_start\fR does not
read bytes past the first difference. An attacker observing the
execution timing can thus learn where the first mismatch happened.

Use \fIbyte_equal_notimingattack\fR to compare keys, passphrases, cookies or
hashes instead.

.SH "SEE ALSO"
byte_equal(3), byte_equal_notimingattack(3), byte_starts(3)