Coverage Report

Created: 2025-10-10 07:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/sudo/plugins/sudoers/digestname.c
Line
Count
Source
1
/*
2
 * SPDX-License-Identifier: ISC
3
 *
4
 * Copyright (c) 2017 Todd C. Miller <Todd.Miller@sudo.ws>
5
 *
6
 * Permission to use, copy, modify, and distribute this software for any
7
 * purpose with or without fee is hereby granted, provided that the above
8
 * copyright notice and this permission notice appear in all copies.
9
 *
10
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
 */
18
19
#include <config.h>
20
21
#include <sudo_compat.h>
22
#include <sudo_digest.h>
23
#include <sudoers_debug.h>
24
#include <parse.h>
25
26
const char *
27
digest_type_to_name(unsigned int digest_type)
28
0
{
29
0
    const char *digest_name;
30
0
    debug_decl(digest_type_to_name, SUDOERS_DEBUG_UTIL);
31
32
0
    switch (digest_type) {
33
0
    case SUDO_DIGEST_SHA224:
34
0
  digest_name = "sha224";
35
0
  break;
36
0
    case SUDO_DIGEST_SHA256:
37
0
  digest_name = "sha256";
38
0
  break;
39
0
    case SUDO_DIGEST_SHA384:
40
0
  digest_name = "sha384";
41
0
  break;
42
0
    case SUDO_DIGEST_SHA512:
43
0
  digest_name = "sha512";
44
0
  break;
45
0
    default:
46
0
  digest_name = "unknown digest";
47
0
  break;
48
0
    }
49
0
    debug_return_const_str(digest_name);
50
0
}