"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.11.23/lib/isc/include/isc/hmacmd5.h" (7 Sep 2020, 1786 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 "hmacmd5.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/hmacmd5.h
   14  * \brief This is the header file for the HMAC-MD5 keyed hash algorithm
   15  * described in RFC2104.
   16  */
   17 
   18 #ifndef ISC_HMACMD5_H
   19 #define ISC_HMACMD5_H 1
   20 
   21 #include <pk11/site.h>
   22 
   23 #ifndef PK11_MD5_DISABLE
   24 
   25 #include <stdbool.h>
   26 
   27 #include <isc/lang.h>
   28 #include <isc/md5.h>
   29 #include <isc/platform.h>
   30 #include <isc/types.h>
   31 
   32 #define ISC_HMACMD5_KEYLENGTH 64
   33 
   34 #ifdef ISC_PLATFORM_OPENSSLHASH
   35 #include <openssl/opensslv.h>
   36 #include <openssl/hmac.h>
   37 
   38 typedef struct {
   39     HMAC_CTX *ctx;
   40 #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   41     HMAC_CTX _ctx;
   42 #endif
   43 } isc_hmacmd5_t;
   44 
   45 #elif PKCS11CRYPTO
   46 #include <pk11/pk11.h>
   47 
   48 typedef pk11_context_t isc_hmacmd5_t;
   49 
   50 #else
   51 
   52 typedef struct {
   53     isc_md5_t md5ctx;
   54     unsigned char key[ISC_HMACMD5_KEYLENGTH];
   55 } isc_hmacmd5_t;
   56 #endif
   57 
   58 ISC_LANG_BEGINDECLS
   59 
   60 void
   61 isc_hmacmd5_init(isc_hmacmd5_t *ctx, const unsigned char *key,
   62          unsigned int len);
   63 
   64 void
   65 isc_hmacmd5_invalidate(isc_hmacmd5_t *ctx);
   66 
   67 void
   68 isc_hmacmd5_update(isc_hmacmd5_t *ctx, const unsigned char *buf,
   69            unsigned int len);
   70 
   71 void
   72 isc_hmacmd5_sign(isc_hmacmd5_t *ctx, unsigned char *digest);
   73 
   74 bool
   75 isc_hmacmd5_verify(isc_hmacmd5_t *ctx, unsigned char *digest);
   76 
   77 bool
   78 isc_hmacmd5_verify2(isc_hmacmd5_t *ctx, unsigned char *digest, size_t len);
   79 
   80 bool
   81 isc_hmacmd5_check(int testing);
   82 
   83 ISC_LANG_ENDDECLS
   84 
   85 #endif /* !PK11_MD5_DISABLE */
   86 
   87 #endif /* ISC_HMACMD5_H */