/*1* SPDX-License-Identifier: ISC2*3* Copyright (c) 2017 Todd C. Miller <[email protected]>4*5* Permission to use, copy, modify, and distribute this software for any6* purpose with or without fee is hereby granted, provided that the above7* copyright notice and this permission notice appear in all copies.8*9* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES10* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF11* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR12* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES13* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN14* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF15* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.16*/1718#include <config.h>1920#include <sudo_compat.h>21#include <sudo_digest.h>22#include <sudoers_debug.h>23#include <parse.h>2425const char *26digest_type_to_name(unsigned int digest_type)27{28const char *digest_name;29debug_decl(digest_type_to_name, SUDOERS_DEBUG_UTIL);3031switch (digest_type) {32case SUDO_DIGEST_SHA224:33digest_name = "sha224";34break;35case SUDO_DIGEST_SHA256:36digest_name = "sha256";37break;38case SUDO_DIGEST_SHA384:39digest_name = "sha384";40break;41case SUDO_DIGEST_SHA512:42digest_name = "sha512";43break;44default:45digest_name = "unknown digest";46break;47}48debug_return_const_str(digest_name);49}505152