Files
bind9/lib/isc/include/isc/sha1.h
2018-08-08 09:37:30 +02:00

55 lines
1.1 KiB
C

/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
#pragma once
/*! \file isc/sha1.h
* \brief SHA-1 in C
*/
#include <stdbool.h>
#include <isc/lang.h>
#include <isc/platform.h>
#include <isc/types.h>
#define ISC_SHA1_DIGESTLENGTH 20U
#define ISC_SHA1_BLOCK_LENGTH 64U
#include <openssl/opensslv.h>
#include <openssl/evp.h>
typedef struct {
EVP_MD_CTX *ctx;
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
EVP_MD_CTX _ctx;
#endif
} isc_sha1_t;
ISC_LANG_BEGINDECLS
void
isc_sha1_init(isc_sha1_t *ctx);
void
isc_sha1_invalidate(isc_sha1_t *ctx);
void
isc_sha1_update(isc_sha1_t *ctx, const unsigned char *data, unsigned int len);
void
isc_sha1_final(isc_sha1_t *ctx, unsigned char *digest);
bool
isc_sha1_check(bool testing);
ISC_LANG_ENDDECLS