File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 49
49
typedef mbedtls_ecdh_context mbedtls_ecdh_context_mbed ;
50
50
#endif
51
51
52
+ static mbedtls_ecp_group_id mbedtls_ecdh_grp_id (
53
+ const mbedtls_ecdh_context * ctx )
54
+ {
55
+ #if defined(MBEDTLS_ECDH_LEGACY_CONTEXT )
56
+ return ( ctx -> grp .id );
57
+ #else
58
+ return ( ctx -> grp_id );
59
+ #endif
60
+ }
61
+
52
62
#if !defined(MBEDTLS_ECDH_GEN_PUBLIC_ALT )
53
63
/*
54
64
* Generate public key (restartable version)
@@ -442,7 +452,7 @@ int mbedtls_ecdh_get_params( mbedtls_ecdh_context *ctx,
442
452
ECDH_VALIDATE_RET ( side == MBEDTLS_ECDH_OURS ||
443
453
side == MBEDTLS_ECDH_THEIRS );
444
454
445
- if ( ctx -> grp . id == MBEDTLS_ECP_DP_NONE )
455
+ if ( mbedtls_ecdh_grp_id ( ctx ) == MBEDTLS_ECP_DP_NONE )
446
456
{
447
457
/* This is the first call to get_params(). Set up the context
448
458
* for use with the group. */
@@ -454,7 +464,7 @@ int mbedtls_ecdh_get_params( mbedtls_ecdh_context *ctx,
454
464
/* This is not the first call to get_params(). Check that the
455
465
* current key's group is the same as the context's, which was set
456
466
* from the first key's group. */
457
- if ( ctx -> grp . id != key -> grp .id )
467
+ if ( mbedtls_ecdh_grp_id ( ctx ) != key -> grp .id )
458
468
return ( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
459
469
}
460
470
You can’t perform that action at this time.
0 commit comments