Skip to content

Commit 33bfe23

Browse files
committed
Merge branch 'bugfix/wpa_supplicant_no_hw_mpi' into 'master'
wpa_supplicant: Allow building with mbedTLS integration but no hardware MPI Closes IDFGH-3344 See merge request espressif/esp-idf!8822
2 parents 8b156a9 + 0927ec0 commit 33bfe23

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

components/mbedtls/port/include/mbedtls/bignum.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
1+
// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -11,10 +11,10 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
#ifndef __ESP_MBEDTLS_BIGNUM_H__
15-
#define __ESP_MBEDTLS_BIGNUM_H__
14+
#pragma once
1615

1716
#include_next "mbedtls/bignum.h"
17+
#include "sdkconfig.h"
1818

1919
/**
2020
* This is a wrapper for the main mbedtls/bignum.h. This wrapper
@@ -58,6 +58,8 @@ void esp_mpi_acquire_hardware(void);
5858
*/
5959
void esp_mpi_release_hardware(void);
6060

61+
#if CONFIG_MBEDTLS_HARDWARE_MPI
62+
6163
/* @brief MPI modular mupltiplication function
6264
*
6365
* Calculates Z = (X * Y) mod M using MPI hardware acceleration.
@@ -75,4 +77,4 @@ void esp_mpi_release_hardware(void);
7577
*/
7678
int esp_mpi_mul_mpi_mod(mbedtls_mpi *Z, const mbedtls_mpi *X, const mbedtls_mpi *Y, const mbedtls_mpi *M);
7779

78-
#endif
80+
#endif // CONFIG_MBEDTLS_HARDWARE_MPI

components/wpa_supplicant/src/crypto/crypto_mbedtls-bignum.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ int crypto_bignum_mulmod(const struct crypto_bignum *a,
148148
struct crypto_bignum *d)
149149
{
150150
int res;
151-
#if ALLOW_EVEN_MOD // Must enable this macro if c is even.
151+
#if ALLOW_EVEN_MOD || !CONFIG_MBEDTLS_HARDWARE_MPI // Must enable ALLOW_EVEN_MOD if c is even
152152
mbedtls_mpi temp;
153153
mbedtls_mpi_init(&temp);
154154

0 commit comments

Comments
 (0)