-
Notifications
You must be signed in to change notification settings - Fork 96
Rename psa_asymmetric_{sign_verify} to psa_{sign,verify}_hash #325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gilles-peskine-arm
merged 11 commits into
ARMmbed:development
from
gilles-peskine-arm:psa-sign_hash
Dec 6, 2019
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7a894f2
Move backward compatibility aliases to their own header
gilles-peskine-arm 7b0ab6d
Simplify support for deprecated constants of various types
gilles-peskine-arm 89d8c5c
Rename some signature-related identifiers
gilles-peskine-arm 4151094
Add backward compatibility aliases for signature-related identifiers
gilles-peskine-arm 1a96049
Make the key_policy test function more flexible
gilles-peskine-arm 841b14b
Add tests of deprecated PSA macros
gilles-peskine-arm 0627f98
Add tests of deprecated PSA functions
gilles-peskine-arm 06c2889
Add test function for effective key attributes
gilles-peskine-arm 895242b
Add negative test cases for deprecated aliases
gilles-peskine-arm 2ff02c3
Document MBEDTLS_TEST_DEPRECATED
gilles-peskine-arm 0168f2f
Better documentation in crypto_compat.h
gilles-peskine-arm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/** | ||
* \file psa/crypto_compat.h | ||
* | ||
* \brief PSA cryptography module: Backward compatibility aliases | ||
* | ||
* This header declares alternative names for macro and functions. | ||
* New application code should not use these names. | ||
* These names may be removed in a future version of Mbed Crypto. | ||
* | ||
* \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 | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#if !defined(MBEDTLS_DEPRECATED_REMOVED) | ||
|
||
/* | ||
* Mechanism for declaring deprecated values | ||
*/ | ||
#if defined(MBEDTLS_DEPRECATED_WARNING) && !defined(MBEDTLS_PSA_DEPRECATED) | ||
#define MBEDTLS_PSA_DEPRECATED __attribute__((deprecated)) | ||
#else | ||
#define MBEDTLS_PSA_DEPRECATED | ||
#endif | ||
|
||
typedef MBEDTLS_PSA_DEPRECATED size_t mbedtls_deprecated_size_t; | ||
typedef MBEDTLS_PSA_DEPRECATED psa_status_t mbedtls_deprecated_psa_status_t; | ||
typedef MBEDTLS_PSA_DEPRECATED psa_key_usage_t mbedtls_deprecated_psa_key_usage_t; | ||
|
||
#define MBEDTLS_DEPRECATED_CONSTANT( type, value ) \ | ||
( (mbedtls_deprecated_##type) ( value ) ) | ||
|
||
/* | ||
* Deprecated PSA Crypto error code definitions (PSA Crypto API <= 1.0 beta2) | ||
*/ | ||
#define PSA_ERROR_UNKNOWN_ERROR \ | ||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_GENERIC_ERROR ) | ||
#define PSA_ERROR_OCCUPIED_SLOT \ | ||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_ALREADY_EXISTS ) | ||
#define PSA_ERROR_EMPTY_SLOT \ | ||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_DOES_NOT_EXIST ) | ||
#define PSA_ERROR_INSUFFICIENT_CAPACITY \ | ||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_INSUFFICIENT_DATA ) | ||
#define PSA_ERROR_TAMPERING_DETECTED \ | ||
MBEDTLS_DEPRECATED_CONSTANT( psa_status_t, PSA_ERROR_CORRUPTION_DETECTED ) | ||
|
||
/* | ||
* Deprecated PSA Crypto numerical encodings (PSA Crypto API <= 1.0 beta3) | ||
*/ | ||
#define PSA_KEY_USAGE_SIGN \ | ||
MBEDTLS_DEPRECATED_CONSTANT( psa_key_usage_t, PSA_KEY_USAGE_SIGN_HASH ) | ||
#define PSA_KEY_USAGE_VERIFY \ | ||
MBEDTLS_DEPRECATED_CONSTANT( psa_key_usage_t, PSA_KEY_USAGE_VERIFY_HASH ) | ||
|
||
/* | ||
* Deprecated PSA Crypto size calculation macros (PSA Crypto API <= 1.0 beta3) | ||
*/ | ||
#define PSA_ASYMMETRIC_SIGNATURE_MAX_SIZE \ | ||
MBEDTLS_DEPRECATED_CONSTANT( size_t, PSA_SIGNATURE_MAX_SIZE ) | ||
#define PSA_ASYMMETRIC_SIGN_OUTPUT_SIZE( key_type, key_bits, alg ) \ | ||
MBEDTLS_DEPRECATED_CONSTANT( size_t, PSA_SIGN_OUTPUT_SIZE( key_type, key_bits, alg ) ) | ||
|
||
/* | ||
* Deprecated PSA Crypto function names (PSA Crypto API <= 1.0 beta3) | ||
*/ | ||
/* Make these macros and not wrappers so that there is no cost to | ||
* applications that don't use the deprecated names. | ||
* | ||
* Put backslash-newline after "#define" to bypass check-names.sh which | ||
* would otherwise complain about lowercase macro names. | ||
*/ | ||
#define \ | ||
psa_asymmetric_sign( key, alg, hash, hash_length, signature, signature_size, signature_length ) \ | ||
( (mbedtls_deprecated_psa_status_t) psa_sign_hash( key, alg, hash, hash_length, signature, signature_size, signature_length ) ) | ||
#define \ | ||
psa_asymmetric_verify( key, alg, hash, hash_length, signature, signature_length ) \ | ||
( (mbedtls_deprecated_psa_status_t) psa_verify_hash( key, alg, hash, hash_length, signature, signature_length ) ) | ||
|
||
#endif /* MBEDTLS_DEPRECATED_REMOVED */ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* PSA_CRYPTO_COMPAT_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a sentence about this file also having deprecation information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean? Something like “This header declares alternative names for macros and functions that may be removed in a future version of Mbed Crypto”?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just
Backward compatibility aliases and deprecated entities