A library for setting up Secure Socket Layer (SSL) connections and verifying remote hosts using certificates. Contains only the source files for mbed platform implementation of the library.

Dependents:   HTTPClient-SSL HTTPClient-SSL HTTPClient-SSL HTTPClient-SSL

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-2014 wolfSSL Inc.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
00020  */
00021 
00022 #ifndef NO_MD5
00023 
00024 #ifndef CTAO_CRYPT_MD5_H
00025 #define CTAO_CRYPT_MD5_H
00026 
00027 #include <cyassl/ctaocrypt/types.h>
00028 
00029 #ifdef __cplusplus
00030     extern "C" {
00031 #endif
00032 
00033 
00034 /* in bytes */
00035 enum {
00036 #ifdef STM32F2_HASH
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 #ifdef CYASSL_PIC32MZ_HASH
00046 #include "port/pic32/pic32mz-crypt.h"
00047 #endif
00048 
00049 /* MD5 digest */
00050 typedef struct Md5 {
00051     word32  buffLen;   /* in bytes          */
00052     word32  loLen;     /* length in bytes   */
00053     word32  hiLen;     /* length in bytes   */
00054     word32  buffer[MD5_BLOCK_SIZE  / sizeof(word32)];
00055     #ifndef CYASSL_PIC32MZ_HASH
00056     word32  digest[MD5_DIGEST_SIZE / sizeof(word32)];
00057     #else
00058     word32  digest[PIC32_HASH_SIZE / sizeof(word32)];
00059     pic32mz_desc desc ; /* Crypt Engine descripter */
00060     #endif
00061 } Md5;
00062 
00063 CYASSL_API void InitMd5(Md5*);
00064 CYASSL_API void Md5Update(Md5*, const byte*, word32);
00065 CYASSL_API void Md5Final(Md5*, byte*);
00066 CYASSL_API int  Md5Hash(const byte*, word32, byte*);
00067 
00068 
00069 #ifdef __cplusplus
00070     } /* extern "C" */
00071 #endif
00072 
00073 #endif /* CTAO_CRYPT_MD5_H */
00074 #endif /* NO_MD5 */