"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.11.23/lib/isc/include/isc/md5.h" (7 Sep 2020, 2348 Bytes) of package /linux/misc/dns/bind9/9.11.23/bind-9.11.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "md5.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
    3  *
    4  * This Source Code Form is subject to the terms of the Mozilla Public
    5  * License, v. 2.0. If a copy of the MPL was not distributed with this
    6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    7  *
    8  * See the COPYRIGHT file distributed with this work for additional
    9  * information regarding copyright ownership.
   10  */
   11 
   12 
   13 /*! \file isc/md5.h
   14  * \brief This is the header file for the MD5 message-digest algorithm.
   15  *
   16  * The algorithm is due to Ron Rivest.  This code was
   17  * written by Colin Plumb in 1993, no copyright is claimed.
   18  * This code is in the public domain; do with it what you wish.
   19  *
   20  * Equivalent code is available from RSA Data Security, Inc.
   21  * This code has been tested against that, and is equivalent,
   22  * except that you don't need to include two pages of legalese
   23  * with every copy.
   24  *
   25  * To compute the message digest of a chunk of bytes, declare an
   26  * MD5Context structure, pass it to MD5Init, call MD5Update as
   27  * needed on buffers full of bytes, and then call MD5Final, which
   28  * will fill a supplied 16-byte array with the digest.
   29  *
   30  * Changed so as no longer to depend on Colin Plumb's `usual.h'
   31  * header definitions; now uses stuff from dpkg's config.h
   32  *  - Ian Jackson <ijackson@nyx.cs.du.edu>.
   33  * Still in the public domain.
   34  */
   35 
   36 #ifndef ISC_MD5_H
   37 #define ISC_MD5_H 1
   38 
   39 #include <pk11/site.h>
   40 
   41 #ifndef PK11_MD5_DISABLE
   42 
   43 #include <stdbool.h>
   44 
   45 #include <isc/lang.h>
   46 #include <isc/platform.h>
   47 #include <isc/types.h>
   48 
   49 #define ISC_MD5_DIGESTLENGTH 16U
   50 #define ISC_MD5_BLOCK_LENGTH 64U
   51 
   52 #ifdef ISC_PLATFORM_OPENSSLHASH
   53 #include <openssl/opensslv.h>
   54 #include <openssl/evp.h>
   55 
   56 typedef struct {
   57     EVP_MD_CTX *ctx;
   58 #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   59     EVP_MD_CTX _ctx;
   60 #endif
   61 } isc_md5_t;
   62 
   63 #elif PKCS11CRYPTO
   64 #include <pk11/pk11.h>
   65 
   66 typedef pk11_context_t isc_md5_t;
   67 
   68 #else
   69 
   70 typedef struct {
   71     uint32_t buf[4];
   72     uint32_t bytes[2];
   73     uint32_t in[16];
   74 } isc_md5_t;
   75 #endif
   76 
   77 ISC_LANG_BEGINDECLS
   78 
   79 void
   80 isc_md5_init(isc_md5_t *ctx);
   81 
   82 void
   83 isc_md5_invalidate(isc_md5_t *ctx);
   84 
   85 void
   86 isc_md5_update(isc_md5_t *ctx, const unsigned char *buf, unsigned int len);
   87 
   88 void
   89 isc_md5_final(isc_md5_t *ctx, unsigned char *digest);
   90 
   91 bool
   92 isc_md5_check(bool testing);
   93 
   94 ISC_LANG_ENDDECLS
   95 
   96 #endif /* !PK11_MD5_DISABLE */
   97 
   98 #endif /* ISC_MD5_H */