Renesas / SecureDweet
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers hmac.h Source File

hmac.h

00001 /* hmac.h
00002  *
00003  * Copyright (C) 2006-2016 wolfSSL Inc.
00004  *
00005  * This file is part of wolfSSL.
00006  *
00007  * wolfSSL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * wolfSSL is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
00020  */
00021 
00022 
00023 
00024 /*  hmac.h defines mini hamc openssl compatibility layer 
00025  *
00026  */
00027 
00028 
00029 #ifndef WOLFSSL_HMAC_H_
00030 #define WOLFSSL_HMAC_H_
00031 
00032 #include <wolfssl/wolfcrypt/settings.h>
00033 
00034 #ifdef WOLFSSL_PREFIX
00035 #include "prefix_hmac.h"
00036 #endif
00037 
00038 #include <wolfssl/openssl/evp.h>
00039 #include <wolfssl/wolfcrypt/hmac.h>
00040 
00041 #ifdef __cplusplus
00042     extern "C" {
00043 #endif
00044 
00045 
00046 WOLFSSL_API unsigned char* wolfSSL_HMAC(const WOLFSSL_EVP_MD* evp_md,
00047                                const void* key, int key_len,
00048                                const unsigned char* d, int n, unsigned char* md,
00049                                unsigned int* md_len);
00050 
00051 
00052 typedef struct WOLFSSL_HMAC_CTX {
00053     Hmac hmac;
00054     int  type;
00055 } WOLFSSL_HMAC_CTX;
00056 
00057 
00058 WOLFSSL_API void wolfSSL_HMAC_Init(WOLFSSL_HMAC_CTX* ctx, const void* key,
00059                                  int keylen, const EVP_MD* type);
00060 WOLFSSL_API void wolfSSL_HMAC_Update(WOLFSSL_HMAC_CTX* ctx,
00061                                    const unsigned char* data, int len);
00062 WOLFSSL_API void wolfSSL_HMAC_Final(WOLFSSL_HMAC_CTX* ctx, unsigned char* hash,
00063                                   unsigned int* len);
00064 WOLFSSL_API void wolfSSL_HMAC_cleanup(WOLFSSL_HMAC_CTX* ctx);
00065 
00066 
00067 typedef struct WOLFSSL_HMAC_CTX HMAC_CTX;
00068 
00069 #define HMAC(a,b,c,d,e,f,g) wolfSSL_HMAC((a),(b),(c),(d),(e),(f),(g))
00070 
00071 #define HMAC_Init    wolfSSL_HMAC_Init
00072 #define HMAC_Update  wolfSSL_HMAC_Update
00073 #define HMAC_Final   wolfSSL_HMAC_Final
00074 #define HMAC_cleanup wolfSSL_HMAC_cleanup
00075 
00076 
00077 #ifdef __cplusplus
00078     } /* extern "C" */
00079 #endif
00080 
00081 
00082 #endif /* WOLFSSL_HMAC_H_ */
00083