Skip to content

Commit 6de59e0

Browse files
authored
Merge pull request #261 from JacobBarthelmeh/macro
macro guards on SHA512 224/256 and include wolfssl/options.h
2 parents b699cf0 + df94d45 commit 6de59e0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/wh_server_crypto.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3473,12 +3473,16 @@ static int _HandleSha512(whServerContext* ctx, uint16_t magic,
34733473
/* init sha2 struct with devid */
34743474
hashType = req.resumeState.hashType;
34753475
switch (hashType) {
3476+
#ifndef WOLFSSL_NOSHA512_224
34763477
case WC_HASH_TYPE_SHA512_224:
34773478
ret = wc_InitSha512_224_ex(sha512, NULL, ctx->crypto->devId);
34783479
break;
3480+
#endif
3481+
#ifndef WOLFSSL_NOSHA512_256
34793482
case WC_HASH_TYPE_SHA512_256:
34803483
ret = wc_InitSha512_256_ex(sha512, NULL, ctx->crypto->devId);
34813484
break;
3485+
#endif
34823486
default:
34833487
ret = wc_InitSha512_ex(sha512, NULL, ctx->crypto->devId);
34843488
break;
@@ -3498,12 +3502,16 @@ static int _HandleSha512(whServerContext* ctx, uint16_t magic,
34983502
}
34993503
if (ret == 0) {
35003504
switch (hashType) {
3505+
#ifndef WOLFSSL_NOSHA512_224
35013506
case WC_HASH_TYPE_SHA512_224:
35023507
ret = wc_Sha512_224Final(sha512, res.hash);
35033508
break;
3509+
#endif
3510+
#ifndef WOLFSSL_NOSHA512_256
35043511
case WC_HASH_TYPE_SHA512_256:
35053512
ret = wc_Sha512_256Final(sha512, res.hash);
35063513
break;
3514+
#endif
35073515
default:
35083516
ret = wc_Sha512Final(sha512, res.hash);
35093517
break;

wolfhsm/wh_settings.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@
161161
#ifndef WOLFHSM_CFG_NO_CRYPTO
162162
#ifdef WOLFSSL_USER_SETTINGS
163163
#include "user_settings.h"
164+
#else
165+
#include <wolfssl/options.h>
164166
#endif /* WOLFSSL_USER_SETTINGS */
165167

166168
#if defined(WOLFHSM_CFG_DEBUG) || defined(WOLFHSM_CFG_DEBUG_VERBOSE)

0 commit comments

Comments
 (0)