A simple library to support serving https.
Dependents: oldheating gps motorhome heating
sha/sha1.h@24:cb43290fc439, 2020-04-01 (annotated)
- Committer:
- andrewboyson
- Date:
- Wed Apr 01 12:48:52 2020 +0000
- Revision:
- 24:cb43290fc439
- Parent:
- 14:03a0b8fd6ddc
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 | 7:94ef5824c3c0 | 1 | #pragma once |
andrewboyson | 7:94ef5824c3c0 | 2 | |
andrewboyson | 6:819c17738dc2 | 3 | #include <stdint.h> |
andrewboyson | 14:03a0b8fd6ddc | 4 | #define SHA1_BLOCK_SIZE 64 |
andrewboyson | 7:94ef5824c3c0 | 5 | #define SHA1_HASH_SIZE 20 |
andrewboyson | 6:819c17738dc2 | 6 | |
andrewboyson | 7:94ef5824c3c0 | 7 | struct Sha1State |
andrewboyson | 6:819c17738dc2 | 8 | { |
andrewboyson | 6:819c17738dc2 | 9 | uint32_t count; |
andrewboyson | 7:94ef5824c3c0 | 10 | uint32_t state[SHA1_HASH_SIZE / 4]; |
andrewboyson | 6:819c17738dc2 | 11 | union |
andrewboyson | 6:819c17738dc2 | 12 | { |
andrewboyson | 6:819c17738dc2 | 13 | uint8_t b[SHA1_BLOCK_SIZE]; |
andrewboyson | 6:819c17738dc2 | 14 | uint32_t w[SHA1_BLOCK_SIZE / 4]; |
andrewboyson | 6:819c17738dc2 | 15 | } buf; |
andrewboyson | 6:819c17738dc2 | 16 | }; |
andrewboyson | 7:94ef5824c3c0 | 17 | extern void Sha1Start (struct Sha1State *ctx ); |
andrewboyson | 7:94ef5824c3c0 | 18 | extern void Sha1Add (struct Sha1State *ctx, const uint8_t *data, int len ); |
andrewboyson | 7:94ef5824c3c0 | 19 | extern void Sha1Finish(struct Sha1State *ctx, uint8_t *out); |
andrewboyson | 7:94ef5824c3c0 | 20 | extern void Sha1 ( const uint8_t *data, int len, uint8_t *out); |