Remove pk_info from pk_context_t with SINGLE_TYPE
In very reduced configurations, we don't want the overhead of maintaining a
bool just to remember if the context is valid and checking that bit at every
point of entry.
Note: so far this validity bit also served as a proxy to ensure that pk_ctx
was valid (currently this is a pointer to a dynamically-allocated buffer). In
the next series of commits, this will be changed to a statically-allocated
buffer, so there will be no question about its validity.
In the end (after this commit and the next series), a pk_context_t will be
(memory-wise) just the same as a mbedtls_uecc_keypair when SINGLE_TYPE is
enabled - meaning the PK layer will have zero memory overhead in that case.
diff --git a/tests/suites/test_suite_pk.function b/tests/suites/test_suite_pk.function
index 1635855..b446f49 100644
--- a/tests/suites/test_suite_pk.function
+++ b/tests/suites/test_suite_pk.function
@@ -95,9 +95,11 @@
void valid_parameters( )
{
mbedtls_pk_context pk;
+#if !defined(MBEDTLS_PK_SINGLE_TYPE)
unsigned char buf[1];
size_t len;
void *options = NULL;
+#endif
mbedtls_pk_init( &pk );
@@ -118,6 +120,7 @@
TEST_ASSERT( mbedtls_pk_get_len( NULL ) == 0 );
TEST_ASSERT( mbedtls_pk_can_do( NULL, MBEDTLS_PK_NONE ) == 0 );
+#if !defined(MBEDTLS_PK_SINGLE_TYPE)
TEST_ASSERT( mbedtls_pk_sign_restartable( &pk,
MBEDTLS_MD_NONE,
NULL, 0,
@@ -172,6 +175,7 @@
NULL, &len, 0,
rnd_std_rand, NULL ) ==
MBEDTLS_ERR_PK_BAD_INPUT_DATA );
+#endif /* MBEDTLS_PK_SINGLE_TYPE */
#if defined(MBEDTLS_PK_PARSE_C)
TEST_ASSERT( mbedtls_pk_parse_key( &pk, NULL, 0, NULL, 1 ) ==