cipher_aes.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #include <openssl/aes.h>
  10. #include "prov/ciphercommon.h"
  11. #include "crypto/aes_platform.h"
  12. typedef struct prov_aes_ctx_st {
  13. PROV_CIPHER_CTX base; /* Must be first */
  14. union {
  15. OSSL_UNION_ALIGN;
  16. AES_KEY ks;
  17. } ks;
  18. /* Platform specific data */
  19. union {
  20. int dummy;
  21. #if defined(OPENSSL_CPUID_OBJ) && defined(__s390__)
  22. struct {
  23. union {
  24. OSSL_UNION_ALIGN;
  25. /*-
  26. * KM-AES parameter block - begin
  27. * (see z/Architecture Principles of Operation >= SA22-7832-06)
  28. */
  29. struct {
  30. unsigned char k[32];
  31. } km;
  32. /* KM-AES parameter block - end */
  33. /*-
  34. * KMO-AES/KMF-AES parameter block - begin
  35. * (see z/Architecture Principles of Operation >= SA22-7832-08)
  36. */
  37. struct {
  38. unsigned char cv[16];
  39. unsigned char k[32];
  40. } kmo_kmf;
  41. /* KMO-AES/KMF-AES parameter block - end */
  42. } param;
  43. unsigned int fc;
  44. int res;
  45. } s390x;
  46. #endif /* defined(OPENSSL_CPUID_OBJ) && defined(__s390__) */
  47. } plat;
  48. } PROV_AES_CTX;
  49. #define ossl_prov_cipher_hw_aes_ofb ossl_prov_cipher_hw_aes_ofb128
  50. #define ossl_prov_cipher_hw_aes_cfb ossl_prov_cipher_hw_aes_cfb128
  51. const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ecb(size_t keybits);
  52. const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cbc(size_t keybits);
  53. const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ofb128(size_t keybits);
  54. const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb128(size_t keybits);
  55. const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb1(size_t keybits);
  56. const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb8(size_t keybits);
  57. const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ctr(size_t keybits);