rsaz_exp.h 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved.
  3. * Copyright (c) 2012, Intel Corporation. All Rights Reserved.
  4. *
  5. * Licensed under the OpenSSL license (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 OPENSSL_HEADER_BN_RSAZ_EXP_H
  15. #define OPENSSL_HEADER_BN_RSAZ_EXP_H
  16. #include <openssl/bn.h>
  17. // RSAZ_1024_mod_exp_avx2 sets |result| to |base_norm| raised to |exponent|
  18. // modulo |m_norm|. |base_norm| must be fully-reduced and |exponent| must have
  19. // the high bit set (it is 1024 bits wide). |RR| and |k0| must be |RR| and |n0|,
  20. // respectively, extracted from |m_norm|'s |BN_MONT_CTX|.
  21. void RSAZ_1024_mod_exp_avx2(BN_ULONG result[16], const BN_ULONG base_norm[16],
  22. const BN_ULONG exponent[16],
  23. const BN_ULONG m_norm[16], const BN_ULONG RR[16],
  24. BN_ULONG k0);
  25. // rsaz_avx2_eligible returns one if |RSAZ_1024_mod_exp_avx2| should be used and
  26. // zero otherwise.
  27. int rsaz_avx2_eligible(void);
  28. #endif // OPENSSL_HEADER_BN_RSAZ_EXP_H