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:
Vanger
Date:
Mon Jan 19 21:45:42 2015 +0000
Revision:
0:b86d15c6ba29
Updated CyaSSL Library to 3.3.0. Changed Settings and functions to be implemented for mbed platforms

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Vanger 0:b86d15c6ba29 1 /* sha.h for openssl */
Vanger 0:b86d15c6ba29 2
Vanger 0:b86d15c6ba29 3
Vanger 0:b86d15c6ba29 4 #ifndef CYASSL_SHA_H_
Vanger 0:b86d15c6ba29 5 #define CYASSL_SHA_H_
Vanger 0:b86d15c6ba29 6
Vanger 0:b86d15c6ba29 7 #include <cyassl/ctaocrypt/settings.h>
Vanger 0:b86d15c6ba29 8
Vanger 0:b86d15c6ba29 9 #ifdef YASSL_PREFIX
Vanger 0:b86d15c6ba29 10 #include "prefix_sha.h"
Vanger 0:b86d15c6ba29 11 #endif
Vanger 0:b86d15c6ba29 12
Vanger 0:b86d15c6ba29 13 #ifdef __cplusplus
Vanger 0:b86d15c6ba29 14 extern "C" {
Vanger 0:b86d15c6ba29 15 #endif
Vanger 0:b86d15c6ba29 16
Vanger 0:b86d15c6ba29 17
Vanger 0:b86d15c6ba29 18 typedef struct CYASSL_SHA_CTX {
Vanger 0:b86d15c6ba29 19 int holder[24]; /* big enough to hold ctaocrypt sha, but check on init */
Vanger 0:b86d15c6ba29 20 } CYASSL_SHA_CTX;
Vanger 0:b86d15c6ba29 21
Vanger 0:b86d15c6ba29 22 CYASSL_API void CyaSSL_SHA_Init(CYASSL_SHA_CTX*);
Vanger 0:b86d15c6ba29 23 CYASSL_API void CyaSSL_SHA_Update(CYASSL_SHA_CTX*, const void*, unsigned long);
Vanger 0:b86d15c6ba29 24 CYASSL_API void CyaSSL_SHA_Final(unsigned char*, CYASSL_SHA_CTX*);
Vanger 0:b86d15c6ba29 25
Vanger 0:b86d15c6ba29 26 /* SHA1 points to above, shouldn't use SHA0 ever */
Vanger 0:b86d15c6ba29 27 CYASSL_API void CyaSSL_SHA1_Init(CYASSL_SHA_CTX*);
Vanger 0:b86d15c6ba29 28 CYASSL_API void CyaSSL_SHA1_Update(CYASSL_SHA_CTX*, const void*, unsigned long);
Vanger 0:b86d15c6ba29 29 CYASSL_API void CyaSSL_SHA1_Final(unsigned char*, CYASSL_SHA_CTX*);
Vanger 0:b86d15c6ba29 30
Vanger 0:b86d15c6ba29 31 enum {
Vanger 0:b86d15c6ba29 32 SHA_DIGEST_LENGTH = 20
Vanger 0:b86d15c6ba29 33 };
Vanger 0:b86d15c6ba29 34
Vanger 0:b86d15c6ba29 35
Vanger 0:b86d15c6ba29 36 typedef CYASSL_SHA_CTX SHA_CTX;
Vanger 0:b86d15c6ba29 37
Vanger 0:b86d15c6ba29 38 #define SHA_Init CyaSSL_SHA_Init
Vanger 0:b86d15c6ba29 39 #define SHA_Update CyaSSL_SHA_Update
Vanger 0:b86d15c6ba29 40 #define SHA_Final CyaSSL_SHA_Final
Vanger 0:b86d15c6ba29 41
Vanger 0:b86d15c6ba29 42 #define SHA1_Init CyaSSL_SHA1_Init
Vanger 0:b86d15c6ba29 43 #define SHA1_Update CyaSSL_SHA1_Update
Vanger 0:b86d15c6ba29 44 #define SHA1_Final CyaSSL_SHA1_Final
Vanger 0:b86d15c6ba29 45
Vanger 0:b86d15c6ba29 46
Vanger 0:b86d15c6ba29 47 typedef struct CYASSL_SHA256_CTX {
Vanger 0:b86d15c6ba29 48 int holder[28]; /* big enough to hold ctaocrypt sha, but check on init */
Vanger 0:b86d15c6ba29 49 } CYASSL_SHA256_CTX;
Vanger 0:b86d15c6ba29 50
Vanger 0:b86d15c6ba29 51 CYASSL_API void CyaSSL_SHA256_Init(CYASSL_SHA256_CTX*);
Vanger 0:b86d15c6ba29 52 CYASSL_API void CyaSSL_SHA256_Update(CYASSL_SHA256_CTX*, const void*,
Vanger 0:b86d15c6ba29 53 unsigned long);
Vanger 0:b86d15c6ba29 54 CYASSL_API void CyaSSL_SHA256_Final(unsigned char*, CYASSL_SHA256_CTX*);
Vanger 0:b86d15c6ba29 55
Vanger 0:b86d15c6ba29 56 enum {
Vanger 0:b86d15c6ba29 57 SHA256_DIGEST_LENGTH = 32
Vanger 0:b86d15c6ba29 58 };
Vanger 0:b86d15c6ba29 59
Vanger 0:b86d15c6ba29 60
Vanger 0:b86d15c6ba29 61 typedef CYASSL_SHA256_CTX SHA256_CTX;
Vanger 0:b86d15c6ba29 62
Vanger 0:b86d15c6ba29 63 #define SHA256_Init CyaSSL_SHA256_Init
Vanger 0:b86d15c6ba29 64 #define SHA256_Update CyaSSL_SHA256_Update
Vanger 0:b86d15c6ba29 65 #define SHA256_Final CyaSSL_SHA256_Final
Vanger 0:b86d15c6ba29 66
Vanger 0:b86d15c6ba29 67
Vanger 0:b86d15c6ba29 68 #ifdef CYASSL_SHA384
Vanger 0:b86d15c6ba29 69
Vanger 0:b86d15c6ba29 70 typedef struct CYASSL_SHA384_CTX {
Vanger 0:b86d15c6ba29 71 long long holder[32]; /* big enough, but check on init */
Vanger 0:b86d15c6ba29 72 } CYASSL_SHA384_CTX;
Vanger 0:b86d15c6ba29 73
Vanger 0:b86d15c6ba29 74 CYASSL_API void CyaSSL_SHA384_Init(CYASSL_SHA384_CTX*);
Vanger 0:b86d15c6ba29 75 CYASSL_API void CyaSSL_SHA384_Update(CYASSL_SHA384_CTX*, const void*,
Vanger 0:b86d15c6ba29 76 unsigned long);
Vanger 0:b86d15c6ba29 77 CYASSL_API void CyaSSL_SHA384_Final(unsigned char*, CYASSL_SHA384_CTX*);
Vanger 0:b86d15c6ba29 78
Vanger 0:b86d15c6ba29 79 enum {
Vanger 0:b86d15c6ba29 80 SHA384_DIGEST_LENGTH = 48
Vanger 0:b86d15c6ba29 81 };
Vanger 0:b86d15c6ba29 82
Vanger 0:b86d15c6ba29 83
Vanger 0:b86d15c6ba29 84 typedef CYASSL_SHA384_CTX SHA384_CTX;
Vanger 0:b86d15c6ba29 85
Vanger 0:b86d15c6ba29 86 #define SHA384_Init CyaSSL_SHA384_Init
Vanger 0:b86d15c6ba29 87 #define SHA384_Update CyaSSL_SHA384_Update
Vanger 0:b86d15c6ba29 88 #define SHA384_Final CyaSSL_SHA384_Final
Vanger 0:b86d15c6ba29 89
Vanger 0:b86d15c6ba29 90 #endif /* CYASSL_SHA384 */
Vanger 0:b86d15c6ba29 91
Vanger 0:b86d15c6ba29 92 #ifdef CYASSL_SHA512
Vanger 0:b86d15c6ba29 93
Vanger 0:b86d15c6ba29 94 typedef struct CYASSL_SHA512_CTX {
Vanger 0:b86d15c6ba29 95 long long holder[36]; /* big enough, but check on init */
Vanger 0:b86d15c6ba29 96 } CYASSL_SHA512_CTX;
Vanger 0:b86d15c6ba29 97
Vanger 0:b86d15c6ba29 98 CYASSL_API void CyaSSL_SHA512_Init(CYASSL_SHA512_CTX*);
Vanger 0:b86d15c6ba29 99 CYASSL_API void CyaSSL_SHA512_Update(CYASSL_SHA512_CTX*, const void*,
Vanger 0:b86d15c6ba29 100 unsigned long);
Vanger 0:b86d15c6ba29 101 CYASSL_API void CyaSSL_SHA512_Final(unsigned char*, CYASSL_SHA512_CTX*);
Vanger 0:b86d15c6ba29 102
Vanger 0:b86d15c6ba29 103 enum {
Vanger 0:b86d15c6ba29 104 SHA512_DIGEST_LENGTH = 64
Vanger 0:b86d15c6ba29 105 };
Vanger 0:b86d15c6ba29 106
Vanger 0:b86d15c6ba29 107
Vanger 0:b86d15c6ba29 108 typedef CYASSL_SHA512_CTX SHA512_CTX;
Vanger 0:b86d15c6ba29 109
Vanger 0:b86d15c6ba29 110 #define SHA512_Init CyaSSL_SHA512_Init
Vanger 0:b86d15c6ba29 111 #define SHA512_Update CyaSSL_SHA512_Update
Vanger 0:b86d15c6ba29 112 #define SHA512_Final CyaSSL_SHA512_Final
Vanger 0:b86d15c6ba29 113
Vanger 0:b86d15c6ba29 114 #endif /* CYASSL_SHA512 */
Vanger 0:b86d15c6ba29 115
Vanger 0:b86d15c6ba29 116
Vanger 0:b86d15c6ba29 117
Vanger 0:b86d15c6ba29 118
Vanger 0:b86d15c6ba29 119 #ifdef __cplusplus
Vanger 0:b86d15c6ba29 120 } /* extern "C" */
Vanger 0:b86d15c6ba29 121 #endif
Vanger 0:b86d15c6ba29 122
Vanger 0:b86d15c6ba29 123
Vanger 0:b86d15c6ba29 124 #endif /* CYASSL_SHA_H_ */
Vanger 0:b86d15c6ba29 125