mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-21 21:36:21 +01:00
Implement parameter validation for ECP module
This commit is contained in:
parent
ebffa7995b
commit
4f8e8e5805
2 changed files with 125 additions and 23 deletions
|
|
@ -28,11 +28,18 @@
|
|||
#if defined(MBEDTLS_ECP_C)
|
||||
|
||||
#include "mbedtls/ecp.h"
|
||||
#include "mbedtls/platform_util.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(MBEDTLS_ECP_ALT)
|
||||
|
||||
/* Parameter validation macros based on platform_util.h */
|
||||
#define ECP_VALIDATE_RET( cond ) \
|
||||
MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_ECP_BAD_INPUT_DATA )
|
||||
#define ECP_VALIDATE( cond ) \
|
||||
MBEDTLS_INTERNAL_VALIDATE( cond )
|
||||
|
||||
#if ( defined(__ARMCC_VERSION) || defined(_MSC_VER) ) && \
|
||||
!defined(inline) && !defined(__cplusplus)
|
||||
#define inline __inline
|
||||
|
|
@ -746,6 +753,7 @@ cleanup:
|
|||
*/
|
||||
int mbedtls_ecp_group_load( mbedtls_ecp_group *grp, mbedtls_ecp_group_id id )
|
||||
{
|
||||
ECP_VALIDATE_RET( grp != NULL );
|
||||
mbedtls_ecp_group_free( grp );
|
||||
|
||||
grp->id = id;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue