crypto_driver_common.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * \file psa/crypto_driver_common.h
  3. * \brief Definitions for all PSA crypto drivers
  4. *
  5. * This file contains common definitions shared by all PSA crypto drivers.
  6. * Do not include it directly: instead, include the header file(s) for
  7. * the type(s) of driver that you are implementing. For example, if
  8. * you are writing a dynamically registered driver for a secure element,
  9. * include `psa/crypto_se_driver.h`.
  10. *
  11. * This file is part of the PSA Crypto Driver Model, containing functions for
  12. * driver developers to implement to enable hardware to be called in a
  13. * standardized way by a PSA Cryptographic API implementation. The functions
  14. * comprising the driver model, which driver authors implement, are not
  15. * intended to be called by application developers.
  16. */
  17. /*
  18. * Copyright The Mbed TLS Contributors
  19. * SPDX-License-Identifier: Apache-2.0
  20. *
  21. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  22. * not use this file except in compliance with the License.
  23. * You may obtain a copy of the License at
  24. *
  25. * http://www.apache.org/licenses/LICENSE-2.0
  26. *
  27. * Unless required by applicable law or agreed to in writing, software
  28. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  29. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  30. * See the License for the specific language governing permissions and
  31. * limitations under the License.
  32. */
  33. #ifndef PSA_CRYPTO_DRIVER_COMMON_H
  34. #define PSA_CRYPTO_DRIVER_COMMON_H
  35. #include <stddef.h>
  36. #include <stdint.h>
  37. /* Include type definitions (psa_status_t, psa_algorithm_t,
  38. * psa_key_type_t, etc.) and macros to build and analyze values
  39. * of these types. */
  40. #include "crypto_types.h"
  41. #include "crypto_values.h"
  42. /* Include size definitions which are used to size some arrays in operation
  43. * structures. */
  44. #include <psa/crypto_sizes.h>
  45. /** For encrypt-decrypt functions, whether the operation is an encryption
  46. * or a decryption. */
  47. typedef enum {
  48. PSA_CRYPTO_DRIVER_DECRYPT,
  49. PSA_CRYPTO_DRIVER_ENCRYPT
  50. } psa_encrypt_or_decrypt_t;
  51. #endif /* PSA_CRYPTO_DRIVER_COMMON_H */