rsaz_exp.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*****************************************************************************
  2. * *
  3. * Copyright (c) 2012, Intel Corporation *
  4. * *
  5. * All rights reserved. *
  6. * *
  7. * Redistribution and use in source and binary forms, with or without *
  8. * modification, are permitted provided that the following conditions are *
  9. * met: *
  10. * *
  11. * * Redistributions of source code must retain the above copyright *
  12. * notice, this list of conditions and the following disclaimer. *
  13. * *
  14. * * Redistributions in binary form must reproduce the above copyright *
  15. * notice, this list of conditions and the following disclaimer in the *
  16. * documentation and/or other materials provided with the *
  17. * distribution. *
  18. * *
  19. * * Neither the name of the Intel Corporation nor the names of its *
  20. * contributors may be used to endorse or promote products derived from *
  21. * this software without specific prior written permission. *
  22. * *
  23. * *
  24. * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION ""AS IS"" AND ANY *
  25. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR *
  27. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL CORPORATION OR *
  28. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
  29. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
  30. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
  31. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
  32. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
  33. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
  34. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
  35. * *
  36. ******************************************************************************
  37. * Developers and authors: *
  38. * Shay Gueron (1, 2), and Vlad Krasnov (1) *
  39. * (1) Intel Corporation, Israel Development Center, Haifa, Israel *
  40. * (2) University of Haifa, Israel *
  41. *****************************************************************************/
  42. #ifndef RSAZ_EXP_H
  43. # define RSAZ_EXP_H
  44. # undef RSAZ_ENABLED
  45. # if defined(OPENSSL_BN_ASM_MONT) && \
  46. (defined(__x86_64) || defined(__x86_64__) || \
  47. defined(_M_AMD64) || defined(_M_X64))
  48. # define RSAZ_ENABLED
  49. # include <openssl/bn.h>
  50. void RSAZ_1024_mod_exp_avx2(BN_ULONG result[16],
  51. const BN_ULONG base_norm[16],
  52. const BN_ULONG exponent[16],
  53. const BN_ULONG m_norm[16], const BN_ULONG RR[16],
  54. BN_ULONG k0);
  55. int rsaz_avx2_eligible();
  56. void RSAZ_512_mod_exp(BN_ULONG result[8],
  57. const BN_ULONG base_norm[8], const BN_ULONG exponent[8],
  58. const BN_ULONG m_norm[8], BN_ULONG k0,
  59. const BN_ULONG RR[8]);
  60. # endif
  61. #endif