|
DeterministicESPAsyncWebServer v6.27.1
Zero-allocation, bounded-execution async HTTP server for ESP32
|
SHA-256 implementation. More...
#include "network_drivers/presentation/ssh/crypto/ssh_sha256.h"#include <string.h>#include <mbedtls/sha256.h>Go to the source code of this file.
Functions | |
| void | ssh_sha256_init (SshSha256Ctx *ctx) |
| Initialize a streaming SHA-256 context. | |
| void | ssh_sha256_update (SshSha256Ctx *ctx, const uint8_t *data, size_t len) |
Feed len bytes of data into the running hash. | |
| void | ssh_sha256_final (SshSha256Ctx *ctx, uint8_t digest[SSH_SHA256_DIGEST_LEN]) |
| Finalize the hash and write the 32-byte digest. | |
| void | ssh_sha256 (const uint8_t *data, size_t len, uint8_t digest[SSH_SHA256_DIGEST_LEN]) |
One-shot SHA-256: hash len bytes and write the digest. | |
SHA-256 implementation.
The streaming functions (init/update/final) are software on both platforms - they are only used for KEX hash construction (once per connection).
The one-shot ssh_sha256() uses the ESP32 hardware SHA accelerator via mbedtls on Arduino builds, and the software path on native builds.
Definition in file ssh_sha256.cpp.
| void ssh_sha256_init | ( | SshSha256Ctx * | ctx | ) |
Initialize a streaming SHA-256 context.
| ctx | Must not be NULL. |
Definition at line 28 of file ssh_sha256.cpp.
References SshSha256Ctx::mbed.
Referenced by ssh_hmac_sha256_final(), ssh_hmac_sha256_init(), and ssh_kdf_derive().
| void ssh_sha256_update | ( | SshSha256Ctx * | ctx, |
| const uint8_t * | data, | ||
| size_t | len | ||
| ) |
Feed len bytes of data into the running hash.
| ctx | Initialized context. |
| data | Input bytes. |
| len | Number of input bytes. |
Definition at line 38 of file ssh_sha256.cpp.
References SshSha256Ctx::mbed.
Referenced by ssh_hmac_sha256_final(), ssh_hmac_sha256_init(), ssh_hmac_sha256_update(), and ssh_kdf_derive().
| void ssh_sha256_final | ( | SshSha256Ctx * | ctx, |
| uint8_t | digest[SSH_SHA256_DIGEST_LEN] | ||
| ) |
Finalize the hash and write the 32-byte digest.
The context is in an undefined state after this call; do not call update() again without first calling init().
| ctx | Initialized context with all data already fed. |
| digest | Output buffer, must be SSH_SHA256_DIGEST_LEN bytes. |
Definition at line 47 of file ssh_sha256.cpp.
References SshSha256Ctx::mbed.
Referenced by ssh_hmac_sha256_final(), and ssh_kdf_derive().
| void ssh_sha256 | ( | const uint8_t * | data, |
| size_t | len, | ||
| uint8_t | digest[SSH_SHA256_DIGEST_LEN] | ||
| ) |
One-shot SHA-256: hash len bytes and write the digest.
On Arduino uses the mbedtls hardware-accelerated path. On native uses the software streaming implementation.
| data | Input bytes. |
| len | Number of input bytes. |
| digest | Output buffer, must be SSH_SHA256_DIGEST_LEN bytes. |
Definition at line 57 of file ssh_sha256.cpp.
Referenced by ssh_ecdsa_p256_sign(), ssh_ecdsa_p256_verify(), ssh_rsa_sign(), and ssh_rsa_verify().