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

Dependents:   RFrec_full RFtrans_full

The output will be base64-encoded, with trailing "==", like this:

j62o/jZsAZD9i9m+32lIuQ==

Example

#include "mbed.h"
#include "hmac_md5.h"

Serial pc(USBTX, USBRX); // tx, rx

void main(void)
{
    
    const char * key = "MySecretKey";
    
    const char * text = "message to be signed";
    
    char output[26];
    
    HMAC_MD5(key, text, output);

    printf("result = %s\n", output);

    while(true){}
}
Committer:
igrokhotkov
Date:
Wed Feb 06 20:35:03 2013 +0000
Revision:
0:83f3dcfa5c8f
initial revision

Who changed what in which revision?

UserRevisionLine numberNew contents of line
igrokhotkov 0:83f3dcfa5c8f 1 /* memory.h
igrokhotkov 0:83f3dcfa5c8f 2 *
igrokhotkov 0:83f3dcfa5c8f 3 * Copyright (C) 2006-2012 Sawtooth Consulting Ltd.
igrokhotkov 0:83f3dcfa5c8f 4 *
igrokhotkov 0:83f3dcfa5c8f 5 * This file is part of CyaSSL.
igrokhotkov 0:83f3dcfa5c8f 6 *
igrokhotkov 0:83f3dcfa5c8f 7 * CyaSSL is free software; you can redistribute it and/or modify
igrokhotkov 0:83f3dcfa5c8f 8 * it under the terms of the GNU General Public License as published by
igrokhotkov 0:83f3dcfa5c8f 9 * the Free Software Foundation; either version 2 of the License, or
igrokhotkov 0:83f3dcfa5c8f 10 * (at your option) any later version.
igrokhotkov 0:83f3dcfa5c8f 11 *
igrokhotkov 0:83f3dcfa5c8f 12 * CyaSSL is distributed in the hope that it will be useful,
igrokhotkov 0:83f3dcfa5c8f 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
igrokhotkov 0:83f3dcfa5c8f 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
igrokhotkov 0:83f3dcfa5c8f 15 * GNU General Public License for more details.
igrokhotkov 0:83f3dcfa5c8f 16 *
igrokhotkov 0:83f3dcfa5c8f 17 * You should have received a copy of the GNU General Public License
igrokhotkov 0:83f3dcfa5c8f 18 * along with this program; if not, write to the Free Software
igrokhotkov 0:83f3dcfa5c8f 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
igrokhotkov 0:83f3dcfa5c8f 20 */
igrokhotkov 0:83f3dcfa5c8f 21
igrokhotkov 0:83f3dcfa5c8f 22 /* submitted by eof */
igrokhotkov 0:83f3dcfa5c8f 23
igrokhotkov 0:83f3dcfa5c8f 24
igrokhotkov 0:83f3dcfa5c8f 25 #ifndef CYASSL_MEMORY_H
igrokhotkov 0:83f3dcfa5c8f 26 #define CYASSL_MEMORY_H
igrokhotkov 0:83f3dcfa5c8f 27
igrokhotkov 0:83f3dcfa5c8f 28 #include <stdlib.h>
igrokhotkov 0:83f3dcfa5c8f 29
igrokhotkov 0:83f3dcfa5c8f 30 #ifdef __cplusplus
igrokhotkov 0:83f3dcfa5c8f 31 extern "C" {
igrokhotkov 0:83f3dcfa5c8f 32 #endif
igrokhotkov 0:83f3dcfa5c8f 33
igrokhotkov 0:83f3dcfa5c8f 34
igrokhotkov 0:83f3dcfa5c8f 35 typedef void *(*CyaSSL_Malloc_cb)(size_t size);
igrokhotkov 0:83f3dcfa5c8f 36 typedef void (*CyaSSL_Free_cb)(void *ptr);
igrokhotkov 0:83f3dcfa5c8f 37 typedef void *(*CyaSSL_Realloc_cb)(void *ptr, size_t size);
igrokhotkov 0:83f3dcfa5c8f 38
igrokhotkov 0:83f3dcfa5c8f 39
igrokhotkov 0:83f3dcfa5c8f 40 /* Public set function */
igrokhotkov 0:83f3dcfa5c8f 41 CYASSL_API int CyaSSL_SetAllocators(CyaSSL_Malloc_cb malloc_function,
igrokhotkov 0:83f3dcfa5c8f 42 CyaSSL_Free_cb free_function,
igrokhotkov 0:83f3dcfa5c8f 43 CyaSSL_Realloc_cb realloc_function);
igrokhotkov 0:83f3dcfa5c8f 44
igrokhotkov 0:83f3dcfa5c8f 45 /* Public in case user app wants to use XMALLOC/XFREE */
igrokhotkov 0:83f3dcfa5c8f 46 CYASSL_API void* CyaSSL_Malloc(size_t size);
igrokhotkov 0:83f3dcfa5c8f 47 CYASSL_API void CyaSSL_Free(void *ptr);
igrokhotkov 0:83f3dcfa5c8f 48 CYASSL_API void* CyaSSL_Realloc(void *ptr, size_t size);
igrokhotkov 0:83f3dcfa5c8f 49
igrokhotkov 0:83f3dcfa5c8f 50
igrokhotkov 0:83f3dcfa5c8f 51 #ifdef __cplusplus
igrokhotkov 0:83f3dcfa5c8f 52 }
igrokhotkov 0:83f3dcfa5c8f 53 #endif
igrokhotkov 0:83f3dcfa5c8f 54
igrokhotkov 0:83f3dcfa5c8f 55 #endif /* CYASSL_MEMORY_H */