ADAC: Add stub close session functionality

Add stub implementation of the psa_adac_close_session command for the
platforms to implement custom terminate session functionality.

Signed-off-by: Maulik Patel <maulik.patel@arm.com>
Change-Id: Id584ee3b6c5f7d177fe38584f266b1f057b690dc
diff --git a/psa-adac/core/include/psa_adac.h b/psa-adac/core/include/psa_adac.h
index 1ed4d5a..2330c5c 100644
--- a/psa-adac/core/include/psa_adac.h
+++ b/psa-adac/core/include/psa_adac.h
@@ -121,6 +121,7 @@
     ADAC_DISCOVERY_CMD = 0x01,      /**< `Discovery` command */
     ADAC_AUTH_START_CMD = 0x02,     /**< `Start Authentication` command */
     ADAC_AUTH_RESPONSE_CMD = 0x03,  /**< `Authentication Response` command */
+    ADAC_CLOSE_SESSION_CMD = 0x04,     /**< `Close Session` command */
     ADAC_RESUME_CMD = 0x05,         /**< `Resume` command */
     ADAC_LOCK_DEBUG_CMD = 0x06,     /**< `Lock Debug` command */
     ADAC_LCS_CHANGE = 0x100,        /**< `Change Life-cycle State` command */
diff --git a/psa-adac/sda/src/psa_adac_sda.c b/psa-adac/sda/src/psa_adac_sda.c
index cfeaba2..d8de906 100644
--- a/psa-adac/sda/src/psa_adac_sda.c
+++ b/psa-adac/sda/src/psa_adac_sda.c
@@ -382,13 +382,14 @@
                 ret = authenticator_send_response(auth_ctx, response);
                 break;
 
-                /* Send success status but otherwise do nothing. */
-            case ADAC_LOCK_DEBUG_CMD:
-                PSA_ADAC_LOG_DEBUG("auth", "Lock debug\r\n");
+                /* Send success status and terminate command loop. */
+            case ADAC_CLOSE_SESSION_CMD:
+                PSA_ADAC_LOG_DEBUG("auth", "Terminate session \r\n");
                 (void) authenticator_request_packet_release(auth_ctx, request);
-                psa_adac_platform_lock();
+                psa_adac_close_session();
                 response = authenticator_response_packet_build(auth_ctx, ADAC_SUCCESS, NULL, 0);
                 ret = authenticator_send_response(auth_ctx, response);
+                done = 1;
                 break;
 
                 /* Send success status and terminate command loop. */
@@ -401,6 +402,15 @@
                 done = 1;
                 break;
 
+                /* Send success status but otherwise do nothing. */
+            case ADAC_LOCK_DEBUG_CMD:
+                PSA_ADAC_LOG_DEBUG("auth", "Lock debug\r\n");
+                (void) authenticator_request_packet_release(auth_ctx, request);
+                psa_adac_platform_lock();
+                response = authenticator_response_packet_build(auth_ctx, ADAC_SUCCESS, NULL, 0);
+                ret = authenticator_send_response(auth_ctx, response);
+                break;
+
             case ADAC_LCS_CHANGE:
                 PSA_ADAC_LOG_DEBUG("auth", "Change LCS \n");
                 response = authentication_change_lcs(auth_ctx, request);