LCOV - differential code coverage report
Current view: top level - src/port - timingsafe_bcmp.c (source / functions) Coverage Total Hit CBC
Current: c70b6db34ffeab48beef1fb4ce61bcad3772b8dd vs 06473f5a344df8c9594ead90a609b86f6724cff8 Lines: 100.0 % 2 2 2
Current Date: 2025-09-06 07:49:51 +0900 Functions: 100.0 % 1 1 1
Baseline: lcov-20250906-005545-baseline Line coverage date bins:
Baseline Date: 2025-09-05 08:21:35 +0100 (30,360] days: 100.0 % 2 2 2
Legend: Lines:     hit not hit Function coverage date bins:
(30,360] days: 100.0 % 1 1 1

 Age         Owner                  TLA  Line data    Source code
                                  1                 : /*
                                  2                 :  * src/port/timingsafe_bcmp.c
                                  3                 :  *
                                  4                 :  *  $OpenBSD: timingsafe_bcmp.c,v 1.3 2015/08/31 02:53:57 guenther Exp $
                                  5                 :  */
                                  6                 : 
                                  7                 : /*
                                  8                 :  * Copyright (c) 2010 Damien Miller.  All rights reserved.
                                  9                 :  *
                                 10                 :  * Permission to use, copy, modify, and distribute this software for any
                                 11                 :  * purpose with or without fee is hereby granted, provided that the above
                                 12                 :  * copyright notice and this permission notice appear in all copies.
                                 13                 :  *
                                 14                 :  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                                 15                 :  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                                 16                 :  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                                 17                 :  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                                 18                 :  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                                 19                 :  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                                 20                 :  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                                 21                 :  */
                                 22                 : 
                                 23                 : #include "c.h"
                                 24                 : 
                                 25                 : #ifdef USE_SSL
                                 26                 : #include <openssl/crypto.h>
                                 27                 : #endif
                                 28                 : 
                                 29                 : int
  157 heikki.linnakangas@i       30 CBC          16 : timingsafe_bcmp(const void *b1, const void *b2, size_t n)
                                 31                 : {
                                 32                 : #ifdef USE_SSL
                                 33              16 :     return CRYPTO_memcmp(b1, b2, n);
                                 34                 : #else
                                 35                 :     const unsigned char *p1 = b1,
                                 36                 :                *p2 = b2;
                                 37                 :     int         ret = 0;
                                 38                 : 
                                 39                 :     for (; n > 0; n--)
                                 40                 :         ret |= *p1++ ^ *p2++;
                                 41                 :     return (ret != 0);
                                 42                 : #endif
                                 43                 : }
        

Generated by: LCOV version 2.4-beta