quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

key_agreement.h (1966B)


      1 /*
      2  * Test driver for key agreement functions.
      3  */
      4 /*  Copyright The Mbed TLS Contributors
      5  *  SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
      6  */
      7 
      8 #ifndef PSA_CRYPTO_TEST_DRIVERS_KEY_AGREEMENT_H
      9 #define PSA_CRYPTO_TEST_DRIVERS_KEY_AGREEMENT_H
     10 
     11 #include "mbedtls/build_info.h"
     12 
     13 #if defined(PSA_CRYPTO_DRIVER_TEST)
     14 #include "test_driver_common.h"
     15 
     16 #include <psa/crypto_driver_common.h>
     17 
     18 typedef struct {
     19     /* If non-null, on success, copy this to the output. */
     20     void *forced_output;
     21     size_t forced_output_length;
     22     /* If not PSA_SUCCESS, return this error code instead of processing the
     23      * function call. */
     24     psa_status_t forced_status;
     25     /* Count the amount of times one of the signature driver functions is called. */
     26     unsigned long hits;
     27 } mbedtls_test_driver_key_agreement_hooks_t;
     28 
     29 #define MBEDTLS_TEST_DRIVER_KEY_AGREEMENT_INIT { NULL, 0, PSA_SUCCESS, 0 }
     30 static inline mbedtls_test_driver_key_agreement_hooks_t
     31 mbedtls_test_driver_key_agreement_hooks_init(void)
     32 {
     33     const mbedtls_test_driver_key_agreement_hooks_t
     34         v = MBEDTLS_TEST_DRIVER_KEY_AGREEMENT_INIT;
     35     return v;
     36 }
     37 
     38 extern mbedtls_test_driver_key_agreement_hooks_t
     39     mbedtls_test_driver_key_agreement_hooks;
     40 
     41 psa_status_t mbedtls_test_transparent_key_agreement(
     42     const psa_key_attributes_t *attributes,
     43     const uint8_t *key_buffer,
     44     size_t key_buffer_size,
     45     psa_algorithm_t alg,
     46     const uint8_t *peer_key,
     47     size_t peer_key_length,
     48     uint8_t *shared_secret,
     49     size_t shared_secret_size,
     50     size_t *shared_secret_length);
     51 
     52 psa_status_t mbedtls_test_opaque_key_agreement(
     53     const psa_key_attributes_t *attributes,
     54     const uint8_t *key_buffer,
     55     size_t key_buffer_size,
     56     psa_algorithm_t alg,
     57     const uint8_t *peer_key,
     58     size_t peer_key_length,
     59     uint8_t *shared_secret,
     60     size_t shared_secret_size,
     61     size_t *shared_secret_length);
     62 
     63 #endif /*PSA_CRYPTO_DRIVER_TEST */
     64 #endif /* PSA_CRYPTO_TEST_DRIVERS_KEY_AGREEMENT_H */