2424 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525 */
2626
27+ #include <linux/module.h>
2728#include <linux/random.h>
2829#include <linux/slab.h>
2930#include <linux/swab.h>
@@ -112,7 +113,7 @@ static void vli_clear(u64 *vli, unsigned int ndigits)
112113}
113114
114115/* Returns true if vli == 0, false otherwise. */
115- static bool vli_is_zero (const u64 * vli , unsigned int ndigits )
116+ bool vli_is_zero (const u64 * vli , unsigned int ndigits )
116117{
117118 int i ;
118119
@@ -123,6 +124,7 @@ static bool vli_is_zero(const u64 *vli, unsigned int ndigits)
123124
124125 return true;
125126}
127+ EXPORT_SYMBOL (vli_is_zero );
126128
127129/* Returns nonzero if bit bit of vli is set. */
128130static u64 vli_test_bit (const u64 * vli , unsigned int bit )
@@ -171,7 +173,7 @@ static void vli_set(u64 *dest, const u64 *src, unsigned int ndigits)
171173}
172174
173175/* Returns sign of left - right. */
174- static int vli_cmp (const u64 * left , const u64 * right , unsigned int ndigits )
176+ int vli_cmp (const u64 * left , const u64 * right , unsigned int ndigits )
175177{
176178 int i ;
177179
@@ -184,6 +186,7 @@ static int vli_cmp(const u64 *left, const u64 *right, unsigned int ndigits)
184186
185187 return 0 ;
186188}
189+ EXPORT_SYMBOL (vli_cmp );
187190
188191/* Computes result = in << c, returning carry. Can modify in place
189192 * (if result == in). 0 < shift < 64.
@@ -240,7 +243,7 @@ static u64 vli_add(u64 *result, const u64 *left, const u64 *right,
240243}
241244
242245/* Computes result = left - right, returning borrow. Can modify in place. */
243- static u64 vli_sub (u64 * result , const u64 * left , const u64 * right ,
246+ u64 vli_sub (u64 * result , const u64 * left , const u64 * right ,
244247 unsigned int ndigits )
245248{
246249 u64 borrow = 0 ;
@@ -258,6 +261,7 @@ static u64 vli_sub(u64 *result, const u64 *left, const u64 *right,
258261
259262 return borrow ;
260263}
264+ EXPORT_SYMBOL (vli_sub );
261265
262266static uint128_t mul_64_64 (u64 left , u64 right )
263267{
@@ -557,7 +561,7 @@ static void vli_mod_square_fast(u64 *result, const u64 *left,
557561 * See "From Euclid's GCD to Montgomery Multiplication to the Great Divide"
558562 * https://labs.oracle.com/techrep/2001/smli_tr-2001-95.pdf
559563 */
560- static void vli_mod_inv (u64 * result , const u64 * input , const u64 * mod ,
564+ void vli_mod_inv (u64 * result , const u64 * input , const u64 * mod ,
561565 unsigned int ndigits )
562566{
563567 u64 a [ECC_MAX_DIGITS ], b [ECC_MAX_DIGITS ];
@@ -630,6 +634,7 @@ static void vli_mod_inv(u64 *result, const u64 *input, const u64 *mod,
630634
631635 vli_set (result , u , ndigits );
632636}
637+ EXPORT_SYMBOL (vli_mod_inv );
633638
634639/* ------ Point operations ------ */
635640
@@ -948,6 +953,7 @@ int ecc_is_key_valid(unsigned int curve_id, unsigned int ndigits,
948953
949954 return __ecc_is_key_valid (curve , private_key , ndigits );
950955}
956+ EXPORT_SYMBOL (ecc_is_key_valid );
951957
952958/*
953959 * ECC private keys are generated using the method of extra random bits,
@@ -1000,6 +1006,7 @@ int ecc_gen_privkey(unsigned int curve_id, unsigned int ndigits, u64 *privkey)
10001006
10011007 return 0 ;
10021008}
1009+ EXPORT_SYMBOL (ecc_gen_privkey );
10031010
10041011int ecc_make_pub_key (unsigned int curve_id , unsigned int ndigits ,
10051012 const u64 * private_key , u64 * public_key )
@@ -1036,10 +1043,11 @@ int ecc_make_pub_key(unsigned int curve_id, unsigned int ndigits,
10361043out :
10371044 return ret ;
10381045}
1046+ EXPORT_SYMBOL (ecc_make_pub_key );
10391047
10401048/* SP800-56A section 5.6.2.3.4 partial verification: ephemeral keys only */
1041- static int ecc_is_pubkey_valid_partial (const struct ecc_curve * curve ,
1042- struct ecc_point * pk )
1049+ int ecc_is_pubkey_valid_partial (const struct ecc_curve * curve ,
1050+ struct ecc_point * pk )
10431051{
10441052 u64 yy [ECC_MAX_DIGITS ], xxx [ECC_MAX_DIGITS ], w [ECC_MAX_DIGITS ];
10451053
@@ -1064,8 +1072,8 @@ static int ecc_is_pubkey_valid_partial(const struct ecc_curve *curve,
10641072 return - EINVAL ;
10651073
10661074 return 0 ;
1067-
10681075}
1076+ EXPORT_SYMBOL (ecc_is_pubkey_valid_partial );
10691077
10701078int crypto_ecdh_shared_secret (unsigned int curve_id , unsigned int ndigits ,
10711079 const u64 * private_key , const u64 * public_key ,
@@ -1121,3 +1129,6 @@ int crypto_ecdh_shared_secret(unsigned int curve_id, unsigned int ndigits,
11211129out :
11221130 return ret ;
11231131}
1132+ EXPORT_SYMBOL (crypto_ecdh_shared_secret );
1133+
1134+ MODULE_LICENSE ("Dual BSD/GPL" );
0 commit comments