xref: /freebsd/crypto/openssl/doc/man3/CRYPTO_memcmp.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1da327cd2SJung-uk Kim=pod
2da327cd2SJung-uk Kim
3da327cd2SJung-uk Kim=head1 NAME
4da327cd2SJung-uk Kim
5da327cd2SJung-uk KimCRYPTO_memcmp - Constant time memory comparison
6da327cd2SJung-uk Kim
7da327cd2SJung-uk Kim=head1 SYNOPSIS
8da327cd2SJung-uk Kim
9da327cd2SJung-uk Kim #include <openssl/crypto.h>
10da327cd2SJung-uk Kim
11da327cd2SJung-uk Kim int CRYPTO_memcmp(const void *a, const void *b, size_t len);
12da327cd2SJung-uk Kim
13da327cd2SJung-uk Kim=head1 DESCRIPTION
14da327cd2SJung-uk Kim
15da327cd2SJung-uk KimThe CRYPTO_memcmp function compares the B<len> bytes pointed to by B<a> and B<b>
16da327cd2SJung-uk Kimfor equality.
17da327cd2SJung-uk KimIt takes an amount of time dependent on B<len>, but independent of the
18da327cd2SJung-uk Kimcontents of the memory regions pointed to by B<a> and B<b>.
19da327cd2SJung-uk Kim
20da327cd2SJung-uk Kim=head1 RETURN VALUES
21da327cd2SJung-uk Kim
2258f35182SJung-uk KimCRYPTO_memcmp() returns 0 if the memory regions are equal and nonzero
23da327cd2SJung-uk Kimotherwise.
24da327cd2SJung-uk Kim
25da327cd2SJung-uk Kim=head1 NOTES
26da327cd2SJung-uk Kim
27da327cd2SJung-uk KimUnlike memcmp(2), this function cannot be used to order the two memory regions
2858f35182SJung-uk Kimas the return value when they differ is undefined, other than being nonzero.
29da327cd2SJung-uk Kim
30da327cd2SJung-uk Kim=head1 COPYRIGHT
31da327cd2SJung-uk Kim
32*b077aed3SPierre ProncheryCopyright 2019 The OpenSSL Project Authors. All Rights Reserved.
33da327cd2SJung-uk Kim
34da327cd2SJung-uk KimLicensed under the Apache License 2.0 (the "License").  You may not use
35da327cd2SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
36da327cd2SJung-uk Kimin the file LICENSE in the source distribution or at
37da327cd2SJung-uk KimL<https://www.openssl.org/source/license.html>.
38da327cd2SJung-uk Kim
39da327cd2SJung-uk Kim=cut
40