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

Committer:
Mike Fiore
Date:
Mon Mar 23 16:51:07 2015 -0500
Revision:
6:cf58d49e1a86
Parent:
0:b86d15c6ba29
fix whitespace in sha512.c

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Vanger 0:b86d15c6ba29 1 /* sha.h
Vanger 0:b86d15c6ba29 2 *
Vanger 0:b86d15c6ba29 3 * Copyright (C) 2006-2014 wolfSSL Inc.
Vanger 0:b86d15c6ba29 4 *
Vanger 0:b86d15c6ba29 5 * This file is part of CyaSSL.
Vanger 0:b86d15c6ba29 6 *
Vanger 0:b86d15c6ba29 7 * CyaSSL is free software; you can redistribute it and/or modify
Vanger 0:b86d15c6ba29 8 * it under the terms of the GNU General Public License as published by
Vanger 0:b86d15c6ba29 9 * the Free Software Foundation; either version 2 of the License, or
Vanger 0:b86d15c6ba29 10 * (at your option) any later version.
Vanger 0:b86d15c6ba29 11 *
Vanger 0:b86d15c6ba29 12 * CyaSSL is distributed in the hope that it will be useful,
Vanger 0:b86d15c6ba29 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Vanger 0:b86d15c6ba29 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Vanger 0:b86d15c6ba29 15 * GNU General Public License for more details.
Vanger 0:b86d15c6ba29 16 *
Vanger 0:b86d15c6ba29 17 * You should have received a copy of the GNU General Public License
Vanger 0:b86d15c6ba29 18 * along with this program; if not, write to the Free Software
Vanger 0:b86d15c6ba29 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Vanger 0:b86d15c6ba29 20 */
Vanger 0:b86d15c6ba29 21
Vanger 0:b86d15c6ba29 22
Vanger 0:b86d15c6ba29 23 #ifndef NO_SHA
Vanger 0:b86d15c6ba29 24
Vanger 0:b86d15c6ba29 25 #ifndef CTAO_CRYPT_SHA_H
Vanger 0:b86d15c6ba29 26 #define CTAO_CRYPT_SHA_H
Vanger 0:b86d15c6ba29 27
Vanger 0:b86d15c6ba29 28 #include <cyassl/ctaocrypt/types.h>
Vanger 0:b86d15c6ba29 29
Vanger 0:b86d15c6ba29 30 #ifdef __cplusplus
Vanger 0:b86d15c6ba29 31 extern "C" {
Vanger 0:b86d15c6ba29 32 #endif
Vanger 0:b86d15c6ba29 33
Vanger 0:b86d15c6ba29 34
Vanger 0:b86d15c6ba29 35 /* in bytes */
Vanger 0:b86d15c6ba29 36 enum {
Vanger 0:b86d15c6ba29 37 #ifdef STM32F2_HASH
Vanger 0:b86d15c6ba29 38 SHA_REG_SIZE = 4, /* STM32 register size, bytes */
Vanger 0:b86d15c6ba29 39 #endif
Vanger 0:b86d15c6ba29 40 SHA = 1, /* hash type unique */
Vanger 0:b86d15c6ba29 41 SHA_BLOCK_SIZE = 64,
Vanger 0:b86d15c6ba29 42 SHA_DIGEST_SIZE = 20,
Vanger 0:b86d15c6ba29 43 SHA_PAD_SIZE = 56
Vanger 0:b86d15c6ba29 44 };
Vanger 0:b86d15c6ba29 45
Vanger 0:b86d15c6ba29 46 #ifdef CYASSL_PIC32MZ_HASH
Vanger 0:b86d15c6ba29 47 #include "port/pic32/pic32mz-crypt.h"
Vanger 0:b86d15c6ba29 48 #endif
Vanger 0:b86d15c6ba29 49
Vanger 0:b86d15c6ba29 50 /* Sha digest */
Vanger 0:b86d15c6ba29 51 typedef struct Sha {
Vanger 0:b86d15c6ba29 52 word32 buffLen; /* in bytes */
Vanger 0:b86d15c6ba29 53 word32 loLen; /* length in bytes */
Vanger 0:b86d15c6ba29 54 word32 hiLen; /* length in bytes */
Vanger 0:b86d15c6ba29 55 word32 buffer[SHA_BLOCK_SIZE / sizeof(word32)];
Vanger 0:b86d15c6ba29 56 #ifndef CYASSL_PIC32MZ_HASH
Vanger 0:b86d15c6ba29 57 word32 digest[SHA_DIGEST_SIZE / sizeof(word32)];
Vanger 0:b86d15c6ba29 58 #else
Vanger 0:b86d15c6ba29 59 word32 digest[PIC32_HASH_SIZE / sizeof(word32)];
Vanger 0:b86d15c6ba29 60 pic32mz_desc desc; /* Crypt Engine descripter */
Vanger 0:b86d15c6ba29 61 #endif
Vanger 0:b86d15c6ba29 62 } Sha;
Vanger 0:b86d15c6ba29 63
Vanger 0:b86d15c6ba29 64
Vanger 0:b86d15c6ba29 65 CYASSL_API int InitSha(Sha*);
Vanger 0:b86d15c6ba29 66 CYASSL_API int ShaUpdate(Sha*, const byte*, word32);
Vanger 0:b86d15c6ba29 67 CYASSL_API int ShaFinal(Sha*, byte*);
Vanger 0:b86d15c6ba29 68 CYASSL_API int ShaHash(const byte*, word32, byte*);
Vanger 0:b86d15c6ba29 69
Vanger 0:b86d15c6ba29 70
Vanger 0:b86d15c6ba29 71 #ifdef HAVE_FIPS
Vanger 0:b86d15c6ba29 72 /* fips wrapper calls, user can call direct */
Vanger 0:b86d15c6ba29 73 CYASSL_API int InitSha_fips(Sha*);
Vanger 0:b86d15c6ba29 74 CYASSL_API int ShaUpdate_fips(Sha*, const byte*, word32);
Vanger 0:b86d15c6ba29 75 CYASSL_API int ShaFinal_fips(Sha*, byte*);
Vanger 0:b86d15c6ba29 76 #ifndef FIPS_NO_WRAPPERS
Vanger 0:b86d15c6ba29 77 /* if not impl or fips.c impl wrapper force fips calls if fips build */
Vanger 0:b86d15c6ba29 78 #define InitSha InitSha_fips
Vanger 0:b86d15c6ba29 79 #define ShaUpdate ShaUpdate_fips
Vanger 0:b86d15c6ba29 80 #define ShaFinal ShaFinal_fips
Vanger 0:b86d15c6ba29 81 #endif /* FIPS_NO_WRAPPERS */
Vanger 0:b86d15c6ba29 82
Vanger 0:b86d15c6ba29 83 #endif /* HAVE_FIPS */
Vanger 0:b86d15c6ba29 84
Vanger 0:b86d15c6ba29 85
Vanger 0:b86d15c6ba29 86 #ifdef __cplusplus
Vanger 0:b86d15c6ba29 87 } /* extern "C" */
Vanger 0:b86d15c6ba29 88 #endif
Vanger 0:b86d15c6ba29 89
Vanger 0:b86d15c6ba29 90 #endif /* CTAO_CRYPT_SHA_H */
Vanger 0:b86d15c6ba29 91 #endif /* NO_SHA */
Vanger 0:b86d15c6ba29 92