cyassl re-port with cellular comms, PSK test

Dependencies:   VodafoneUSBModem_bleedingedge2 mbed-rtos mbed-src

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers hmac.h Source File

hmac.h

00001 /* hmac.h
00002  *
00003  * Copyright (C) 2012 Sawtooth Consulting Ltd.
00004  *
00005  * This file is part of CyaSSL.
00006  *
00007  * CyaSSL 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  * CyaSSL 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
00020  */
00021 
00022 
00023 /*  hmac.h defines mini hamc openssl compatibility layer 
00024  *
00025  */
00026 
00027 
00028 #ifndef CYASSL_HMAC_H_
00029 #define CYASSL_HMAC_H_
00030 
00031 #include <cyassl/ctaocrypt/settings.h>
00032 
00033 #ifdef YASSL_PREFIX
00034 #include "prefix_hmac.h"
00035 #endif
00036 
00037 #include <cyassl/openssl/evp.h>
00038 #include <cyassl/ctaocrypt/hmac.h>
00039 
00040 #ifdef __cplusplus
00041     extern "C" {
00042 #endif
00043 
00044 
00045 CYASSL_API unsigned char* CyaSSL_HMAC(const CYASSL_EVP_MD* evp_md,
00046                                const void* key, int key_len,
00047                                const unsigned char* d, int n, unsigned char* md,
00048                                unsigned int* md_len);
00049 
00050 
00051 typedef struct CYASSL_HMAC_CTX {
00052     Hmac hmac;
00053     int  type;
00054 } CYASSL_HMAC_CTX;
00055 
00056 
00057 CYASSL_API void CyaSSL_HMAC_Init(CYASSL_HMAC_CTX* ctx, const void* key,
00058                                  int keylen, const EVP_MD* type);
00059 CYASSL_API void CyaSSL_HMAC_Update(CYASSL_HMAC_CTX* ctx,
00060                                    const unsigned char* data, int len);
00061 CYASSL_API void CyaSSL_HMAC_Final(CYASSL_HMAC_CTX* ctx, unsigned char* hash,
00062                                   unsigned int* len);
00063 CYASSL_API void CyaSSL_HMAC_cleanup(CYASSL_HMAC_CTX* ctx);
00064 
00065 
00066 typedef struct CYASSL_HMAC_CTX HMAC_CTX;
00067 
00068 #define HMAC(a,b,c,d,e,f,g) CyaSSL_HMAC((a),(b),(c),(d),(e),(f),(g))
00069 
00070 #define HMAC_Init    CyaSSL_HMAC_Init
00071 #define HMAC_Update  CyaSSL_HMAC_Update
00072 #define HMAC_Final   CyaSSL_HMAC_Final
00073 #define HMAC_cleanup CyaSSL_HMAC_cleanup
00074 
00075 
00076 #ifdef __cplusplus
00077     } /* extern "C" */
00078 #endif
00079 
00080 
00081 #endif /* CYASSL_HMAC_H_ */