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 /* visibility.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 /* Visibility control macros */
igrokhotkov 0:83f3dcfa5c8f 23
igrokhotkov 0:83f3dcfa5c8f 24
igrokhotkov 0:83f3dcfa5c8f 25 #ifndef CTAO_CRYPT_VISIBILITY_H
igrokhotkov 0:83f3dcfa5c8f 26 #define CTAO_CRYPT_VISIBILITY_H
igrokhotkov 0:83f3dcfa5c8f 27
igrokhotkov 0:83f3dcfa5c8f 28
igrokhotkov 0:83f3dcfa5c8f 29 /* CYASSL_API is used for the public API symbols.
igrokhotkov 0:83f3dcfa5c8f 30 It either imports or exports (or does nothing for static builds)
igrokhotkov 0:83f3dcfa5c8f 31
igrokhotkov 0:83f3dcfa5c8f 32 CYASSL_LOCAL is used for non-API symbols (private).
igrokhotkov 0:83f3dcfa5c8f 33 */
igrokhotkov 0:83f3dcfa5c8f 34
igrokhotkov 0:83f3dcfa5c8f 35 #if defined(BUILDING_CYASSL)
igrokhotkov 0:83f3dcfa5c8f 36 #if defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
igrokhotkov 0:83f3dcfa5c8f 37 #define CYASSL_API __attribute__ ((visibility("default")))
igrokhotkov 0:83f3dcfa5c8f 38 #define CYASSL_LOCAL __attribute__ ((visibility("hidden")))
igrokhotkov 0:83f3dcfa5c8f 39 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
igrokhotkov 0:83f3dcfa5c8f 40 #define CYASSL_API __global
igrokhotkov 0:83f3dcfa5c8f 41 #define CYASSL_LOCAL __hidden
igrokhotkov 0:83f3dcfa5c8f 42 #elif defined(_MSC_VER)
igrokhotkov 0:83f3dcfa5c8f 43 #ifdef CYASSL_DLL
igrokhotkov 0:83f3dcfa5c8f 44 #define CYASSL_API extern __declspec(dllexport)
igrokhotkov 0:83f3dcfa5c8f 45 #else
igrokhotkov 0:83f3dcfa5c8f 46 #define CYASSL_API
igrokhotkov 0:83f3dcfa5c8f 47 #endif
igrokhotkov 0:83f3dcfa5c8f 48 #define CYASSL_LOCAL
igrokhotkov 0:83f3dcfa5c8f 49 #else
igrokhotkov 0:83f3dcfa5c8f 50 #define CYASSL_API
igrokhotkov 0:83f3dcfa5c8f 51 #define CYASSL_LOCAL
igrokhotkov 0:83f3dcfa5c8f 52 #endif /* HAVE_VISIBILITY */
igrokhotkov 0:83f3dcfa5c8f 53 #else /* BUILDING_CYASSL */
igrokhotkov 0:83f3dcfa5c8f 54 #if defined(_MSC_VER)
igrokhotkov 0:83f3dcfa5c8f 55 #ifdef CYASSL_DLL
igrokhotkov 0:83f3dcfa5c8f 56 #define CYASSL_API extern __declspec(dllimport)
igrokhotkov 0:83f3dcfa5c8f 57 #else
igrokhotkov 0:83f3dcfa5c8f 58 #define CYASSL_API
igrokhotkov 0:83f3dcfa5c8f 59 #endif
igrokhotkov 0:83f3dcfa5c8f 60 #define CYASSL_LOCAL
igrokhotkov 0:83f3dcfa5c8f 61 #else
igrokhotkov 0:83f3dcfa5c8f 62 #define CYASSL_API
igrokhotkov 0:83f3dcfa5c8f 63 #define CYASSL_LOCAL
igrokhotkov 0:83f3dcfa5c8f 64 #endif
igrokhotkov 0:83f3dcfa5c8f 65 #endif /* BUILDING_CYASSL */
igrokhotkov 0:83f3dcfa5c8f 66
igrokhotkov 0:83f3dcfa5c8f 67
igrokhotkov 0:83f3dcfa5c8f 68 #endif /* CTAO_CRYPT_VISIBILITY_H */
igrokhotkov 0:83f3dcfa5c8f 69