mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-24 00:06:32 +01:00
PK: document context validity requirements
Document when a context must be initialized or not, when it must be set up or not, and whether it needs a private key or a public key will do. The implementation is sometimes more liberal than the documentation, accepting a non-set-up context as a context that can't perform the requested information. This preserves backward compatibility.
This commit is contained in:
parent
8c71b3ecb3
commit
6af45ec53e
3 changed files with 55 additions and 33 deletions
|
|
@ -90,10 +90,12 @@ void valid_parameters( )
|
|||
TEST_ASSERT( mbedtls_pk_setup( &pk, NULL ) ==
|
||||
MBEDTLS_ERR_PK_BAD_INPUT_DATA );
|
||||
|
||||
/* In informational functions, we accept NULL where a context pointer
|
||||
* is expected because that's what the library has done forever.
|
||||
* We do not document that NULL is accepted, so we may wish to change
|
||||
* the behavior in a future version. */
|
||||
TEST_ASSERT( mbedtls_pk_get_bitlen( NULL ) == 0 );
|
||||
|
||||
TEST_ASSERT( mbedtls_pk_get_len( NULL ) == 0 );
|
||||
|
||||
TEST_ASSERT( mbedtls_pk_can_do( NULL, MBEDTLS_PK_NONE ) == 0 );
|
||||
|
||||
TEST_ASSERT( mbedtls_pk_sign_restartable( &pk,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue