check_crypto_config.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /**
  2. * \file check_crypto_config.h
  3. *
  4. * \brief Consistency checks for PSA configuration options
  5. */
  6. /*
  7. * Copyright The Mbed TLS Contributors
  8. * SPDX-License-Identifier: Apache-2.0
  9. *
  10. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  11. * not use this file except in compliance with the License.
  12. * You may obtain a copy of the License at
  13. *
  14. * http://www.apache.org/licenses/LICENSE-2.0
  15. *
  16. * Unless required by applicable law or agreed to in writing, software
  17. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  18. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. * See the License for the specific language governing permissions and
  20. * limitations under the License.
  21. */
  22. /*
  23. * It is recommended to include this file from your crypto_config.h
  24. * in order to catch dependency issues early.
  25. */
  26. #ifndef MBEDTLS_CHECK_CRYPTO_CONFIG_H
  27. #define MBEDTLS_CHECK_CRYPTO_CONFIG_H
  28. #if defined(PSA_WANT_ALG_CCM) && \
  29. !( defined(PSA_WANT_KEY_TYPE_AES) || \
  30. defined(PSA_WANT_KEY_TYPE_CAMELLIA) )
  31. #error "PSA_WANT_ALG_CCM defined, but not all prerequisites"
  32. #endif
  33. #if defined(PSA_WANT_ALG_CMAC) && \
  34. !( defined(PSA_WANT_KEY_TYPE_AES) || \
  35. defined(PSA_WANT_KEY_TYPE_CAMELLIA) || \
  36. defined(PSA_WANT_KEY_TYPE_DES) )
  37. #error "PSA_WANT_ALG_CMAC defined, but not all prerequisites"
  38. #endif
  39. #if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) && \
  40. !( defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) || \
  41. defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) )
  42. #error "PSA_WANT_ALG_DETERMINISTIC_ECDSA defined, but not all prerequisites"
  43. #endif
  44. #if defined(PSA_WANT_ALG_ECDSA) && \
  45. !( defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) || \
  46. defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) )
  47. #error "PSA_WANT_ALG_ECDSA defined, but not all prerequisites"
  48. #endif
  49. #if defined(PSA_WANT_ALG_GCM) && \
  50. !( defined(PSA_WANT_KEY_TYPE_AES) || \
  51. defined(PSA_WANT_KEY_TYPE_CAMELLIA) )
  52. #error "PSA_WANT_ALG_GCM defined, but not all prerequisites"
  53. #endif
  54. #if defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT) && \
  55. !( defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \
  56. defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) )
  57. #error "PSA_WANT_ALG_RSA_PKCS1V15_CRYPT defined, but not all prerequisites"
  58. #endif
  59. #if defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) && \
  60. !( defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \
  61. defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) )
  62. #error "PSA_WANT_ALG_RSA_PKCS1V15_SIGN defined, but not all prerequisites"
  63. #endif
  64. #if defined(PSA_WANT_ALG_RSA_OAEP) && \
  65. !( defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \
  66. defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) )
  67. #error "PSA_WANT_ALG_RSA_OAEP defined, but not all prerequisites"
  68. #endif
  69. #if defined(PSA_WANT_ALG_RSA_PSS) && \
  70. !( defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \
  71. defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) )
  72. #error "PSA_WANT_ALG_RSA_PSS defined, but not all prerequisites"
  73. #endif
  74. #if defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) && \
  75. !defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
  76. #error "PSA_WANT_KEY_TYPE_ECC_KEY_PAIR defined, but not all prerequisites"
  77. #endif
  78. #endif /* MBEDTLS_CHECK_CRYPTO_CONFIG_H */