Skip to content

Commit 6522a08

Browse files
Teppo JärvelinArto Kinnunen
authored andcommitted
Added missing optimizations based on mbedtls/baremetal.h config
1 parent 0e8739f commit 6522a08

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

nanostack/ns_sha256.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,45 +61,45 @@ static inline void ns_sha256_clone(ns_sha256_context *dst,
6161

6262
static inline void ns_sha256_starts(ns_sha256_context *ctx)
6363
{
64-
mbedtls_sha256_starts(ctx, 0);
64+
(void)mbedtls_sha256_starts_ret(ctx, 0);
6565
}
6666

6767
static inline void ns_sha256_update(ns_sha256_context *ctx, const void *input,
6868
size_t ilen)
6969
{
70-
mbedtls_sha256_update(ctx, input, ilen);
70+
(void)mbedtls_sha256_update_ret(ctx, input, ilen);
7171
}
7272

7373
static inline void ns_sha256_finish(ns_sha256_context *ctx, void *output)
7474
{
75-
mbedtls_sha256_finish(ctx, output);
75+
(void)mbedtls_sha256_finish_ret(ctx, output);
7676
}
7777

7878
static inline void ns_sha256(const void *input, size_t ilen, void *output)
7979
{
80-
mbedtls_sha256(input, ilen, output, 0);
80+
(void)mbedtls_sha256_ret(input, ilen, output, 0);
8181
}
8282

8383
/* Extensions to standard mbed TLS - output the first bits of a hash only */
8484
/* Number of bits must be a multiple of 32, and <=256 */
8585
static inline void ns_sha256_finish_nbits(ns_sha256_context *ctx, void *output, unsigned obits)
8686
{
8787
if (obits == 256) {
88-
mbedtls_sha256_finish(ctx, output);
88+
(void)mbedtls_sha256_finish_ret(ctx, output);
8989
} else {
9090
uint8_t sha256[32];
91-
mbedtls_sha256_finish(ctx, sha256);
91+
(void)mbedtls_sha256_finish_ret(ctx, sha256);
9292
memcpy(output, sha256, obits / 8);
9393
}
9494
}
9595

9696
static inline void ns_sha256_nbits(const void *input, size_t ilen, void *output, unsigned obits)
9797
{
9898
if (obits == 256) {
99-
mbedtls_sha256(input, ilen, output, 0);
99+
(void)mbedtls_sha256_ret(input, ilen, output, 0);
100100
} else {
101101
uint8_t sha256[32];
102-
mbedtls_sha256(input, ilen, sha256, 0);
102+
(void)mbedtls_sha256_ret(input, ilen, sha256, 0);
103103
memcpy(output, sha256, obits / 8);
104104
}
105105
}

0 commit comments

Comments
 (0)