|
ProtoCore v0.0.1
Deterministic, zero-heap network stack for embedded targets
|
SHA-256 implementation (FIPS 180-4). More...
#include "crypto/hash/sha256.h"#include "crypto/crypto_opt.h"#include <string.h>#include <mbedtls/sha256.h>Go to the source code of this file.
Functions | |
| PC_CRYPTO_HOT void | pc_sha256_init (pc_sha256_ctx *ctx) |
Initialize a streaming SHA-256 context (ctx must not be NULL). | |
| void | pc_sha256_update (pc_sha256_ctx *ctx, const uint8_t *data, size_t len) |
Feed len bytes of data into the running hash. | |
| void | pc_sha256_final (pc_sha256_ctx *ctx, uint8_t digest[PC_SHA256_DIGEST_LEN]) |
| Finalize the hash and write the 32-byte digest. The context is undefined afterwards; call init() again before reuse. | |
| void | pc_sha256 (const uint8_t *data, size_t len, uint8_t digest[PC_SHA256_DIGEST_LEN]) |
One-shot SHA-256: hash len bytes of data into digest (32 bytes). | |
SHA-256 implementation (FIPS 180-4).
On Arduino builds streaming + one-shot delegate to mbedtls (ESP32 hardware SHA accelerator); on native builds the software path below is used. Shared by SSH, TLS 1.3 / QUIC / DTLS, SNMPv3, JWT, CSRF, and SMB 2.x message signing.
Definition in file sha256.cpp.
| PC_CRYPTO_HOT void pc_sha256_init | ( | pc_sha256_ctx * | ctx | ) |
Initialize a streaming SHA-256 context (ctx must not be NULL).
Definition at line 29 of file sha256.cpp.
References pc_sha256_ctx::mbed.
Referenced by pc_hmac_sha256(), pc_hmac_sha256_final(), pc_hmac_sha256_init(), and pc_kdf_ctr_hmac_sha256().
| void pc_sha256_update | ( | pc_sha256_ctx * | ctx, |
| const uint8_t * | data, | ||
| size_t | len | ||
| ) |
Feed len bytes of data into the running hash.
Definition at line 39 of file sha256.cpp.
References pc_sha256_ctx::mbed.
Referenced by pc_hmac_sha256(), pc_hmac_sha256_final(), pc_hmac_sha256_init(), pc_hmac_sha256_update(), and pc_kdf_ctr_hmac_sha256().
| void pc_sha256_final | ( | pc_sha256_ctx * | ctx, |
| uint8_t | digest[PC_SHA256_DIGEST_LEN] | ||
| ) |
Finalize the hash and write the 32-byte digest. The context is undefined afterwards; call init() again before reuse.
| digest | Output buffer, PC_SHA256_DIGEST_LEN bytes. |
Definition at line 48 of file sha256.cpp.
References pc_sha256_ctx::mbed.
Referenced by pc_hmac_sha256(), pc_hmac_sha256_final(), and pc_kdf_ctr_hmac_sha256().
| void pc_sha256 | ( | const uint8_t * | data, |
| size_t | len, | ||
| uint8_t | digest[PC_SHA256_DIGEST_LEN] | ||
| ) |
One-shot SHA-256: hash len bytes of data into digest (32 bytes).
Definition at line 58 of file sha256.cpp.
Referenced by PC_CRYPTO_HOT::build_key_block(), pc_ecdsa_p256_sign(), pc_ecdsa_p256_verify(), pc_kdf_ctr_hmac_sha256(), pc_rsa_verify(), and ssh_rsa_sign().