Select one of the symbols to view example projects that use it.
 
Outline
#include "bootloader_sha.h"
#include "bootloader_flash_priv.h"
#include <stdbool.h>
#include <string.h>
#include <assert.h>
#include <sys/param.h>
#include <mbedtls/sha256.h>
bootloader_sha256_start()
bootloader_sha256_data(bootloader_sha256_handle_t, const void *, size_t)
bootloader_sha256_finish(bootloader_sha256_handle_t, uint8_t *)
Files
loading...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/bootloader_support/src/idf/bootloader_sha.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #include "bootloader_sha.h" #include "bootloader_flash_priv.h" #include <stdbool.h> #include <string.h> #include <assert.h> #include <sys/param.h> #include <mbedtls/sha256.h>7 includes bootloader_sha256_handle_t bootloader_sha256_start(void) { mbedtls_sha256_context *ctx = (mbedtls_sha256_context *)malloc(sizeof(mbedtls_sha256_context)); if (!ctx) { return NULL; }{...} mbedtls_sha256_init(ctx); int ret = mbedtls_sha256_starts(ctx, false); if (ret != 0) { return NULL; }{...} return ctx; }{ ... } void bootloader_sha256_data(bootloader_sha256_handle_t handle, const void *data, size_t data_len) { assert(handle != NULL); mbedtls_sha256_context *ctx = (mbedtls_sha256_context *)handle; int ret = mbedtls_sha256_update(ctx, data, data_len); assert(ret == 0); (void)ret; }{ ... } void bootloader_sha256_finish(bootloader_sha256_handle_t handle, uint8_t *digest) { assert(handle != NULL); mbedtls_sha256_context *ctx = (mbedtls_sha256_context *)handle; if (digest != NULL) { int ret = mbedtls_sha256_finish(ctx, digest); assert(ret == 0); (void)ret; }{...} mbedtls_sha256_free(ctx); free(handle); handle = NULL; }{ ... }
Details