A simple CyaSSL-based HMAC-MD5 implementation. Licensed under GPL v2.

Dependents:   RFrec_full RFtrans_full

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers md5.h Source File

md5.h

00001 /* md5.h
00002  *
00003  * Copyright (C) 2006-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 #ifndef NO_MD5
00023 
00024 #ifndef CTAO_CRYPT_MD5_H
00025 #define CTAO_CRYPT_MD5_H
00026 
00027 #include "types.h"
00028 
00029 #ifdef __cplusplus
00030     extern "C" {
00031 #endif
00032 
00033 
00034 /* in bytes */
00035 enum {
00036 #ifdef STM32F2_CRYPTO
00037     MD5_REG_SIZE    =  4,      /* STM32 register size, bytes */
00038 #endif
00039     MD5             =  0,      /* hash type unique */
00040     MD5_BLOCK_SIZE  = 64,
00041     MD5_DIGEST_SIZE = 16,
00042     MD5_PAD_SIZE    = 56
00043 };
00044 
00045 
00046 /* MD5 digest */
00047 typedef struct Md5 {
00048     word32  buffLen;   /* in bytes          */
00049     word32  loLen;     /* length in bytes   */
00050     word32  hiLen;     /* length in bytes   */
00051     word32  digest[MD5_DIGEST_SIZE / sizeof(word32)];
00052     word32  buffer[MD5_BLOCK_SIZE  / sizeof(word32)];
00053 } Md5;
00054 
00055 
00056 CYASSL_API void InitMd5(Md5*);
00057 CYASSL_API void Md5Update(Md5*, const byte*, word32);
00058 CYASSL_API void Md5Final(Md5*, byte*);
00059 
00060 
00061 #ifdef __cplusplus
00062     } /* extern "C" */
00063 #endif
00064 
00065 #endif /* CTAO_CRYPT_MD5_H */
00066 #endif /* NO_MD5 */