[修改] 增加freeRTOS
1. 版本FreeRTOSv202212.01,命名为kernel;
This commit is contained in:
133
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/aead.h
vendored
Normal file
133
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/aead.h
vendored
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Test driver for AEAD driver entry points.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* 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 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 <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 */
|
||||
79
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/asymmetric_encryption.h
vendored
Normal file
79
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/asymmetric_encryption.h
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Test driver for asymmetric encryption.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* 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 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 <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
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/cipher.h
vendored
Normal file
142
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/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
|
||||
*
|
||||
* 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 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 <psa/crypto_driver_common.h>
|
||||
#include <psa/crypto.h>
|
||||
|
||||
#include "mbedtls/cipher.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 cipher driver functions is called. */
|
||||
unsigned long hits;
|
||||
} mbedtls_test_driver_cipher_hooks_t;
|
||||
|
||||
#define MBEDTLS_TEST_DRIVER_CIPHER_INIT { NULL, 0, PSA_SUCCESS, 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 */
|
||||
57
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/config_test_driver.h
vendored
Normal file
57
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/config_test_driver.h
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Mbed TLS configuration for PSA test driver libraries. It includes:
|
||||
* . the minimum set of modules needed by the PSA core.
|
||||
* . the Mbed TLS configuration options that may need to be additionally
|
||||
* enabled for the purpose of a specific test.
|
||||
* . the PSA configuration file for the Mbed TLS library and its test drivers.
|
||||
*/
|
||||
/*
|
||||
* Copyright The Mbed TLS Contributors
|
||||
* 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 MBEDTLS_CONFIG_H
|
||||
#define MBEDTLS_CONFIG_H
|
||||
|
||||
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
#endif
|
||||
|
||||
#define MBEDTLS_PSA_CRYPTO_C
|
||||
#define MBEDTLS_PSA_CRYPTO_CONFIG
|
||||
|
||||
/* PSA core mandatory configuration options */
|
||||
#define MBEDTLS_CIPHER_C
|
||||
#define MBEDTLS_AES_C
|
||||
#define MBEDTLS_SHA224_C
|
||||
#define MBEDTLS_SHA256_C
|
||||
#define MBEDTLS_PSA_BUILTIN_ALG_SHA_256 1
|
||||
#define MBEDTLS_CTR_DRBG_C
|
||||
#define MBEDTLS_ENTROPY_C
|
||||
|
||||
/*
|
||||
* Configuration options that may need to be additionally enabled for the
|
||||
* purpose of a specific set of tests.
|
||||
*/
|
||||
//#define MBEDTLS_SHA1_C
|
||||
//#define MBEDTLS_SHA384_C
|
||||
//#define MBEDTLS_SHA512_C
|
||||
//#define MBEDTLS_PEM_PARSE_C
|
||||
//#define MBEDTLS_BASE64_C
|
||||
|
||||
#include "mbedtls/config_psa.h"
|
||||
#include "mbedtls/check_config.h"
|
||||
|
||||
#endif /* MBEDTLS_CONFIG_H */
|
||||
@ -0,0 +1,224 @@
|
||||
/**
|
||||
* This file is intended to be used to build PSA test driver libraries. It is
|
||||
* intended to be appended by the test build system to the crypto_config.h file
|
||||
* of the Mbed TLS library the test library will be linked to. It mirrors the
|
||||
* PSA_ACCEL_* macros defining the cryptographic operations the test library
|
||||
* supports.
|
||||
*/
|
||||
|
||||
#if defined(PSA_WANT_ALG_CBC_NO_PADDING)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CBC_NO_PADDING 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_CBC_PKCS7)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CBC_PKCS7 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_CFB)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_CFB)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_CFB
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CFB 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_CTR)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_CTR)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_CTR
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CTR 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_DETERMINISTIC_ECDSA 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_ECDSA)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_ECDSA
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_ECDSA 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_MD5)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_MD5)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_MD5
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_MD5 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_OFB)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_OFB)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_OFB
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_OFB 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_RIPEMD160)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_RIPEMD160)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_RIPEMD160
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RIPEMD160 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_SIGN 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_RSA_PSS)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_RSA_PSS)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_RSA_PSS
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RSA_PSS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_1)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_1)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA_1
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_1 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_224)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_224)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA_224
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_224 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_256)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_256)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA_256
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_256 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_384)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_384)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA_384
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_384 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_SHA_512)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_SHA_512)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_SHA_512
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_SHA_512 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_ALG_XTS)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_XTS)
|
||||
#undef MBEDTLS_PSA_ACCEL_ALG_XTS
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_XTS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_AES)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_AES)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_AES
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_AES 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ARIA)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ARIA 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_CAMELLIA)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_CAMELLIA 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_KEY_PAIR 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR)
|
||||
#if defined(MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR)
|
||||
#undef MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR
|
||||
#else
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_KEY_PAIR 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CBC_MAC 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CCM 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CHACHA20_POLY1305 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_CMAC 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_ECB_NO_PADDING 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_ECDH 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_GCM 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_HKDF 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_HKDF_EXTRACT 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_HKDF_EXPAND 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_HMAC 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RSA_OAEP 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_RSA_PKCS1V15_CRYPT 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_STREAM_CIPHER 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_TLS12_PRF 1
|
||||
#define MBEDTLS_PSA_ACCEL_ALG_TLS12_PSK_TO_MS 1
|
||||
|
||||
#if defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_256 1
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_384 1
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_BRAINPOOL_P_R1_512 1
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_255 1
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_MONTGOMERY_448 1
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_K1_192 1
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_K1_224 1
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_K1_256 1
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_192 1
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_224 1
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_256 1
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_384 1
|
||||
#define MBEDTLS_PSA_ACCEL_ECC_SECP_R1_521 1
|
||||
#endif
|
||||
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_DERIVE 1
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_HMAC 1
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_CHACHA20 1
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_DES 1
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_ECC_PUBLIC_KEY 1
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_RAW_DATA 1
|
||||
#define MBEDTLS_PSA_ACCEL_KEY_TYPE_RSA_PUBLIC_KEY 1
|
||||
76
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/hash.h
vendored
Normal file
76
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/hash.h
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Test driver for hash driver entry points.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* 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 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 <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 */
|
||||
135
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/key_management.h
vendored
Normal file
135
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/key_management.h
vendored
Normal file
@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Test driver for generating and verifying keys.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* 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 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 <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;
|
||||
/* 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, 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_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 */
|
||||
137
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/mac.h
vendored
Normal file
137
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/mac.h
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
* Test driver for MAC driver entry points.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* 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 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 <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 */
|
||||
124
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/signature.h
vendored
Normal file
124
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/signature.h
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Test driver for signature functions.
|
||||
*/
|
||||
/* Copyright The Mbed TLS Contributors
|
||||
* 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 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 <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
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/tests/include/test/drivers/test_driver.h
vendored
Normal file
33
kernel/FreeRTOS-Plus/ThirdParty/mbedtls/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
|
||||
*
|
||||
* 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 PSA_CRYPTO_TEST_DRIVER_H
|
||||
#define PSA_CRYPTO_TEST_DRIVER_H
|
||||
|
||||
#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"
|
||||
|
||||
#endif /* PSA_CRYPTO_TEST_DRIVER_H */
|
||||
Reference in New Issue
Block a user