Fixed hard fault on ST and TI Caused By Call To xProvisionDevice
xProvisionDevice checks for NULL certs and keys, but a path existed that caused it to try and provision a NULL private key.
This caused a hard fault on ST and TI when credentials were NULL.
@@ -1028,6 +1028,10 @@ CK_RV xProvisionDevice( CK_SESSION_HANDLE xSession,
configPRINTF( ( "Warning: could not clean-up old crypto objects. %d \r\n", xResult ) );
}
}
+ else
+ {
+ xResult = CKR_ARGUMENTS_BAD;
+ }
#endif /* if ( pkcs11configIMPORT_PRIVATE_KEYS_SUPPORTED == 1 ) */
/* If a client certificate has been provided by the caller, attempt to
@@ -1045,6 +1049,10 @@ CK_RV xProvisionDevice( CK_SESSION_HANDLE xSession,
configPRINTF( ( "ERROR: Failed to provision device certificate. %d \r\n", xResult ) );
}
}
+ else
+ {
+ xResult = CKR_ARGUMENTS_BAD;
+ }
#if ( pkcs11configIMPORT_PRIVATE_KEYS_SUPPORTED == 1 )
@@ -1088,6 +1096,10 @@ CK_RV xProvisionDevice( CK_SESSION_HANDLE xSession,
configPRINTF( ( "Warning: no persistent storage is available for the JITP certificate. The certificate in aws_clientcredential_keys.h will be used instead.\r\n" ) );
}
}
+ else
+ {
+ xResult = CKR_ARGUMENTS_BAD;
+ }
/* Check whether a key pair is now present. In order to support X.509
* certificate enrollment, the public and private key objects must both be
