blob: af973a5c77f0fb6982cabec338ad4c40da2a3488 [file] [log] [blame]
Robert Sloanab8b8882018-03-26 11:39:51 -07001/*
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 */
Adam Langleyd9e397b2015-01-22 14:27:53 -080014
Robert Sloanab8b8882018-03-26 11:39:51 -070015#ifndef OPENSSL_HEADER_BN_RSAZ_EXP_H
16#define OPENSSL_HEADER_BN_RSAZ_EXP_H
Adam Langleyd9e397b2015-01-22 14:27:53 -080017
18#include <openssl/bn.h>
19
Robert Sloanab8b8882018-03-26 11:39:51 -070020// RSAZ_1024_mod_exp_avx2 sets |result| to |base_norm| raised to |exponent|
21// modulo |m_norm|. |base_norm| must be fully-reduced and |exponent| must have
22// the high bit set (it is 1024 bits wide). |RR| and |k0| must be |RR| and |n0|,
23// respectively, extracted from |m_norm|'s |BN_MONT_CTX|.
24void RSAZ_1024_mod_exp_avx2(BN_ULONG result[16], const BN_ULONG base_norm[16],
25 const BN_ULONG exponent[16],
26 const BN_ULONG m_norm[16], const BN_ULONG RR[16],
27 BN_ULONG k0);
28
29// rsaz_avx2_eligible returns one if |RSAZ_1024_mod_exp_avx2| should be used and
30// zero otherwise.
Adam Langleyd9e397b2015-01-22 14:27:53 -080031int rsaz_avx2_eligible(void);
32
Robert Sloanab8b8882018-03-26 11:39:51 -070033#endif // OPENSSL_HEADER_BN_RSAZ_EXP_H