Lines Matching defs:ctx
42 void mbedtls_x25519_init( mbedtls_x25519_context *ctx )
44 mbedtls_platform_zeroize( ctx, sizeof( mbedtls_x25519_context ) );
50 void mbedtls_x25519_free( mbedtls_x25519_context *ctx )
52 if( ctx == NULL )
55 mbedtls_platform_zeroize( ctx->our_secret, MBEDTLS_X25519_KEY_SIZE_BYTES );
56 mbedtls_platform_zeroize( ctx->peer_point, MBEDTLS_X25519_KEY_SIZE_BYTES );
59 int mbedtls_x25519_make_params( mbedtls_x25519_context *ctx, size_t *olen,
68 if( ( ret = f_rng( p_rng, ctx->our_secret, MBEDTLS_X25519_KEY_SIZE_BYTES ) ) != 0 )
81 Hacl_Curve25519_crypto_scalarmult( buf, ctx->our_secret, base );
90 int mbedtls_x25519_read_params( mbedtls_x25519_context *ctx,
99 memcpy( ctx->peer_point, *buf, MBEDTLS_X25519_KEY_SIZE_BYTES );
104 int mbedtls_x25519_get_params( mbedtls_x25519_context *ctx, const mbedtls_ecp_keypair *key,
111 return mbedtls_ecp_point_write_binary( &key->grp, &key->Q, MBEDTLS_ECP_PF_COMPRESSED, &olen, ctx->peer_point, MBEDTLS_X25519_KEY_SIZE_BYTES );
113 return mbedtls_mpi_write_binary_le( &key->d, ctx->our_secret, MBEDTLS_X25519_KEY_SIZE_BYTES );
119 int mbedtls_x25519_calc_secret( mbedtls_x25519_context *ctx, size_t *olen,
134 Hacl_Curve25519_crypto_scalarmult( buf, ctx->our_secret, ctx->peer_point);
137 mbedtls_platform_zeroize( ctx->our_secret, MBEDTLS_X25519_KEY_SIZE_BYTES );
139 if( memcmp( buf, ctx->our_secret, MBEDTLS_X25519_KEY_SIZE_BYTES) == 0 )
145 int mbedtls_x25519_make_public( mbedtls_x25519_context *ctx, size_t *olen,
153 if( ctx == NULL )
156 if( ( ret = f_rng( p_rng, ctx->our_secret, MBEDTLS_X25519_KEY_SIZE_BYTES ) ) != 0 )
165 Hacl_Curve25519_crypto_scalarmult( buf, ctx->our_secret, base );
174 int mbedtls_x25519_read_public( mbedtls_x25519_context *ctx,
181 memcpy( ctx->peer_point, buf, MBEDTLS_X25519_KEY_SIZE_BYTES );