Move backward compatibility aliases to their own header
Move backward compatibility aliases to a separate header. Reserve crypto_extra.h for implementation-specific extensions that we intend to keep supporting. This is better documentation for users. New users should simply ignore backward compatibility aliases, and old users can look at crypto_compat.h to see what is deprecated without bothering about new features appearing in crypto_extra.h. This facilitates maintenance because scripts such as generate_psa_constants that want to ignore backward compability aliases can simply exclude crypto_compat.h from their parsing.
This commit is contained in:
parent
4eca19bbd6
commit
7a894f2142
57
include/psa/crypto_compat.h
Normal file
57
include/psa/crypto_compat.h
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* \file psa/crypto_compat.h
|
||||
*
|
||||
* \brief PSA cryptography module: Backward compatibility aliases
|
||||
*
|
||||
* \note This file may not be included directly. Applications must
|
||||
* include psa/crypto.h.
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2019, ARM Limited, All Rights Reserved
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This file is part of mbed TLS (https://tls.mbed.org)
|
||||
*/
|
||||
|
||||
#ifndef PSA_CRYPTO_COMPAT_H
|
||||
#define PSA_CRYPTO_COMPAT_H
|
||||
|
||||
#include "mbedtls/platform_util.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Deprecated PSA Crypto error code definitions
|
||||
*/
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#define PSA_ERROR_UNKNOWN_ERROR \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_GENERIC_ERROR )
|
||||
#define PSA_ERROR_OCCUPIED_SLOT \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_ALREADY_EXISTS )
|
||||
#define PSA_ERROR_EMPTY_SLOT \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_DOES_NOT_EXIST )
|
||||
#define PSA_ERROR_INSUFFICIENT_CAPACITY \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_INSUFFICIENT_DATA )
|
||||
#define PSA_ERROR_TAMPERING_DETECTED \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_CORRUPTION_DETECTED )
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PSA_CRYPTO_COMPAT_H */
|
@ -32,6 +32,8 @@
|
||||
|
||||
#include "mbedtls/platform_util.h"
|
||||
|
||||
#include "crypto_compat.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -39,21 +41,6 @@ extern "C" {
|
||||
/* UID for secure storage seed */
|
||||
#define PSA_CRYPTO_ITS_RANDOM_SEED_UID 0xFFFFFF52
|
||||
|
||||
/*
|
||||
* Deprecated PSA Crypto error code definitions
|
||||
*/
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#define PSA_ERROR_UNKNOWN_ERROR \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_GENERIC_ERROR )
|
||||
#define PSA_ERROR_OCCUPIED_SLOT \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_ALREADY_EXISTS )
|
||||
#define PSA_ERROR_EMPTY_SLOT \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_DOES_NOT_EXIST )
|
||||
#define PSA_ERROR_INSUFFICIENT_CAPACITY \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_INSUFFICIENT_DATA )
|
||||
#define PSA_ERROR_TAMPERING_DETECTED \
|
||||
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT( PSA_ERROR_CORRUPTION_DETECTED )
|
||||
#endif
|
||||
|
||||
/** \addtogroup attributes
|
||||
* @{
|
||||
|
@ -206,12 +206,6 @@ class Inputs:
|
||||
# Auxiliary macro whose name doesn't fit the usual patterns for
|
||||
# auxiliary macros.
|
||||
'PSA_ALG_AEAD_WITH_DEFAULT_TAG_LENGTH_CASE',
|
||||
# Deprecated aliases.
|
||||
'PSA_ERROR_UNKNOWN_ERROR',
|
||||
'PSA_ERROR_OCCUPIED_SLOT',
|
||||
'PSA_ERROR_EMPTY_SLOT',
|
||||
'PSA_ERROR_INSUFFICIENT_CAPACITY',
|
||||
'PSA_ERROR_TAMPERING_DETECTED',
|
||||
])
|
||||
def parse_header_line(self, line):
|
||||
"""Parse a C header line, looking for "#define PSA_xxx"."""
|
||||
|
@ -212,6 +212,7 @@
|
||||
<ClInclude Include="..\..\include\mbedtls\xtea.h" />
|
||||
<ClInclude Include="..\..\include\psa\crypto.h" />
|
||||
<ClInclude Include="..\..\include\psa\crypto_accel_driver.h" />
|
||||
<ClInclude Include="..\..\include\psa\crypto_compat.h" />
|
||||
<ClInclude Include="..\..\include\psa\crypto_driver_common.h" />
|
||||
<ClInclude Include="..\..\include\psa\crypto_entropy_driver.h" />
|
||||
<ClInclude Include="..\..\include\psa\crypto_extra.h" />
|
||||
|
Loading…
Reference in New Issue
Block a user