A simple library to support serving https.
Dependents: oldheating gps motorhome heating
sha/sha256.h@24:cb43290fc439, 2020-04-01 (annotated)
- Committer:
- andrewboyson
- Date:
- Wed Apr 01 12:48:52 2020 +0000
- Revision:
- 24:cb43290fc439
- Parent:
- 7:94ef5824c3c0
Added check so that if the client closes the TCP connection before the TLS connection is established then respond that we have finished and the TCP connection is to be closed.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 4:6a1d887f1cad | 1 | #pragma once |
andrewboyson | 4:6a1d887f1cad | 2 | |
andrewboyson | 3:e6a2c4579a4d | 3 | #include <stdint.h> |
andrewboyson | 3:e6a2c4579a4d | 4 | |
andrewboyson | 7:94ef5824c3c0 | 5 | #define SHA256_BLOCK_SIZE 64 |
andrewboyson | 7:94ef5824c3c0 | 6 | #define SHA256_HASH_SIZE 32 |
andrewboyson | 4:6a1d887f1cad | 7 | |
andrewboyson | 3:e6a2c4579a4d | 8 | struct Sha256State |
andrewboyson | 3:e6a2c4579a4d | 9 | { |
andrewboyson | 3:e6a2c4579a4d | 10 | uint64_t length; |
andrewboyson | 3:e6a2c4579a4d | 11 | uint32_t curlen; |
andrewboyson | 7:94ef5824c3c0 | 12 | uint32_t state[SHA256_HASH_SIZE / 4]; |
andrewboyson | 7:94ef5824c3c0 | 13 | uint8_t buf[SHA256_BLOCK_SIZE]; |
andrewboyson | 3:e6a2c4579a4d | 14 | }; |
andrewboyson | 7:94ef5824c3c0 | 15 | extern void Sha256Copy (struct Sha256State* pTo, struct Sha256State* pFrom); |
andrewboyson | 3:e6a2c4579a4d | 16 | |
andrewboyson | 4:6a1d887f1cad | 17 | extern void Sha256Start (struct Sha256State *md ); |
andrewboyson | 5:ee5489ee1117 | 18 | extern int Sha256Add (struct Sha256State *md, const uint8_t* in, int inlen ); |
andrewboyson | 5:ee5489ee1117 | 19 | extern int Sha256Finish(struct Sha256State *md, uint8_t* hash); |
andrewboyson | 4:6a1d887f1cad | 20 | extern void Sha256 ( const uint8_t* in, int inlen, uint8_t* hash); |