xref: /netbsd-src/crypto/external/bsd/openssl.old/dist/doc/man3/CRYPTO_memcmp.pod (revision 4724848cf0da353df257f730694b7882798e5daf)
1*4724848cSchristos=pod
2*4724848cSchristos
3*4724848cSchristos=head1 NAME
4*4724848cSchristos
5*4724848cSchristosCRYPTO_memcmp - Constant time memory comparison
6*4724848cSchristos
7*4724848cSchristos=head1 SYNOPSIS
8*4724848cSchristos
9*4724848cSchristos #include <openssl/crypto.h>
10*4724848cSchristos
11*4724848cSchristos int CRYPTO_memcmp(const void *a, const void *b, size_t len);
12*4724848cSchristos
13*4724848cSchristos=head1 DESCRIPTION
14*4724848cSchristos
15*4724848cSchristosThe CRYPTO_memcmp function compares the B<len> bytes pointed to by B<a> and B<b>
16*4724848cSchristosfor equality.
17*4724848cSchristosIt takes an amount of time dependent on B<len>, but independent of the
18*4724848cSchristoscontents of the memory regions pointed to by B<a> and B<b>.
19*4724848cSchristos
20*4724848cSchristos=head1 RETURN VALUES
21*4724848cSchristos
22*4724848cSchristosCRYPTO_memcmp() returns 0 if the memory regions are equal and nonzero
23*4724848cSchristosotherwise.
24*4724848cSchristos
25*4724848cSchristos=head1 NOTES
26*4724848cSchristos
27*4724848cSchristosUnlike memcmp(2), this function cannot be used to order the two memory regions
28*4724848cSchristosas the return value when they differ is undefined, other than being nonzero.
29*4724848cSchristos
30*4724848cSchristos=head1 COPYRIGHT
31*4724848cSchristos
32*4724848cSchristosCopyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
33*4724848cSchristos
34*4724848cSchristosLicensed under the Apache License 2.0 (the "License").  You may not use
35*4724848cSchristosthis file except in compliance with the License.  You can obtain a copy
36*4724848cSchristosin the file LICENSE in the source distribution or at
37*4724848cSchristosL<https://www.openssl.org/source/license.html>.
38*4724848cSchristos
39*4724848cSchristos=cut
40