Consistently abort key derivation operations on input error
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 1494593..07c6261 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -5163,7 +5163,10 @@
                                       PSA_KEY_USAGE_DERIVE,
                                       operation->alg );
     if( status != PSA_SUCCESS )
+    {
+        psa_key_derivation_abort( operation );
         return( status );
+    }
     return( psa_key_derivation_input_internal( operation,
                                                step, slot->attr.type,
                                                slot->data.raw.data,