psa arch test v1.3 release candidate 1
diff --git a/secure-debug/val/include/pal_interfaces.h b/secure-debug/val/include/pal_interfaces.h
deleted file mode 100644
index 9f7390f..0000000
--- a/secure-debug/val/include/pal_interfaces.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/** @file
- * Copyright (c) 2021 Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-#ifndef _PAL_INTERFACES_H_
-#define _PAL_INTERFACES_H_
-
-#include <stdarg.h>
-#include <psa_adac.h>
-
-/**
- *   @brief    - This function parses the input string and writes bytes into logger TX FIFO
- *   @param    - str      : Input String
- *             - data     : Value for format specifier
- *   @return   - SUCCESS/FAILURE
-**/
-
-int pal_print(const char *str, int32_t data);
-
-/**
- *   @brief    - Terminates the simulation at the end of all tests completion.
- *               By default, it put cpus into power down mode.
- *   @param    - void
- *   @return   - void
-**/
-void pal_terminate_simulation(void);
-
-/**
- *   @brief    - Resets the system.
- *   @param    - void
- *   @return   - SUCCESS/FAILURE
-**/
-int pal_system_reset(void);
-
-request_packet_t *request_packet_lock(size_t *max_data_size);
-
-/**
- *   @brief    - Reserve the communication buffer memory for receive packet.
- *   @param    - max_data_size      Valid size of command frame
- *   @return   - Pointer to the command frame to be read
-**/
-response_packet_t *response_packet_lock(size_t *max_data_size);
-
-/**
- *   @brief    - Release the lock held by transmit packet.
- *   @param    - packet      Most recent command frame sent
- *   @return   - SUCCESS/FAILURE
-**/
-int request_packet_release(request_packet_t *packet);
-
-/**
- *   @brief    - Release the lock held by receive packet.
- *   @param    - packet      Most recent response packet received
- *   @return   - SUCCESS/FAILURE
-**/
-int response_packet_release(response_packet_t *packet);
-
-/**
- *   @brief    - Construct the Request packet for the specified ADAC command.
- *   @param    - command      ADAC command
- *               data         Pointer to payload
- *               data_size    Size of the command payload
- *   @return   - Pointer to the command frame to be written
-**/
-request_packet_t *request_packet_build(uint16_t command, uint8_t *data, size_t data_size);
-
-/**
- *   @brief    - Write the Request packet into the communication buffer for transmit.
- *   @param    - packet       Request packet built for dispatch
- *   @return   - SUCCESS/FAILURE
-**/
-int request_packet_send(request_packet_t *packet);
-
-/**
- *   @brief    - Read the Response packet from the communication buffer.
- *   @param    - None
- *   @return   - Response packet received from target.
-**/
-response_packet_t *response_packet_receive();
-
-#endif
diff --git a/secure-debug/val/include/val.h b/secure-debug/val/include/val.h
index 8ac9a98..4082c5c 100644
--- a/secure-debug/val/include/val.h
+++ b/secure-debug/val/include/val.h
@@ -36,12 +36,6 @@
 #define VERBOSE 9
 #endif
 
-#ifndef VAL_NSPE_BUILD
-#define STATIC_DECLARE  static
-#else
-#define STATIC_DECLARE
-#endif
-
 #ifndef __WEAK
 #define __WEAK __attribute__((weak))
 #endif
@@ -91,8 +85,6 @@
 #define IS_TEST_END(status)     (((status >> TEST_STATE_BIT) & TEST_STATE_MASK) == TEST_END)
 #define VAL_ERROR(status)       ((status & TEST_STATUS_MASK) ? 1 : 0)
 
-
-
 /* Test Defines */
 #define TEST_PUBLISH(test_id, entry) \
    const val_test_info_t __attribute__((section(".acs_test_info"))) \
@@ -101,15 +93,12 @@
 #define VAL_MAX_TEST_PER_COMP                200
 #define VAL_SECURE_DEBUG_BASE                  4
 
-
 #define VAL_GET_COMP_NUM(test_id)      \
    ((test_id - (test_id % VAL_MAX_TEST_PER_COMP)) / VAL_MAX_TEST_PER_COMP)
 #define VAL_GET_TEST_NUM(test_id)      (test_id % VAL_MAX_TEST_PER_COMP)
 #define VAL_CREATE_TEST_ID(comp, num)   ((comp*VAL_MAX_TEST_PER_COMP) + num)
 
 #define TEST_FIELD(num1, num2)           (num2 << 8 | num1)
-#define GET_TEST_ISOLATION_LEVEL(num)   (num & 0x3)
-#define GET_WD_TIMOUT_TYPE(num)         ((num >> 8) & 0x7)
 
 #define TEST_CHECKPOINT_NUM(n)          n
 #define TEST(n)                         n
@@ -125,9 +114,6 @@
 #define TEST_RETURN_RESULT              2
 #define INVALID_HANDLE                  0x1234DEAD
 
-#define VAL_NVMEM_BLOCK_SIZE           4
-#define VAL_NVMEM_OFFSET(nvmem_idx)    (nvmem_idx * VAL_NVMEM_BLOCK_SIZE)
-
 #define UART_INIT_SIGN  0xff
 #define UART_PRINT_SIGN 0xfe
 
@@ -191,53 +177,6 @@
     } while (0)
 
 /* enums */
-typedef enum {
-    CALLER_NONSECURE = 0x0,
-    CALLER_SECURE    = 0x1,
-} caller_security_t;
-
-typedef enum {
-    TEST_ISOLATION_L1      = 0x1,
-    TEST_ISOLATION_L2      = 0x2,
-    TEST_ISOLATION_L3      = 0x3,
-} test_isolation_level_t;
-
-typedef enum {
-    LEVEL1 = 0x1,
-    LEVEL2,
-    LEVEL3,
-} isolation_level_t;
-
-typedef enum {
-    /* VAL uses this boot flag to mark first time boot of the system  */
-    BOOT_UNKNOWN                       = 0x1,
-    /* VAL/Test uses this boot flag to catch any unwanted system reboot - SIM ERROR Cases*/
-    BOOT_NOT_EXPECTED                  = 0x2,
-    /* Test performs panic check for non-secure test run and expect reboot */
-    BOOT_EXPECTED_NS                   = 0x3,
-    /* Test performs panic check for secure test run and expect reboot */
-    BOOT_EXPECTED_S                    = 0x4,
-    /* Test expects reboot but it didn't happen */
-    BOOT_EXPECTED_BUT_FAILED           = 0x5,
-    /* Test expects reboot for secure/non-secure test run. If reboot happens,
-     * re-enter the same test and execute the next check function
-     */
-    BOOT_EXPECTED_REENTER_TEST         = 0x6,
-    /* Test expect reboot for the test run. If reboot happens,
-     * re-enter the same test and continue executing the same check function
-     */
-    BOOT_EXPECTED_CONT_TEST_EXEC       = 0x7,
-} boot_state_t;
-
-typedef enum {
-    NV_BOOT             = 0x0,
-    NV_TEST_ID_PREVIOUS = 0x1,
-    NV_TEST_ID_CURRENT  = 0x2,
-    NV_TEST_CNT         = 0x3,
-    NV_TEST_DATA1       = 0x4,
-    NV_TEST_DATA2       = 0x5,
-    NV_TEST_DATA3       = 0x6,
-} nvmem_index_t;
 
 /* enums to report test sub-state */
 typedef enum {
@@ -286,26 +225,7 @@
     PRINT_ALWAYS  = 9
 } print_verbosity_t;
 
-/* Driver test function id enums */
-typedef enum {
-    TEST_PSA_EOI_WITH_NON_INTR_SIGNAL    = 1,
-    TEST_PSA_EOI_WITH_MULTIPLE_SIGNALS   = 2,
-    TEST_PSA_EOI_WITH_UNASSERTED_SIGNAL  = 3,
-    TEST_INTR_SERVICE                    = 4,
-    TEST_ISOLATION_PSA_ROT_DATA_RD       = 5,
-    TEST_ISOLATION_PSA_ROT_DATA_WR       = 6,
-    TEST_ISOLATION_PSA_ROT_STACK_RD      = 7,
-    TEST_ISOLATION_PSA_ROT_STACK_WR      = 8,
-    TEST_ISOLATION_PSA_ROT_HEAP_RD       = 9,
-    TEST_ISOLATION_PSA_ROT_HEAP_WR       = 10,
-    TEST_ISOLATION_PSA_ROT_MMIO_RD       = 11,
-    TEST_ISOLATION_PSA_ROT_MMIO_WR       = 12,
-} driver_test_fn_id_t;
-
 /* typedef's */
-typedef struct {
-    boot_state_t state;
-} boot_t;
 
 typedef struct {
     uint32_t pass_cnt:8;
@@ -327,6 +247,4 @@
     uint8_t  status;
 } test_status_buffer_t;
 
-typedef int32_t (*client_test_t)(caller_security_t caller);
-typedef int32_t (*server_test_t)(void);
 #endif /* VAL_COMMON_H */
diff --git a/secure-debug/val/include/val_adac.h b/secure-debug/val/include/val_adac.h
deleted file mode 100644
index 6086df9..0000000
--- a/secure-debug/val/include/val_adac.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/** @file
- * Copyright (c) 2021, Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#ifndef _VAL_ADAC_H_
-#define _VAL_ADAC_H_
-#include <psa_adac.h>
-
-/** \brief Token header
- *
- */
-typedef struct {
-    uint16_t type;
-    uint8_t *data;
-    size_t size;
-} adac_command_frame_t;
-
-void val_adac_host_init(void);
-psa_status_t val_load_certificate_chain(const char *chain_file, uint8_t **chain,
-                                        size_t *chain_size);
-psa_status_t val_infer_cryptosystem(uint32_t *chain, size_t chain_size, psa_tlv_t **extns_list,
-                                size_t *extns_count, uint8_t *key_system);
-psa_status_t val_get_private_key(const char *key_file, uint8_t *type, psa_key_handle_t *handle,
-                                 uint8_t **key_ptr, size_t *size);
-request_packet_t *val_construct_command(uint16_t command, uint8_t *data, size_t data_size);
-psa_status_t val_issue_command(uint32_t command, request_packet_t *packet,
-                               uint8_t *data, size_t data_size);
-response_packet_t *val_await_response(void);
-psa_status_t val_parse_response(uint32_t command, response_packet_t *packet);
-
-psa_status_t val_sign_token(uint8_t challenge[], size_t challenge_size, uint8_t signature_type,
-                            uint8_t exts[], size_t exts_size, uint8_t *fragment[],
-                            size_t *fragment_size, psa_key_handle_t handle,
-                            uint8_t *key, size_t key_size);
-psa_status_t val_send_certificate(psa_tlv_t **extns_list, size_t extns_count);
-int val_check_cryptosystem_support(response_packet_t *packet, uint8_t key_system);
-
-#endif /* _VAL_ADAC_H_ */
diff --git a/secure-debug/val/include/val_entry.h b/secure-debug/val/include/val_entry.h
index f4d173f..6484dc6 100644
--- a/secure-debug/val/include/val_entry.h
+++ b/secure-debug/val/include/val_entry.h
@@ -18,10 +18,10 @@
 #ifndef _VAL_ENTRY_H_
 #define _VAL_ENTRY_H_
 
-#include "val_framework.h"
+#include "val.h"
 
-#define PSA_ACS_MAJOR_VER    1
-#define PSA_ACS_MINOR_VER    2
+#define PSA_ACS_MAJOR_VER    0
+#define PSA_ACS_MINOR_VER    6
 
 /**
     @brief    - PSA Test Suite C main function, does VAL init and calls test dispatcher
diff --git a/secure-debug/val/include/val_framework.h b/secure-debug/val/include/val_framework.h
index 5d53cbb..6aa0edf 100644
--- a/secure-debug/val/include/val_framework.h
+++ b/secure-debug/val/include/val_framework.h
@@ -20,7 +20,6 @@
 #define _VAL_INFRA_H_
 
 #include "val.h"
-#include "val_interfaces.h"
 
 /* prototypes */
 uint32_t     val_report_status(void);
diff --git a/secure-debug/val/include/val_interfaces.h b/secure-debug/val/include/val_interfaces.h
index eca9a63..b52ba6e 100644
--- a/secure-debug/val/include/val_interfaces.h
+++ b/secure-debug/val/include/val_interfaces.h
@@ -19,7 +19,6 @@
 #define _VAL_INTERFACES_H_
 
 #include "val.h"
-#include "pal_interfaces.h"
 
 /* typedef's */
 typedef struct {
diff --git a/secure-debug/val/src/val_adac.c b/secure-debug/val/src/val_adac.c
deleted file mode 100644
index 53f02d1..0000000
--- a/secure-debug/val/src/val_adac.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/** @file
- * Copyright (c) 2021 Arm Limited or its affiliates. All rights reserved.
- * SPDX-License-Identifier : Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
-**/
-
-#include <val_adac.h>
-#include <psa_adac_cryptosystems.h>
-#include <psa_adac_sdm.h>
-#include <psa_adac_debug.h>
-#include <pal_interfaces.h>
-
-void val_adac_host_init(void)
-{
-    psa_adac_platform_init();
-    psa_crypto_init();
-}
-
-psa_status_t val_load_certificate_chain(const char *chain_file, uint8_t **chain, size_t *chain_size)
-{
-    int ret_val;
-    psa_status_t r = PSA_SUCCESS;
-
-    if (chain_file == NULL) {
-        printf("Error:Path not found\n");
-        r = PSA_ERROR_INVALID_ARGUMENT;
-        return r;
-    }
-    ret_val = load_trust_chain(chain_file, chain, chain_size);
-    if (ret_val != 0) {
-        printf("Error loading trust chain (%s)\n", chain_file);
-        r = PSA_ERROR_GENERIC_ERROR;
-    }
-    return r;
-}
-
-psa_status_t val_infer_cryptosystem(uint32_t *chain, size_t chain_size, psa_tlv_t **extns_list,
-                              size_t *extns_count, uint8_t *key_system)
-{
-    int ret_val;
-    psa_status_t r = PSA_SUCCESS;
-    uint8_t key_type;
-    size_t count, i;
-    psa_tlv_t *current_extn;
-
-    ret_val = split_tlv_static(chain, chain_size, extns_list, MAX_EXTENSIONS, extns_count);
-    if (ret_val != 0) {
-        PSA_ADAC_LOG_ERR("host", "Error parsing trust chain\n");
-        r = PSA_ERROR_GENERIC_ERROR;
-        return r;
-    }
-    count = *extns_count;
-    if (count > MAX_EXTENSIONS) {
-        printf("Error:Extension count exceeded maximum allowed\n");
-        r = PSA_ERROR_NOT_PERMITTED;
-        return r;
-    }
-
-    PSA_ADAC_LOG_INFO("host", "Found %zu certificates\n", count);
-    for (i = 0; i < count; i++) {
-        current_extn = extns_list[i];
-        if ((current_extn)->type_id == 0x0201)
-            key_type = ((certificate_header_t *) current_extn->value)->key_type;
-    }
-    *key_system = key_type;
-    PSA_ADAC_LOG_INFO("host", "Cryptosystem detected: %d\n", key_type);
-    return r;
-}
-
-psa_status_t val_get_private_key(const char *key_file, uint8_t *type, psa_key_handle_t *handle,
-                                 uint8_t **key_ptr, size_t *size)
-{
-    int ret_val;
-    psa_status_t r = PSA_SUCCESS;
-    uint8_t key_type = *type;
-
-    if (key_file == NULL) {
-        printf("Error:Path not found\n");
-        r = PSA_ERROR_INVALID_ARGUMENT;
-        return r;
-    }
-
-    switch (key_type) {
-    case ECDSA_P256_SHA256:
-    case ECDSA_P521_SHA512:
-    case RSA_3072_SHA256:
-    case RSA_4096_SHA256:
-    case ED_25519_SHA512:
-    case ED_448_SHAKE256:
-    case SM_SM2_SM3:
-        ret_val = import_private_key(key_file, type, handle);
-        if (ret_val != 0) {
-            printf("Error importing private key (%s)\n", key_file);
-            r = PSA_ERROR_GENERIC_ERROR;
-        } else {
-            key_ptr = NULL;
-            size = 0;
-        }
-        break;
-
-    case CMAC_AES:
-    case HMAC_SHA256:
-        ret_val = load_secret_key(key_file, key_type, key_ptr, size);
-        if (ret_val != 0) {
-            printf("Error importing secret key (%s)\n", key_file);
-            r = PSA_ERROR_GENERIC_ERROR;
-        } else {
-            handle = NULL;
-        }
-        break;
-
-    default:
-        printf("Error: unsupported key type (0x%x)\n", key_type);
-        r = PSA_ERROR_NOT_SUPPORTED;
-    }
-    return r;
-}
-
-request_packet_t *val_construct_command(uint16_t cmd_type, uint8_t *data, size_t data_size)
-{
-    request_packet_t *packet = NULL;
-
-    switch (cmd_type) {
-    case SDP_RESUME_BOOT_CMD:
-    case SDP_LOCK_DEBUG_CMD:
-    case SDP_DISCOVERY_CMD:
-    case SDP_AUTH_START_CMD:
-        packet = request_packet_build(cmd_type, NULL, 0);
-        break;
-    case SDP_AUTH_RESPONSE_CMD:
-        if (data == NULL || data_size == 0) {
-            printf("Error: No payload specified\n");
-            break;
-        }
-        packet = request_packet_build((uint16_t)cmd_type, data, data_size);
-        break;
-    default:
-        //TO DO: Callback for vendor specific command construction
-        printf("Error: Unrecognized command. ID=(0x%x)\n", cmd_type);
-    }
-    return packet;
-}
-
-psa_status_t val_issue_command(uint32_t command, request_packet_t *packet,
-                               uint8_t *data, size_t data_size)
-{
-    int ret_val;
-    psa_status_t r = PSA_SUCCESS;
-
-    packet = val_construct_command((uint16_t)command, data, data_size);
-
-    if (packet == NULL) {
-        printf("Command construction failed\n");
-        r = PSA_ERROR_GENERIC_ERROR;
-        return r;
-    }
-
-    switch (command) {
-    case SDP_DISCOVERY_CMD:
-        printf("Sending discovery request\n");
-        break;
-    case SDP_AUTH_START_CMD:
-        printf("Sending challenge request\n");
-        break;
-    case SDP_AUTH_RESPONSE_CMD:
-        printf("Sending authentication response\n");
-        break;
-    case SDP_RESUME_BOOT_CMD:
-        printf("Sending close session command\n");
-        break;
-    case SDP_LOCK_DEBUG_CMD:
-        printf("Sending lock debug request\n");
-    default:
-        //TO DO: Vendor specific message
-        printf("Error: Unrecognized command. ID=(0x%x)\n", command);
-        r = PSA_ERROR_NOT_SUPPORTED;
-    }
-    ret_val = request_packet_send(packet);
-    if (ret_val < 0)
-        r = PSA_ERROR_GENERIC_ERROR;
-
-    request_packet_release(packet);
-    return r;
-}
-
-response_packet_t *val_await_response(void)
-{
-    return response_packet_receive();
-}
-
-psa_status_t val_parse_response(uint32_t command, response_packet_t *packet)
-{
-    int ret_val;
-    psa_status_t r = PSA_SUCCESS;
-    size_t i;
-    psa_tlv_t *tlv;
-    psa_auth_challenge_t *challenge;
-
-    if (packet == NULL) {
-        printf("Error: Target response not obtained\n");
-        r = PSA_ERROR_COMMUNICATION_FAILURE;
-        return r;
-    }
-
-    switch (command) {
-    case SDP_DISCOVERY_CMD:
-        printf("Receiving discovery response...\n");
-        for (i = 0; (i + 4) < (packet->data_count * 4);) {
-            tlv = (psa_tlv_t *) (((uint8_t *)packet->data) + i);
-            i += sizeof(psa_tlv_t) + tlv->length_in_bytes;
-        }
-        break;
-    case SDP_AUTH_START_CMD:
-        printf("Receiving challenge\n");
-        printf("status = 0x%04x, data_count = %d\n", packet->status, packet->data_count);
-        if (packet->data_count * 4 != sizeof(psa_auth_challenge_t)) {
-            r = PSA_ERROR_GENERIC_ERROR;
-            return r;
-        }
-        challenge = (psa_auth_challenge_t *) packet->data;
-        PSA_ADAC_LOG_DUMP("host", "challenge", challenge->challenge_vector,
-                           sizeof(challenge->challenge_vector));
-        break;
-    case SDP_AUTH_RESPONSE_CMD:
-    case SDP_RESUME_BOOT_CMD:
-    case SDP_LOCK_DEBUG_CMD:
-        printf("status = 0x%04x, data_count = %d\n", packet->status, packet->data_count);
-        break;
-    default:
-        r = PSA_ERROR_NOT_SUPPORTED;
-    }
-    return r;
-}
-
-psa_status_t val_sign_token(uint8_t challenge[], size_t challenge_size, uint8_t signature_type,
-                            uint8_t exts[], size_t exts_size, uint8_t *fragment[],
-                            size_t *fragment_size, psa_key_handle_t handle,
-                            uint8_t *key, size_t key_size)
-{
-    psa_status_t r;
-
-    r = psa_adac_sign_token(challenge, challenge_size, signature_type, exts, exts_size,
-                           fragment, fragment_size, handle, key, key_size);
-    if (r == PSA_SUCCESS) {
-        PSA_ADAC_LOG_DUMP("host", "token", *fragment, *fragment_size);
-    } else {
-        PSA_ADAC_LOG_ERR("host", "Error signing token\n");
-        r = PSA_ERROR_GENERIC_ERROR;
-    }
-    return r;
-}
-
-psa_status_t val_send_certificate(psa_tlv_t **extns_list, size_t extns_count)
-{
-    request_packet_t *request;
-    response_packet_t *response;
-    psa_status_t r;
-    uint8_t *payload;
-    size_t i, payload_size;
-    psa_tlv_t *current_extn;
-
-    for (size_t i = 0; i < extns_count; i++) {
-        current_extn = extns_list[i];
-        if (current_extn->type_id == 0x0201) {
-            payload = (uint8_t *)current_extn;
-            payload_size = current_extn->length_in_bytes + sizeof(psa_tlv_t);
-
-            printf("Sending Certificate\n");
-            r = val_issue_command(SDP_AUTH_RESPONSE_CMD, request, payload, payload_size);
-            if (r != PSA_SUCCESS)
-                return r;
-
-            printf("Receiving token_authentication response\n");
-            response = val_await_response();
-            r = val_parse_response(SDP_AUTH_RESPONSE_CMD, response);
-            if (r != PSA_SUCCESS)
-                return r;
-
-            if (response->status == SDP_NEED_MORE_DATA)
-                response_packet_release(response);
-        }
-    }
-    if (response->status != SDP_NEED_MORE_DATA) {
-        PSA_ADAC_LOG_ERR("host", "Unexpected response status %x\n", response->status);
-        r = PSA_ERROR_GENERIC_ERROR;
-        return r;
-    }
-    response_packet_release(response);
-    return r;
-}
-
-int val_check_cryptosystem_support(response_packet_t *packet, uint8_t key_system)
-{
-    int found = 0, j;
-    size_t i = 0;
-    psa_tlv_t *tlv;
-    uint8_t *key_support_types = NULL;
-
-    while ((i + 4) < (packet->data_count * 4)) {
-        tlv = (psa_tlv_t *) (((uint8_t *)packet->data) + i);
-        if (tlv->type_id == 0x0102) {
-           key_support_types = tlv->value;
-           for (j = 0; j < (tlv->length_in_bytes); j++) {
-                if (*(key_support_types+j) == key_system) {
-                    found = 1;
-                    break;
-                }
-           }
-        }
-        i += sizeof(psa_tlv_t) + tlv->length_in_bytes;
-    }
-
-    if (key_support_types == NULL)
-        printf("Cryptosystem Type ID not found in target's response\n");
-    else if (!found)
-        printf("Cryptosystem not supported by target\n");
-    else
-        printf("Cryptosystem supported by target\n");
-
-    return found;
-}
diff --git a/secure-debug/val/src/val_dispatcher.c b/secure-debug/val/src/val_dispatcher.c
index 86426cc..020c91c 100644
--- a/secure-debug/val/src/val_dispatcher.c
+++ b/secure-debug/val/src/val_dispatcher.c
@@ -20,10 +20,9 @@
 #include "val_interfaces.h"
 #include "val_peripherals.h"
 
-
 extern val_api_t val_api;
 
-/* gloabls */
+/* globals */
 addr_t          g_test_info_addr;
 
 /**
@@ -151,10 +150,8 @@
 **/
 int32_t val_dispatcher(test_id_t test_id_prev)
 {
-
     test_id_t            test_id;
     val_status_t         status;
-    boot_t               boot;
     test_count_t         test_count = {0,};
     uint32_t             test_result;
 
@@ -214,9 +211,3 @@
    return (test_count.fail_cnt > 0) ? VAL_STATUS_TEST_FAILED : VAL_STATUS_SUCCESS;
 }
 
-
-
-
-
-
-
diff --git a/secure-debug/val/src/val_entry.c b/secure-debug/val/src/val_entry.c
index 1d13bcb..fdfbcc9 100644
--- a/secure-debug/val/src/val_entry.c
+++ b/secure-debug/val/src/val_entry.c
@@ -19,8 +19,7 @@
 #include "val_framework.h"
 #include "val_peripherals.h"
 #include "val_dispatcher.h"
-
-int32_t val_entry(void);
+#include "pal_interfaces.h"
 
 /**
     @brief    - PSA C main function, does VAL init and calls test dispatcher
diff --git a/secure-debug/val/src/val_framework.c b/secure-debug/val/src/val_framework.c
index 2a700b4..bf7af91 100644
--- a/secure-debug/val/src/val_framework.c
+++ b/secure-debug/val/src/val_framework.c
@@ -19,12 +19,9 @@
 #include "val_interfaces.h"
 #include "val_dispatcher.h"
 #include "val_peripherals.h"
-#include "pal_interfaces.h"
-
 
 extern val_api_t val_api;
 
-
 /* globals */
 test_status_buffer_t    g_status_buffer;
 
@@ -72,7 +69,6 @@
             state = TEST_FAIL;
             val_print(PRINT_ALWAYS, "\nTEST RESULT: FAILED(Error Code=0x%x)\n", VAL_STATUS_INVALID);
             break;
-
     }
 
     val_print(PRINT_ALWAYS, "\n******************************************\n", 0);
@@ -119,9 +115,8 @@
         if (VAL_ERROR(status)) {
             val_print(PRINT_ERROR, "\tCheckpoint %d : ", checkpoint);
             val_print(PRINT_ERROR, "Error Code=0x%x \n", status);
-        } else {
+        } else
             val_print(PRINT_DEBUG, "\tCheckpoint %d \n", checkpoint);
-        }
     }
     return status;
 }
diff --git a/secure-debug/val/src/val_interfaces.c b/secure-debug/val/src/val_interfaces.c
index 63c041d..133c679 100644
--- a/secure-debug/val/src/val_interfaces.c
+++ b/secure-debug/val/src/val_interfaces.c
@@ -15,7 +15,6 @@
  * limitations under the License.
 **/
 
-
 #include "val_framework.h"
 #include "val_interfaces.h"
 #include "val_peripherals.h"
diff --git a/secure-debug/val/src/val_peripherals.c b/secure-debug/val/src/val_peripherals.c
index e804485..4114a3e 100644
--- a/secure-debug/val/src/val_peripherals.c
+++ b/secure-debug/val/src/val_peripherals.c
@@ -17,7 +17,6 @@
 
 #include "val_peripherals.h"
 #include "pal_interfaces.h"
-#include "val_framework.h"
 
 /* Global */
 uint32_t   is_logger_init_done = 0;
diff --git a/secure-debug/val/val.cmake b/secure-debug/val/val.cmake
index 665db48..c42975b 100644
--- a/secure-debug/val/val.cmake
+++ b/secure-debug/val/val.cmake
@@ -15,14 +15,9 @@
 # * limitations under the License.
 #**/
 
-if(NOT DEFINED PSA_ADAC_ROOT)
-    get_filename_component(PSA_ADAC_ROOT ${CMAKE_SOURCE_DIR}/psa-adac ABSOLUTE)
-endif()
-
 # Listing all the sources from val
 list(APPEND VAL_SRC_C
 	${CMAKE_SOURCE_DIR}/val/src/val_entry.c
-	${CMAKE_SOURCE_DIR}/val/src/val_adac.c
 	${CMAKE_SOURCE_DIR}/val/src/val_dispatcher.c
 	${CMAKE_SOURCE_DIR}/val/src/val_framework.c
 	${CMAKE_SOURCE_DIR}/val/src/val_interfaces.c
@@ -33,10 +28,9 @@
 add_library(${ADAC_HOST_VAL_LIB} STATIC ${VAL_SRC_C})
 
 target_include_directories(${ADAC_HOST_VAL_LIB} PRIVATE
-    ${CMAKE_SOURCE_DIR}/val/include
     ${CMAKE_BINARY_DIR}
-    ${PSA_ADAC_ROOT}/psa-adac/core/include
-    ${PSA_ADAC_ROOT}/psa-adac/sdm/include
+    ${CMAKE_SOURCE_DIR}/val/include
+    ${CMAKE_SOURCE_DIR}/platform/common/include
     )
 
-target_link_libraries(${ADAC_HOST_VAL_LIB} mbedcrypto)
+target_link_libraries(${ADAC_HOST_VAL_LIB} ${ADAC_HOST_PAL_LIB})