GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
byte_starts(3) FreeBSD Library Functions Manual byte_starts(3)

byte_starts - find out if a buffer starts with a string

#include <libowfat/byte.h>

int byte_starts(const char *buf,size_t buflen,const char *str);

byte_starts returns 1 if the buflen>=strlen(str) and the first strlen(str) bytes of buf match the contents of str, or 0 otherwise.

This function is meant to be used in protocol parsing and with a string constant for str and will use gcc/clang macro trickery to reduce to a call to memcmp then.

byte_starts compares as few bytes as possible. An attacker observing the execution timing can thus learn where the first mismatch happened.

Use byte_equal_notimingattack to compare keys, passphrases, cookies or hashes instead.

byte_equal(3), byte_equal_notimingattack(3), byte_start(3)


Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.