-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60d6dec
commit 2de62fd
Showing
22 changed files
with
1,097 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
pkg/esp32_sdk/patches/0033-wpa_supplicant-add-prefix-wpa_-to-sha512_init.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
From 241861e24ad628946e3257317549a70c6f90aeec Mon Sep 17 00:00:00 2001 | ||
From: Gunar Schorcht <[email protected]> | ||
Date: Tue, 10 Oct 2023 17:54:52 +0200 | ||
Subject: [PATCH 33/33] wpa_supplicant: add prefix wpa_ to sha512_init | ||
|
||
Prefix `_wpa` added to `sha512_init` function of `wpa_suppplicant` to avoid name conflicts with RIOT modules `crypto` and `hashes`. | ||
--- | ||
components/wpa_supplicant/src/crypto/crypto_internal.c | 2 +- | ||
components/wpa_supplicant/src/crypto/sha512-internal.c | 4 ++-- | ||
components/wpa_supplicant/src/crypto/sha512_i.h | 2 +- | ||
3 files changed, 4 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/components/wpa_supplicant/src/crypto/crypto_internal.c b/components/wpa_supplicant/src/crypto/crypto_internal.c | ||
index d1426a8feb7..7ff588cbb40 100644 | ||
--- a/components/wpa_supplicant/src/crypto/crypto_internal.c | ||
+++ b/components/wpa_supplicant/src/crypto/crypto_internal.c | ||
@@ -67,7 +67,7 @@ struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key, | ||
#endif /* CONFIG_INTERNAL_SHA384 */ | ||
#ifdef CONFIG_INTERNAL_SHA512 | ||
case CRYPTO_HASH_ALG_SHA512: | ||
- sha512_init(&ctx->u.sha512); | ||
+ wpa_sha512_init(&ctx->u.sha512); | ||
break; | ||
#endif /* CONFIG_INTERNAL_SHA512 */ | ||
case CRYPTO_HASH_ALG_HMAC_MD5: | ||
diff --git a/components/wpa_supplicant/src/crypto/sha512-internal.c b/components/wpa_supplicant/src/crypto/sha512-internal.c | ||
index c0263941c12..1e816867faf 100644 | ||
--- a/components/wpa_supplicant/src/crypto/sha512-internal.c | ||
+++ b/components/wpa_supplicant/src/crypto/sha512-internal.c | ||
@@ -27,7 +27,7 @@ int sha512_vector(size_t num_elem, const u8 *addr[], const size_t *len, | ||
struct sha512_state ctx; | ||
size_t i; | ||
|
||
- sha512_init(&ctx); | ||
+ wpa_sha512_init(&ctx); | ||
for (i = 0; i < num_elem; i++) | ||
if (sha512_process(&ctx, addr[i], len[i])) | ||
return -1; | ||
@@ -161,7 +161,7 @@ static int sha512_compress(struct sha512_state *md, unsigned char *buf) | ||
@param md The hash state you wish to initialize | ||
@return CRYPT_OK if successful | ||
*/ | ||
-void sha512_init(struct sha512_state *md) | ||
+void wpa_sha512_init(struct sha512_state *md) | ||
{ | ||
md->curlen = 0; | ||
md->length = 0; | ||
diff --git a/components/wpa_supplicant/src/crypto/sha512_i.h b/components/wpa_supplicant/src/crypto/sha512_i.h | ||
index 108958911ef..e451e48fcfd 100644 | ||
--- a/components/wpa_supplicant/src/crypto/sha512_i.h | ||
+++ b/components/wpa_supplicant/src/crypto/sha512_i.h | ||
@@ -17,7 +17,7 @@ struct sha512_state { | ||
u8 buf[SHA512_BLOCK_SIZE]; | ||
}; | ||
|
||
-void sha512_init(struct sha512_state *md); | ||
+void wpa_sha512_init(struct sha512_state *md); | ||
int sha512_process(struct sha512_state *md, const unsigned char *in, | ||
unsigned long inlen); | ||
int sha512_done(struct sha512_state *md, unsigned char *out); | ||
-- | ||
2.34.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (C) 2023 TU Dresden | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser | ||
* General Public License v2.1. See the file LICENSE in the top level | ||
* directory for more details. | ||
*/ | ||
|
||
/** | ||
* @ingroup sys_psa_crypto | ||
* @{ | ||
* | ||
* @brief Glue code translating between PSA Crypto and the RIOT Hash module | ||
* | ||
* @author Mikolai Gütschow <[email protected]> | ||
* | ||
* @} | ||
*/ | ||
|
||
#include "psa/crypto.h" | ||
#include "hashes/psa/riot_hashes.h" | ||
|
||
psa_status_t psa_hashes_sha512_setup(psa_hashes_sha512_ctx_t *ctx) | ||
{ | ||
sha512_init((sha512_context_t *)ctx); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha512_update(psa_hashes_sha512_ctx_t *ctx, | ||
const uint8_t *input, | ||
size_t input_length) | ||
{ | ||
sha512_update((sha512_context_t *)ctx, input, input_length); | ||
return PSA_SUCCESS; | ||
} | ||
|
||
psa_status_t psa_hashes_sha512_finish(psa_hashes_sha512_ctx_t *ctx, | ||
uint8_t *hash, | ||
size_t hash_size, | ||
size_t *hash_length) | ||
{ | ||
sha512_final((sha512_context_t *)ctx, hash); | ||
|
||
(void)hash_size; | ||
(void)hash_length; | ||
return PSA_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright (C) 2023 TU Dresden | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser | ||
* General Public License v2.1. See the file LICENSE in the top level | ||
* directory for more details. | ||
*/ | ||
|
||
/** | ||
* @ingroup sys_hashes | ||
* @{ | ||
* | ||
* @file | ||
* @brief SHA-512 hash function implementation | ||
* | ||
* @author Mikolai Gütschow <[email protected]> | ||
* | ||
* @} | ||
*/ | ||
|
||
#include <string.h> | ||
#include <assert.h> | ||
|
||
#include "hashes/sha512.h" | ||
#include "hashes/sha512_common.h" | ||
|
||
/* SHA-512 initialization. Begins a SHA-512 operation. */ | ||
void sha512_init(sha512_context_t *ctx) | ||
{ | ||
/* Zero bits processed so far */ | ||
ctx->count[0] = ctx->count[1] = 0; | ||
|
||
/* Magic initialization constants */ | ||
ctx->state[0] = 0x6a09e667f3bcc908; | ||
ctx->state[1] = 0xbb67ae8584caa73b; | ||
ctx->state[2] = 0x3c6ef372fe94f82b; | ||
ctx->state[3] = 0xa54ff53a5f1d36f1; | ||
ctx->state[4] = 0x510e527fade682d1; | ||
ctx->state[5] = 0x9b05688c2b3e6c1f; | ||
ctx->state[6] = 0x1f83d9abfb41bd6b; | ||
ctx->state[7] = 0x5be0cd19137e2179; | ||
} | ||
|
||
void *sha512(const void *data, size_t len, void *digest) | ||
{ | ||
sha512_context_t c; | ||
static unsigned char m[SHA512_DIGEST_LENGTH]; | ||
|
||
if (digest == NULL) { | ||
digest = m; | ||
} | ||
|
||
sha512_init(&c); | ||
sha512_update(&c, data, len); | ||
sha512_final(&c, digest); | ||
|
||
return digest; | ||
} |
Oops, something went wrong.