wolfssl: Support SHA3

This commit is contained in:
Andreas Steffen 2021-03-18 07:58:21 +01:00
parent b57215ba2b
commit a91eb3eb96
2 changed files with 34 additions and 0 deletions

View File

@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2019 Sean Parkinson, wolfSSL Inc. * Copyright (C) 2019 Sean Parkinson, wolfSSL Inc.
* Copyright (C) 2021 Andreas Steffen, strongSec GmbH
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -118,6 +119,18 @@ METHOD(plugin_t, get_features, int,
#ifdef WOLFSSL_SHA512 #ifdef WOLFSSL_SHA512
PLUGIN_PROVIDE(HASHER, HASH_SHA512), PLUGIN_PROVIDE(HASHER, HASH_SHA512),
#endif #endif
#if defined(WOLFSSL_SHA3) && !defined(WOLFSSL_NOSHA3_224)
PLUGIN_PROVIDE(HASHER, HASH_SHA3_224),
#endif
#if defined(WOLFSSL_SHA3) && !defined(WOLFSSL_NOSHA3_256)
PLUGIN_PROVIDE(HASHER, HASH_SHA3_256),
#endif
#if defined(WOLFSSL_SHA3) && !defined(WOLFSSL_NOSHA3_384)
PLUGIN_PROVIDE(HASHER, HASH_SHA3_384),
#endif
#if defined(WOLFSSL_SHA3) && !defined(WOLFSSL_NOSHA3_512)
PLUGIN_PROVIDE(HASHER, HASH_SHA3_512),
#endif
#ifndef NO_SHA #ifndef NO_SHA
/* keyed sha1 hasher (aka prf) */ /* keyed sha1 hasher (aka prf) */
PLUGIN_REGISTER(PRF, wolfssl_sha1_prf_create), PLUGIN_REGISTER(PRF, wolfssl_sha1_prf_create),

View File

@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2019 Sean Parkinson, wolfSSL Inc. * Copyright (C) 2019 Sean Parkinson, wolfSSL Inc.
* Copyright (C) 2021 Andreas Steffen, strongSec GmbH
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -147,6 +148,26 @@ bool wolfssl_hash2type(hash_algorithm_t hash, enum wc_HashType *type)
case HASH_SHA512: case HASH_SHA512:
*type = WC_HASH_TYPE_SHA512; *type = WC_HASH_TYPE_SHA512;
break; break;
#endif
#if defined(WOLFSSL_SHA3) && !defined(WOLFSSL_NOSHA3_224)
case HASH_SHA3_224:
*type = WC_HASH_TYPE_SHA3_224;
break;
#endif
#if defined(WOLFSSL_SHA3) && !defined(WOLFSSL_NOSHA3_256)
case HASH_SHA3_256:
*type = WC_HASH_TYPE_SHA3_256;
break;
#endif
#if defined(WOLFSSL_SHA3) && !defined(WOLFSSL_NOSHA3_384)
case HASH_SHA3_384:
*type = WC_HASH_TYPE_SHA3_384;
break;
#endif
#if defined(WOLFSSL_SHA3) && !defined(WOLFSSL_NOSHA3_512)
case HASH_SHA3_512:
*type = WC_HASH_TYPE_SHA3_512;
break;
#endif #endif
default: default:
return FALSE; return FALSE;