A simple library to support serving https.
Dependents: oldheating gps motorhome heating
sha/sha256.h@7:94ef5824c3c0, 2019-09-05 (annotated)
- Committer:
- andrewboyson
- Date:
- Thu Sep 05 12:58:41 2019 +0000
- Revision:
- 7:94ef5824c3c0
- Parent:
- 5:ee5489ee1117
Client handshake is now verified
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); |