rsaz_exp.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright 2013-2021 The OpenSSL Project Authors. All Rights Reserved.
  3. * Copyright (c) 2020, Intel Corporation. All Rights Reserved.
  4. *
  5. * Licensed under the Apache License 2.0 (the "License"). You may not use
  6. * this file except in compliance with the License. You can obtain a copy
  7. * in the file LICENSE in the source distribution or at
  8. * https://www.openssl.org/source/license.html
  9. *
  10. * Originally written by Shay Gueron (1, 2), and Vlad Krasnov (1)
  11. * (1) Intel Corporation, Israel Development Center, Haifa, Israel
  12. * (2) University of Haifa, Israel
  13. */
  14. #ifndef OSSL_CRYPTO_BN_RSAZ_EXP_H
  15. # define OSSL_CRYPTO_BN_RSAZ_EXP_H
  16. # undef RSAZ_ENABLED
  17. # if defined(OPENSSL_BN_ASM_MONT) && \
  18. (defined(__x86_64) || defined(__x86_64__) || \
  19. defined(_M_AMD64) || defined(_M_X64))
  20. # define RSAZ_ENABLED
  21. # include <openssl/bn.h>
  22. void RSAZ_1024_mod_exp_avx2(BN_ULONG result[16],
  23. const BN_ULONG base_norm[16],
  24. const BN_ULONG exponent[16],
  25. const BN_ULONG m_norm[16], const BN_ULONG RR[16],
  26. BN_ULONG k0);
  27. int rsaz_avx2_eligible(void);
  28. void RSAZ_512_mod_exp(BN_ULONG result[8],
  29. const BN_ULONG base_norm[8], const BN_ULONG exponent[8],
  30. const BN_ULONG m_norm[8], BN_ULONG k0,
  31. const BN_ULONG RR[8]);
  32. int ossl_rsaz_avx512ifma_eligible(void);
  33. int ossl_rsaz_mod_exp_avx512_x2(BN_ULONG *res1,
  34. const BN_ULONG *base1,
  35. const BN_ULONG *exponent1,
  36. const BN_ULONG *m1,
  37. const BN_ULONG *RR1,
  38. BN_ULONG k0_1,
  39. BN_ULONG *res2,
  40. const BN_ULONG *base2,
  41. const BN_ULONG *exponent2,
  42. const BN_ULONG *m2,
  43. const BN_ULONG *RR2,
  44. BN_ULONG k0_2,
  45. int factor_size);
  46. # endif
  47. #endif