初始提交:terminalX 可运行态(M0/M1/M1.5 已真机验证)
- M0: libghostty SSH 终端(渲染/输入/连接)+ 白屏修复(OutputGate) + 会话状态机/自动重连 - M1: tsnet 用户态组网 + SSH-over-tsnet(fd 桥),shell 级真机验证;R5(Go+gvisor+C+++Swift 同进程) retire - M1.5: tmux -CC 原生 tab(MVP) - 结构: packages/(TXCore·TXTransport), apps/TerminalX, vendor/(libghostty-spm/libssh2/mbedtls/tsnet-bridge), artifacts/ - 文档: CLAUDE.md + docs/HANDOFF.md(新会话入口) - 环境: 认证代理→依赖 vendor 本地化;Go 在 ~/.local/go;仅模拟器/未签名 - 待续: M2 mosh, tmux 多 pane, M4 安全(host key/SE) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
123
vendor/mbedtls/framework/tests/include/test/drivers/aead.h
vendored
Normal file
123
vendor/mbedtls/framework/tests/include/test/drivers/aead.h
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Test driver for AEAD driver entry points.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_TEST_DRIVERS_AEAD_H
|
||||
#define PSA_CRYPTO_TEST_DRIVERS_AEAD_H
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#include "test_driver_common.h"
|
||||
|
||||
#include <psa/crypto_driver_common.h>
|
||||
|
||||
typedef struct {
|
||||
/* If not PSA_SUCCESS, return this error code instead of processing the
|
||||
* function call. */
|
||||
psa_status_t forced_status;
|
||||
/* Count the amount of times AEAD driver functions are called. */
|
||||
unsigned long hits_encrypt;
|
||||
unsigned long hits_decrypt;
|
||||
unsigned long hits_encrypt_setup;
|
||||
unsigned long hits_decrypt_setup;
|
||||
unsigned long hits_set_nonce;
|
||||
unsigned long hits_set_lengths;
|
||||
unsigned long hits_update_ad;
|
||||
unsigned long hits_update;
|
||||
unsigned long hits_finish;
|
||||
unsigned long hits_verify;
|
||||
unsigned long hits_abort;
|
||||
|
||||
/* Status returned by the last AEAD driver function call. */
|
||||
psa_status_t driver_status;
|
||||
} mbedtls_test_driver_aead_hooks_t;
|
||||
|
||||
#define MBEDTLS_TEST_DRIVER_AEAD_INIT { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
static inline mbedtls_test_driver_aead_hooks_t
|
||||
mbedtls_test_driver_aead_hooks_init(void)
|
||||
{
|
||||
const mbedtls_test_driver_aead_hooks_t v = MBEDTLS_TEST_DRIVER_AEAD_INIT;
|
||||
return v;
|
||||
}
|
||||
|
||||
extern mbedtls_test_driver_aead_hooks_t mbedtls_test_driver_aead_hooks;
|
||||
|
||||
psa_status_t mbedtls_test_transparent_aead_encrypt(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *nonce, size_t nonce_length,
|
||||
const uint8_t *additional_data, size_t additional_data_length,
|
||||
const uint8_t *plaintext, size_t plaintext_length,
|
||||
uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_aead_decrypt(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *nonce, size_t nonce_length,
|
||||
const uint8_t *additional_data, size_t additional_data_length,
|
||||
const uint8_t *ciphertext, size_t ciphertext_length,
|
||||
uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_aead_encrypt_setup(
|
||||
mbedtls_transparent_test_driver_aead_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||
psa_algorithm_t alg);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_aead_decrypt_setup(
|
||||
mbedtls_transparent_test_driver_aead_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer, size_t key_buffer_size,
|
||||
psa_algorithm_t alg);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_aead_set_nonce(
|
||||
mbedtls_transparent_test_driver_aead_operation_t *operation,
|
||||
const uint8_t *nonce,
|
||||
size_t nonce_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_aead_set_lengths(
|
||||
mbedtls_transparent_test_driver_aead_operation_t *operation,
|
||||
size_t ad_length,
|
||||
size_t plaintext_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_aead_update_ad(
|
||||
mbedtls_transparent_test_driver_aead_operation_t *operation,
|
||||
const uint8_t *input,
|
||||
size_t input_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_aead_update(
|
||||
mbedtls_transparent_test_driver_aead_operation_t *operation,
|
||||
const uint8_t *input,
|
||||
size_t input_length,
|
||||
uint8_t *output,
|
||||
size_t output_size,
|
||||
size_t *output_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_aead_finish(
|
||||
mbedtls_transparent_test_driver_aead_operation_t *operation,
|
||||
uint8_t *ciphertext,
|
||||
size_t ciphertext_size,
|
||||
size_t *ciphertext_length,
|
||||
uint8_t *tag,
|
||||
size_t tag_size,
|
||||
size_t *tag_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_aead_verify(
|
||||
mbedtls_transparent_test_driver_aead_operation_t *operation,
|
||||
uint8_t *plaintext,
|
||||
size_t plaintext_size,
|
||||
size_t *plaintext_length,
|
||||
const uint8_t *tag,
|
||||
size_t tag_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_aead_abort(
|
||||
mbedtls_transparent_test_driver_aead_operation_t *operation);
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
#endif /* PSA_CRYPTO_TEST_DRIVERS_AEAD_H */
|
||||
69
vendor/mbedtls/framework/tests/include/test/drivers/asymmetric_encryption.h
vendored
Normal file
69
vendor/mbedtls/framework/tests/include/test/drivers/asymmetric_encryption.h
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Test driver for asymmetric encryption.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_TEST_DRIVERS_ASYMMETRIC_ENCRYPTION_H
|
||||
#define PSA_CRYPTO_TEST_DRIVERS_ASYMMETRIC_ENCRYPTION_H
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#include "test_driver_common.h"
|
||||
|
||||
#include <psa/crypto_driver_common.h>
|
||||
#include <psa/crypto.h>
|
||||
|
||||
typedef struct {
|
||||
/* If non-null, on success, copy this to the output. */
|
||||
void *forced_output;
|
||||
size_t forced_output_length;
|
||||
/* If not PSA_SUCCESS, return this error code instead of processing the
|
||||
* function call. */
|
||||
psa_status_t forced_status;
|
||||
/* Count the amount of times one of the asymmetric_encryption driver
|
||||
functions is called. */
|
||||
unsigned long hits;
|
||||
} mbedtls_test_driver_asymmetric_encryption_hooks_t;
|
||||
|
||||
#define MBEDTLS_TEST_DRIVER_ASYMMETRIC_ENCRYPTION_INIT { NULL, 0, PSA_SUCCESS, 0 }
|
||||
|
||||
static inline mbedtls_test_driver_asymmetric_encryption_hooks_t
|
||||
mbedtls_test_driver_asymmetric_encryption_hooks_init(void)
|
||||
{
|
||||
const mbedtls_test_driver_asymmetric_encryption_hooks_t v =
|
||||
MBEDTLS_TEST_DRIVER_ASYMMETRIC_ENCRYPTION_INIT;
|
||||
return v;
|
||||
}
|
||||
|
||||
extern mbedtls_test_driver_asymmetric_encryption_hooks_t
|
||||
mbedtls_test_driver_asymmetric_encryption_hooks;
|
||||
|
||||
psa_status_t mbedtls_test_transparent_asymmetric_encrypt(
|
||||
const psa_key_attributes_t *attributes, const uint8_t *key_buffer,
|
||||
size_t key_buffer_size, psa_algorithm_t alg, const uint8_t *input,
|
||||
size_t input_length, const uint8_t *salt, size_t salt_length,
|
||||
uint8_t *output, size_t output_size, size_t *output_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_asymmetric_encrypt(
|
||||
const psa_key_attributes_t *attributes, const uint8_t *key,
|
||||
size_t key_length, psa_algorithm_t alg, const uint8_t *input,
|
||||
size_t input_length, const uint8_t *salt, size_t salt_length,
|
||||
uint8_t *output, size_t output_size, size_t *output_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_asymmetric_decrypt(
|
||||
const psa_key_attributes_t *attributes, const uint8_t *key_buffer,
|
||||
size_t key_buffer_size, psa_algorithm_t alg, const uint8_t *input,
|
||||
size_t input_length, const uint8_t *salt, size_t salt_length,
|
||||
uint8_t *output, size_t output_size, size_t *output_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_asymmetric_decrypt(
|
||||
const psa_key_attributes_t *attributes, const uint8_t *key,
|
||||
size_t key_length, psa_algorithm_t alg, const uint8_t *input,
|
||||
size_t input_length, const uint8_t *salt, size_t salt_length,
|
||||
uint8_t *output, size_t output_size, size_t *output_length);
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
#endif /* PSA_CRYPTO_TEST_DRIVERS_ASYMMETRIC_ENCRYPTION_H */
|
||||
142
vendor/mbedtls/framework/tests/include/test/drivers/cipher.h
vendored
Normal file
142
vendor/mbedtls/framework/tests/include/test/drivers/cipher.h
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* Test driver for cipher functions
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_TEST_DRIVERS_CIPHER_H
|
||||
#define PSA_CRYPTO_TEST_DRIVERS_CIPHER_H
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#include "test_driver_common.h"
|
||||
|
||||
#include <psa/crypto_driver_common.h>
|
||||
#include <psa/crypto.h>
|
||||
|
||||
#if !defined(MBEDTLS_VERSION_MAJOR) || MBEDTLS_VERSION_MAJOR >= 4
|
||||
#include "mbedtls/private/cipher.h"
|
||||
#else
|
||||
#include "mbedtls/cipher.h"
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
/* If non-null, on success, copy this to the output. */
|
||||
void *forced_output;
|
||||
size_t forced_output_length;
|
||||
/* If not PSA_SUCCESS, return this error code instead of processing the
|
||||
* function call. */
|
||||
psa_status_t forced_status;
|
||||
psa_status_t forced_status_encrypt;
|
||||
psa_status_t forced_status_set_iv;
|
||||
/* Count the amount of times one of the cipher driver functions is called. */
|
||||
unsigned long hits;
|
||||
unsigned long hits_encrypt;
|
||||
unsigned long hits_set_iv;
|
||||
} mbedtls_test_driver_cipher_hooks_t;
|
||||
|
||||
#define MBEDTLS_TEST_DRIVER_CIPHER_INIT { NULL, 0, \
|
||||
PSA_SUCCESS, PSA_SUCCESS, PSA_SUCCESS, \
|
||||
0, 0, 0 }
|
||||
static inline mbedtls_test_driver_cipher_hooks_t
|
||||
mbedtls_test_driver_cipher_hooks_init(void)
|
||||
{
|
||||
const mbedtls_test_driver_cipher_hooks_t v = MBEDTLS_TEST_DRIVER_CIPHER_INIT;
|
||||
return v;
|
||||
}
|
||||
|
||||
extern mbedtls_test_driver_cipher_hooks_t mbedtls_test_driver_cipher_hooks;
|
||||
|
||||
psa_status_t mbedtls_test_transparent_cipher_encrypt(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *iv, size_t iv_length,
|
||||
const uint8_t *input, size_t input_length,
|
||||
uint8_t *output, size_t output_size, size_t *output_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_cipher_decrypt(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *input, size_t input_length,
|
||||
uint8_t *output, size_t output_size, size_t *output_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_cipher_encrypt_setup(
|
||||
mbedtls_transparent_test_driver_cipher_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_cipher_decrypt_setup(
|
||||
mbedtls_transparent_test_driver_cipher_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_cipher_abort(
|
||||
mbedtls_transparent_test_driver_cipher_operation_t *operation);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_cipher_set_iv(
|
||||
mbedtls_transparent_test_driver_cipher_operation_t *operation,
|
||||
const uint8_t *iv, size_t iv_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_cipher_update(
|
||||
mbedtls_transparent_test_driver_cipher_operation_t *operation,
|
||||
const uint8_t *input, size_t input_length,
|
||||
uint8_t *output, size_t output_size, size_t *output_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_cipher_finish(
|
||||
mbedtls_transparent_test_driver_cipher_operation_t *operation,
|
||||
uint8_t *output, size_t output_size, size_t *output_length);
|
||||
|
||||
/*
|
||||
* opaque versions
|
||||
*/
|
||||
psa_status_t mbedtls_test_opaque_cipher_encrypt(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *iv, size_t iv_length,
|
||||
const uint8_t *input, size_t input_length,
|
||||
uint8_t *output, size_t output_size, size_t *output_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_cipher_decrypt(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *input, size_t input_length,
|
||||
uint8_t *output, size_t output_size, size_t *output_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_cipher_encrypt_setup(
|
||||
mbedtls_opaque_test_driver_cipher_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_cipher_decrypt_setup(
|
||||
mbedtls_opaque_test_driver_cipher_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_cipher_abort(
|
||||
mbedtls_opaque_test_driver_cipher_operation_t *operation);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_cipher_set_iv(
|
||||
mbedtls_opaque_test_driver_cipher_operation_t *operation,
|
||||
const uint8_t *iv, size_t iv_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_cipher_update(
|
||||
mbedtls_opaque_test_driver_cipher_operation_t *operation,
|
||||
const uint8_t *input, size_t input_length,
|
||||
uint8_t *output, size_t output_size, size_t *output_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_cipher_finish(
|
||||
mbedtls_opaque_test_driver_cipher_operation_t *operation,
|
||||
uint8_t *output, size_t output_size, size_t *output_length);
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
#endif /* PSA_CRYPTO_TEST_DRIVERS_CIPHER_H */
|
||||
66
vendor/mbedtls/framework/tests/include/test/drivers/hash.h
vendored
Normal file
66
vendor/mbedtls/framework/tests/include/test/drivers/hash.h
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Test driver for hash driver entry points.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_TEST_DRIVERS_HASH_H
|
||||
#define PSA_CRYPTO_TEST_DRIVERS_HASH_H
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#include "test_driver_common.h"
|
||||
|
||||
#include <psa/crypto_driver_common.h>
|
||||
|
||||
typedef struct {
|
||||
/* If not PSA_SUCCESS, return this error code instead of processing the
|
||||
* function call. */
|
||||
psa_status_t forced_status;
|
||||
/* Count the amount of times hash driver entry points are called. */
|
||||
unsigned long hits;
|
||||
/* Status returned by the last hash driver entry point call. */
|
||||
psa_status_t driver_status;
|
||||
} mbedtls_test_driver_hash_hooks_t;
|
||||
|
||||
#define MBEDTLS_TEST_DRIVER_HASH_INIT { 0, 0, 0 }
|
||||
static inline mbedtls_test_driver_hash_hooks_t
|
||||
mbedtls_test_driver_hash_hooks_init(void)
|
||||
{
|
||||
const mbedtls_test_driver_hash_hooks_t v = MBEDTLS_TEST_DRIVER_HASH_INIT;
|
||||
return v;
|
||||
}
|
||||
|
||||
extern mbedtls_test_driver_hash_hooks_t mbedtls_test_driver_hash_hooks;
|
||||
|
||||
psa_status_t mbedtls_test_transparent_hash_compute(
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *input, size_t input_length,
|
||||
uint8_t *hash, size_t hash_size, size_t *hash_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_hash_setup(
|
||||
mbedtls_transparent_test_driver_hash_operation_t *operation,
|
||||
psa_algorithm_t alg);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_hash_clone(
|
||||
const mbedtls_transparent_test_driver_hash_operation_t *source_operation,
|
||||
mbedtls_transparent_test_driver_hash_operation_t *target_operation);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_hash_update(
|
||||
mbedtls_transparent_test_driver_hash_operation_t *operation,
|
||||
const uint8_t *input,
|
||||
size_t input_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_hash_finish(
|
||||
mbedtls_transparent_test_driver_hash_operation_t *operation,
|
||||
uint8_t *hash,
|
||||
size_t hash_size,
|
||||
size_t *hash_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_hash_abort(
|
||||
mbedtls_transparent_test_driver_hash_operation_t *operation);
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
#endif /* PSA_CRYPTO_TEST_DRIVERS_HASH_H */
|
||||
64
vendor/mbedtls/framework/tests/include/test/drivers/key_agreement.h
vendored
Normal file
64
vendor/mbedtls/framework/tests/include/test/drivers/key_agreement.h
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Test driver for key agreement functions.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_TEST_DRIVERS_KEY_AGREEMENT_H
|
||||
#define PSA_CRYPTO_TEST_DRIVERS_KEY_AGREEMENT_H
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#include "test_driver_common.h"
|
||||
|
||||
#include <psa/crypto_driver_common.h>
|
||||
|
||||
typedef struct {
|
||||
/* If non-null, on success, copy this to the output. */
|
||||
void *forced_output;
|
||||
size_t forced_output_length;
|
||||
/* If not PSA_SUCCESS, return this error code instead of processing the
|
||||
* function call. */
|
||||
psa_status_t forced_status;
|
||||
/* Count the amount of times one of the signature driver functions is called. */
|
||||
unsigned long hits;
|
||||
} mbedtls_test_driver_key_agreement_hooks_t;
|
||||
|
||||
#define MBEDTLS_TEST_DRIVER_KEY_AGREEMENT_INIT { NULL, 0, PSA_SUCCESS, 0 }
|
||||
static inline mbedtls_test_driver_key_agreement_hooks_t
|
||||
mbedtls_test_driver_key_agreement_hooks_init(void)
|
||||
{
|
||||
const mbedtls_test_driver_key_agreement_hooks_t
|
||||
v = MBEDTLS_TEST_DRIVER_KEY_AGREEMENT_INIT;
|
||||
return v;
|
||||
}
|
||||
|
||||
extern mbedtls_test_driver_key_agreement_hooks_t
|
||||
mbedtls_test_driver_key_agreement_hooks;
|
||||
|
||||
psa_status_t mbedtls_test_transparent_key_agreement(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer,
|
||||
size_t key_buffer_size,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *peer_key,
|
||||
size_t peer_key_length,
|
||||
uint8_t *shared_secret,
|
||||
size_t shared_secret_size,
|
||||
size_t *shared_secret_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_key_agreement(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer,
|
||||
size_t key_buffer_size,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *peer_key,
|
||||
size_t peer_key_length,
|
||||
uint8_t *shared_secret,
|
||||
size_t shared_secret_size,
|
||||
size_t *shared_secret_length);
|
||||
|
||||
#endif /*PSA_CRYPTO_DRIVER_TEST */
|
||||
#endif /* PSA_CRYPTO_TEST_DRIVERS_KEY_AGREEMENT_H */
|
||||
133
vendor/mbedtls/framework/tests/include/test/drivers/key_management.h
vendored
Normal file
133
vendor/mbedtls/framework/tests/include/test/drivers/key_management.h
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Test driver for generating and verifying keys.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_TEST_DRIVERS_KEY_MANAGEMENT_H
|
||||
#define PSA_CRYPTO_TEST_DRIVERS_KEY_MANAGEMENT_H
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#include "test_driver_common.h"
|
||||
|
||||
#include <psa/crypto_driver_common.h>
|
||||
|
||||
#define PSA_CRYPTO_TEST_DRIVER_BUILTIN_AES_KEY_SLOT 0
|
||||
#define PSA_CRYPTO_TEST_DRIVER_BUILTIN_ECDSA_KEY_SLOT 1
|
||||
|
||||
typedef struct {
|
||||
/* If non-null, on success, copy this to the output. */
|
||||
void *forced_output;
|
||||
size_t forced_output_length;
|
||||
/* If not PSA_SUCCESS, return this error code instead of processing the
|
||||
* function call. */
|
||||
psa_status_t forced_status;
|
||||
/* Count the amount of times one of the key management driver functions
|
||||
* is called. */
|
||||
unsigned long hits;
|
||||
/* Subset of hits which only counts public key export operations */
|
||||
unsigned long hits_export_public_key;
|
||||
/* Subset of hits which only counts key generation operations */
|
||||
unsigned long hits_generate_key;
|
||||
/* Location of the last key management driver called to import a key. */
|
||||
psa_key_location_t location;
|
||||
} mbedtls_test_driver_key_management_hooks_t;
|
||||
|
||||
/* The location is initialized to the invalid value 0x800000. Invalid in the
|
||||
* sense that no PSA specification will assign a meaning to this location
|
||||
* (stated first in version 1.0.1 of the specification) and that it is not
|
||||
* used as a location of an opaque test drivers. */
|
||||
#define MBEDTLS_TEST_DRIVER_KEY_MANAGEMENT_INIT { NULL, 0, PSA_SUCCESS, 0, 0, 0, 0x800000 }
|
||||
static inline mbedtls_test_driver_key_management_hooks_t
|
||||
mbedtls_test_driver_key_management_hooks_init(void)
|
||||
{
|
||||
const mbedtls_test_driver_key_management_hooks_t
|
||||
v = MBEDTLS_TEST_DRIVER_KEY_MANAGEMENT_INIT;
|
||||
return v;
|
||||
}
|
||||
|
||||
/*
|
||||
* In order to convert the plain text keys to Opaque, the size of the key is
|
||||
* padded up by PSA_CRYPTO_TEST_DRIVER_OPAQUE_PAD_PREFIX_SIZE in addition to
|
||||
* xor mangling the key. The pad prefix needs to be accounted for while
|
||||
* sizing for the key.
|
||||
*/
|
||||
#define PSA_CRYPTO_TEST_DRIVER_OPAQUE_PAD_PREFIX 0xBEEFED00U
|
||||
#define PSA_CRYPTO_TEST_DRIVER_OPAQUE_PAD_PREFIX_SIZE sizeof( \
|
||||
PSA_CRYPTO_TEST_DRIVER_OPAQUE_PAD_PREFIX)
|
||||
|
||||
size_t mbedtls_test_opaque_size_function(
|
||||
const psa_key_type_t key_type,
|
||||
const size_t key_bits);
|
||||
|
||||
extern mbedtls_test_driver_key_management_hooks_t
|
||||
mbedtls_test_driver_key_management_hooks;
|
||||
|
||||
psa_status_t mbedtls_test_transparent_init(void);
|
||||
void mbedtls_test_transparent_free(void);
|
||||
psa_status_t mbedtls_test_opaque_init(void);
|
||||
void mbedtls_test_opaque_free(void);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_unwrap_key(
|
||||
const uint8_t *wrapped_key, size_t wrapped_key_length, uint8_t *key_buffer,
|
||||
size_t key_buffer_size, size_t *key_buffer_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_generate_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
uint8_t *key, size_t key_size, size_t *key_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_generate_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
uint8_t *key, size_t key_size, size_t *key_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_export_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
uint8_t *data, size_t data_size, size_t *data_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_export_public_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
uint8_t *data, size_t data_size, size_t *data_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_export_public_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
uint8_t *data, size_t data_size, size_t *data_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_import_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *data,
|
||||
size_t data_length,
|
||||
uint8_t *key_buffer,
|
||||
size_t key_buffer_size,
|
||||
size_t *key_buffer_length,
|
||||
size_t *bits);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_import_key(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *data,
|
||||
size_t data_length,
|
||||
uint8_t *key_buffer,
|
||||
size_t key_buffer_size,
|
||||
size_t *key_buffer_length,
|
||||
size_t *bits);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_get_builtin_key(
|
||||
psa_drv_slot_number_t slot_number,
|
||||
psa_key_attributes_t *attributes,
|
||||
uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_copy_key(
|
||||
psa_key_attributes_t *attributes,
|
||||
const uint8_t *source_key,
|
||||
size_t source_key_length,
|
||||
uint8_t *target_key_buffer,
|
||||
size_t target_key_buffer_size,
|
||||
size_t *target_key_buffer_length);
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
#endif /* PSA_CRYPTO_TEST_DRIVERS_KEY_MANAGEMENT_H */
|
||||
127
vendor/mbedtls/framework/tests/include/test/drivers/mac.h
vendored
Normal file
127
vendor/mbedtls/framework/tests/include/test/drivers/mac.h
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Test driver for MAC driver entry points.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_TEST_DRIVERS_MAC_H
|
||||
#define PSA_CRYPTO_TEST_DRIVERS_MAC_H
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#include "test_driver_common.h"
|
||||
|
||||
#include <psa/crypto_driver_common.h>
|
||||
|
||||
typedef struct {
|
||||
/* If not PSA_SUCCESS, return this error code instead of processing the
|
||||
* function call. */
|
||||
psa_status_t forced_status;
|
||||
/* Count the amount of times MAC driver functions are called. */
|
||||
unsigned long hits;
|
||||
/* Status returned by the last MAC driver function call. */
|
||||
psa_status_t driver_status;
|
||||
} mbedtls_test_driver_mac_hooks_t;
|
||||
|
||||
#define MBEDTLS_TEST_DRIVER_MAC_INIT { 0, 0, 0 }
|
||||
static inline mbedtls_test_driver_mac_hooks_t
|
||||
mbedtls_test_driver_mac_hooks_init(void)
|
||||
{
|
||||
const mbedtls_test_driver_mac_hooks_t v = MBEDTLS_TEST_DRIVER_MAC_INIT;
|
||||
return v;
|
||||
}
|
||||
|
||||
extern mbedtls_test_driver_mac_hooks_t mbedtls_test_driver_mac_hooks;
|
||||
|
||||
psa_status_t mbedtls_test_transparent_mac_compute(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer,
|
||||
size_t key_buffer_size,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *input,
|
||||
size_t input_length,
|
||||
uint8_t *mac,
|
||||
size_t mac_size,
|
||||
size_t *mac_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_mac_sign_setup(
|
||||
mbedtls_transparent_test_driver_mac_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer,
|
||||
size_t key_buffer_size,
|
||||
psa_algorithm_t alg);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_mac_verify_setup(
|
||||
mbedtls_transparent_test_driver_mac_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer,
|
||||
size_t key_buffer_size,
|
||||
psa_algorithm_t alg);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_mac_update(
|
||||
mbedtls_transparent_test_driver_mac_operation_t *operation,
|
||||
const uint8_t *input,
|
||||
size_t input_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_mac_sign_finish(
|
||||
mbedtls_transparent_test_driver_mac_operation_t *operation,
|
||||
uint8_t *mac,
|
||||
size_t mac_size,
|
||||
size_t *mac_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_mac_verify_finish(
|
||||
mbedtls_transparent_test_driver_mac_operation_t *operation,
|
||||
const uint8_t *mac,
|
||||
size_t mac_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_mac_abort(
|
||||
mbedtls_transparent_test_driver_mac_operation_t *operation);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_mac_compute(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer,
|
||||
size_t key_buffer_size,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *input,
|
||||
size_t input_length,
|
||||
uint8_t *mac,
|
||||
size_t mac_size,
|
||||
size_t *mac_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_mac_sign_setup(
|
||||
mbedtls_opaque_test_driver_mac_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer,
|
||||
size_t key_buffer_size,
|
||||
psa_algorithm_t alg);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_mac_verify_setup(
|
||||
mbedtls_opaque_test_driver_mac_operation_t *operation,
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key_buffer,
|
||||
size_t key_buffer_size,
|
||||
psa_algorithm_t alg);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_mac_update(
|
||||
mbedtls_opaque_test_driver_mac_operation_t *operation,
|
||||
const uint8_t *input,
|
||||
size_t input_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_mac_sign_finish(
|
||||
mbedtls_opaque_test_driver_mac_operation_t *operation,
|
||||
uint8_t *mac,
|
||||
size_t mac_size,
|
||||
size_t *mac_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_mac_verify_finish(
|
||||
mbedtls_opaque_test_driver_mac_operation_t *operation,
|
||||
const uint8_t *mac,
|
||||
size_t mac_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_mac_abort(
|
||||
mbedtls_opaque_test_driver_mac_operation_t *operation);
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
#endif /* PSA_CRYPTO_TEST_DRIVERS_MAC_H */
|
||||
77
vendor/mbedtls/framework/tests/include/test/drivers/pake.h
vendored
Normal file
77
vendor/mbedtls/framework/tests/include/test/drivers/pake.h
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Test driver for PAKE driver entry points.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_TEST_DRIVERS_PAKE_H
|
||||
#define PSA_CRYPTO_TEST_DRIVERS_PAKE_H
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#include "test_driver_common.h"
|
||||
|
||||
#include <psa/crypto_driver_common.h>
|
||||
|
||||
typedef struct {
|
||||
/* If not PSA_SUCCESS, return this error code instead of processing the
|
||||
* function call. */
|
||||
psa_status_t forced_status;
|
||||
/* PAKE driver setup is executed on the first call to
|
||||
pake_output/pake_input (added to distinguish forced statuses). */
|
||||
psa_status_t forced_setup_status;
|
||||
/* Count the amount of times PAKE driver functions are called. */
|
||||
struct {
|
||||
unsigned long total;
|
||||
unsigned long setup;
|
||||
unsigned long input;
|
||||
unsigned long output;
|
||||
unsigned long implicit_key;
|
||||
unsigned long abort;
|
||||
} hits;
|
||||
/* Status returned by the last PAKE driver function call. */
|
||||
psa_status_t driver_status;
|
||||
/* Output returned by pake_output */
|
||||
void *forced_output;
|
||||
size_t forced_output_length;
|
||||
} mbedtls_test_driver_pake_hooks_t;
|
||||
|
||||
#define MBEDTLS_TEST_DRIVER_PAKE_INIT { PSA_SUCCESS, PSA_SUCCESS, { 0, 0, 0, 0, 0, 0 }, PSA_SUCCESS, \
|
||||
NULL, 0 }
|
||||
static inline mbedtls_test_driver_pake_hooks_t
|
||||
mbedtls_test_driver_pake_hooks_init(void)
|
||||
{
|
||||
const mbedtls_test_driver_pake_hooks_t v = MBEDTLS_TEST_DRIVER_PAKE_INIT;
|
||||
return v;
|
||||
}
|
||||
|
||||
extern mbedtls_test_driver_pake_hooks_t mbedtls_test_driver_pake_hooks;
|
||||
|
||||
psa_status_t mbedtls_test_transparent_pake_setup(
|
||||
mbedtls_transparent_test_driver_pake_operation_t *operation,
|
||||
const psa_crypto_driver_pake_inputs_t *inputs);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_pake_output(
|
||||
mbedtls_transparent_test_driver_pake_operation_t *operation,
|
||||
psa_crypto_driver_pake_step_t step,
|
||||
uint8_t *output,
|
||||
size_t output_size,
|
||||
size_t *output_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_pake_input(
|
||||
mbedtls_transparent_test_driver_pake_operation_t *operation,
|
||||
psa_crypto_driver_pake_step_t step,
|
||||
const uint8_t *input,
|
||||
size_t input_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_pake_get_implicit_key(
|
||||
mbedtls_transparent_test_driver_pake_operation_t *operation,
|
||||
uint8_t *output, size_t output_size, size_t *output_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_pake_abort(
|
||||
mbedtls_transparent_test_driver_pake_operation_t *operation);
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
#endif /* PSA_CRYPTO_TEST_DRIVERS_PAKE_H */
|
||||
114
vendor/mbedtls/framework/tests/include/test/drivers/signature.h
vendored
Normal file
114
vendor/mbedtls/framework/tests/include/test/drivers/signature.h
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Test driver for signature functions.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_TEST_DRIVERS_SIGNATURE_H
|
||||
#define PSA_CRYPTO_TEST_DRIVERS_SIGNATURE_H
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#include "test_driver_common.h"
|
||||
|
||||
#include <psa/crypto_driver_common.h>
|
||||
|
||||
typedef struct {
|
||||
/* If non-null, on success, copy this to the output. */
|
||||
void *forced_output;
|
||||
size_t forced_output_length;
|
||||
/* If not PSA_SUCCESS, return this error code instead of processing the
|
||||
* function call. */
|
||||
psa_status_t forced_status;
|
||||
/* Count the amount of times one of the signature driver functions is called. */
|
||||
unsigned long hits;
|
||||
} mbedtls_test_driver_signature_hooks_t;
|
||||
|
||||
#define MBEDTLS_TEST_DRIVER_SIGNATURE_INIT { NULL, 0, PSA_SUCCESS, 0 }
|
||||
static inline mbedtls_test_driver_signature_hooks_t
|
||||
mbedtls_test_driver_signature_hooks_init(void)
|
||||
{
|
||||
const mbedtls_test_driver_signature_hooks_t
|
||||
v = MBEDTLS_TEST_DRIVER_SIGNATURE_INIT;
|
||||
return v;
|
||||
}
|
||||
|
||||
extern mbedtls_test_driver_signature_hooks_t
|
||||
mbedtls_test_driver_signature_sign_hooks;
|
||||
extern mbedtls_test_driver_signature_hooks_t
|
||||
mbedtls_test_driver_signature_verify_hooks;
|
||||
|
||||
psa_status_t mbedtls_test_transparent_signature_sign_message(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key,
|
||||
size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *input,
|
||||
size_t input_length,
|
||||
uint8_t *signature,
|
||||
size_t signature_size,
|
||||
size_t *signature_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_signature_sign_message(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key,
|
||||
size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *input,
|
||||
size_t input_length,
|
||||
uint8_t *signature,
|
||||
size_t signature_size,
|
||||
size_t *signature_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_signature_verify_message(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key,
|
||||
size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *input,
|
||||
size_t input_length,
|
||||
const uint8_t *signature,
|
||||
size_t signature_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_signature_verify_message(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key,
|
||||
size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *input,
|
||||
size_t input_length,
|
||||
const uint8_t *signature,
|
||||
size_t signature_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_signature_sign_hash(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *hash, size_t hash_length,
|
||||
uint8_t *signature, size_t signature_size, size_t *signature_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_signature_sign_hash(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *hash, size_t hash_length,
|
||||
uint8_t *signature, size_t signature_size, size_t *signature_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_signature_verify_hash(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *hash, size_t hash_length,
|
||||
const uint8_t *signature, size_t signature_length);
|
||||
|
||||
psa_status_t mbedtls_test_opaque_signature_verify_hash(
|
||||
const psa_key_attributes_t *attributes,
|
||||
const uint8_t *key, size_t key_length,
|
||||
psa_algorithm_t alg,
|
||||
const uint8_t *hash, size_t hash_length,
|
||||
const uint8_t *signature, size_t signature_length);
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
#endif /* PSA_CRYPTO_TEST_DRIVERS_SIGNATURE_H */
|
||||
33
vendor/mbedtls/framework/tests/include/test/drivers/test_driver.h
vendored
Normal file
33
vendor/mbedtls/framework/tests/include/test/drivers/test_driver.h
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Umbrella include for all of the test driver functionality
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_TEST_DRIVER_H
|
||||
#define PSA_CRYPTO_TEST_DRIVER_H
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#ifndef PSA_CRYPTO_DRIVER_PRESENT
|
||||
#define PSA_CRYPTO_DRIVER_PRESENT
|
||||
#endif
|
||||
#ifndef PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
|
||||
#define PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT
|
||||
#endif
|
||||
|
||||
#define PSA_CRYPTO_TEST_DRIVER_LOCATION 0x7fffff
|
||||
|
||||
#include "test/drivers/aead.h"
|
||||
#include "test/drivers/cipher.h"
|
||||
#include "test/drivers/hash.h"
|
||||
#include "test/drivers/mac.h"
|
||||
#include "test/drivers/key_management.h"
|
||||
#include "test/drivers/signature.h"
|
||||
#include "test/drivers/asymmetric_encryption.h"
|
||||
#include "test/drivers/key_agreement.h"
|
||||
#include "test/drivers/pake.h"
|
||||
#include "test/drivers/xof.h"
|
||||
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
#endif /* PSA_CRYPTO_TEST_DRIVER_H */
|
||||
90
vendor/mbedtls/framework/tests/include/test/drivers/test_driver_common.h
vendored
Normal file
90
vendor/mbedtls/framework/tests/include/test/drivers/test_driver_common.h
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
/* Common definitions used by test drivers. */
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_TEST_DRIVERS_TEST_DRIVER_COMMON_H
|
||||
#define PSA_CRYPTO_TEST_DRIVERS_TEST_DRIVER_COMMON_H
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
/* Use the same formatting for error code definitions as the standard
|
||||
* error values, which must have a specific sequence of tokens for
|
||||
* interoperability between implementations of different parts of PSA.
|
||||
* This means no space between the cast and the - operator.
|
||||
* This contradicts our code style, so we temporarily disable style checking.
|
||||
*
|
||||
* *INDENT-OFF*
|
||||
*/
|
||||
|
||||
/** Error code that test drivers return when they detect that an input
|
||||
* parameter was not initialized properly. This normally indicates a
|
||||
* bug in the core.
|
||||
*/
|
||||
#define PSA_ERROR_TEST_DETECTED_BAD_INITIALIZATION ((psa_status_t)-0x0201)
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/*
|
||||
* In the libtestdriver1 library used in Mbed TLS 3.6 and 4.0 for driver
|
||||
* dispatch testing, the PSA core code is cloned and all identifiers starting
|
||||
* with MBEDTLS_, PSA_, mbedtls_, or psa_ are prefixed with `libtestdriver1_`.
|
||||
* As a result, libtestdriver1 drivers use, for example,
|
||||
* `libtestdriver1_psa_key_attributes_t` instead of `psa_key_attributes_t`.
|
||||
*
|
||||
* With the generated test drivers introduced in TF-PSA-Crypto between 1.0
|
||||
* and 1.1, only the modules under `drivers/builtin` are cloned, not the PSA
|
||||
* core. The generated test drivers therefore do not use prefixed PSA core
|
||||
* identifiers. For example, they use the `psa_key_attributes_t` type, just
|
||||
* like the built-in drivers.
|
||||
*
|
||||
* To make driver dispatch work in both cases, we define certain
|
||||
* `libtestdriver1_xyz` identifiers as aliases of the corresponding `xyz`
|
||||
* identifiers in the latter case.
|
||||
*/
|
||||
#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
|
||||
typedef psa_key_attributes_t libtestdriver1_psa_key_attributes_t;
|
||||
typedef psa_crypto_driver_pake_inputs_t libtestdriver1_psa_crypto_driver_pake_inputs_t;
|
||||
typedef psa_crypto_driver_pake_step_t libtestdriver1_psa_crypto_driver_pake_step_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The LIBTESTDRIVER1_PSA_DRIVER_INTERNAL_HEADER(basename) macro expands to
|
||||
* the path of the internal header `basename` of a libtestdriver1 test driver.
|
||||
*
|
||||
* The internal headers the macro is dedicated to are the `psa_crypto_xyz.h`
|
||||
* headers located in `library` in 3.6, in `tf-psa-crypto/drivers/builtin/src`
|
||||
* in 4.x and in`drivers/builtin/src` in TF-PSA-Crypto.
|
||||
*
|
||||
* - In Mbed TLS 3.6 and 4.x, when the libtestdriver1 library is built, its code
|
||||
* is located in the `libtestdriver1` directory at the root of the project.
|
||||
* The header path is relative to the repository root and therefore of the
|
||||
* form:
|
||||
* - Mbed TLS 3.6: `libtestdriver1/library/xyz`
|
||||
* - Mbed TLS 4.x: `libtestdriver1/tf-psa-crypto/drivers/builtin/src/xyz`
|
||||
*
|
||||
* - In TF-PSA-Crypto, the libtestdriver1 library code is located in
|
||||
* `drivers/libtestdriver1`. The header path is relative to
|
||||
* `drivers/libtestdriver1/include` and has the form:
|
||||
* `../src/libtestdriver1-xyz`
|
||||
*
|
||||
* Uncrustify is not happy with the macros, temporarily disable it.
|
||||
*
|
||||
* *INDENT-OFF*
|
||||
*/
|
||||
#if defined(TF_PSA_CRYPTO_TEST_LIBTESTDRIVER1)
|
||||
#define LIBTESTDRIVER1_PSA_DRIVER_INTERNAL_HEADER(basename) \
|
||||
<../src/libtestdriver1-basename>
|
||||
#else
|
||||
#if MBEDTLS_VERSION_MAJOR < 4
|
||||
#define LIBTESTDRIVER1_PSA_DRIVER_INTERNAL_HEADER(basename) \
|
||||
<libtestdriver1/library/basename>
|
||||
#else
|
||||
#define LIBTESTDRIVER1_PSA_DRIVER_INTERNAL_HEADER(basename) \
|
||||
<libtestdriver1/tf-psa-crypto/drivers/builtin/src/basename>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#endif /* test_driver_common.h */
|
||||
63
vendor/mbedtls/framework/tests/include/test/drivers/xof.h
vendored
Normal file
63
vendor/mbedtls/framework/tests/include/test/drivers/xof.h
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Test driver for xof driver entry points.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_TEST_DRIVERS_XOF_H
|
||||
#define PSA_CRYPTO_TEST_DRIVERS_XOF_H
|
||||
|
||||
#include "mbedtls/build_info.h"
|
||||
|
||||
#if defined(PSA_CRYPTO_DRIVER_TEST)
|
||||
#include "test_driver_common.h"
|
||||
|
||||
#include <psa/crypto_driver_common.h>
|
||||
|
||||
/* The type mbedtls_transparent_test_driver_xof_operation_t is only
|
||||
* defined since XOF support was added in TF-PSA-Crypto 1.1.0. */
|
||||
#if defined(PSA_ALG_CATEGORY_XOF)
|
||||
|
||||
typedef struct {
|
||||
/* If not PSA_SUCCESS, return this error code instead of processing the
|
||||
* function call. */
|
||||
psa_status_t forced_status;
|
||||
/* Count the amount of times xof driver entry points are called. */
|
||||
unsigned long hits;
|
||||
/* Status returned by the last xof driver entry point call. */
|
||||
psa_status_t driver_status;
|
||||
} mbedtls_test_driver_xof_hooks_t;
|
||||
|
||||
#define MBEDTLS_TEST_DRIVER_XOF_INIT { 0, 0, 0 }
|
||||
static inline mbedtls_test_driver_xof_hooks_t
|
||||
mbedtls_test_driver_xof_hooks_init(void)
|
||||
{
|
||||
const mbedtls_test_driver_xof_hooks_t v = MBEDTLS_TEST_DRIVER_XOF_INIT;
|
||||
return v;
|
||||
}
|
||||
|
||||
extern mbedtls_test_driver_xof_hooks_t mbedtls_test_driver_xof_hooks;
|
||||
|
||||
psa_status_t mbedtls_test_transparent_xof_setup(
|
||||
mbedtls_transparent_test_driver_xof_operation_t *operation,
|
||||
psa_algorithm_t alg);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_xof_set_context(
|
||||
mbedtls_transparent_test_driver_xof_operation_t *operation,
|
||||
const uint8_t *context, size_t context_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_xof_update(
|
||||
mbedtls_transparent_test_driver_xof_operation_t *operation,
|
||||
const uint8_t *input, size_t input_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_xof_output(
|
||||
mbedtls_transparent_test_driver_xof_operation_t *operation,
|
||||
uint8_t *output, size_t output_length);
|
||||
|
||||
psa_status_t mbedtls_test_transparent_xof_abort(
|
||||
mbedtls_transparent_test_driver_xof_operation_t *operation);
|
||||
|
||||
#endif /* PSA_ALG_CATEGORY_XOF */
|
||||
#endif /* PSA_CRYPTO_DRIVER_TEST */
|
||||
#endif /* PSA_CRYPTO_TEST_DRIVERS_XOF_H */
|
||||
Reference in New Issue
Block a user