1 /* 2 * Copyright (C) 2017 - This file is part of libecc project 3 * 4 * Authors: 5 * Ryad BENADJILA <ryadbenadjila@gmail.com> 6 * Arnaud EBALARD <arnaud.ebalard@ssi.gouv.fr> 7 * Jean-Pierre FLORI <jean-pierre.flori@ssi.gouv.fr> 8 * 9 * Contributors: 10 * Nicolas VIVET <nicolas.vivet@ssi.gouv.fr> 11 * Karim KHALFALLAH <karim.khalfallah@ssi.gouv.fr> 12 * 13 * This software is licensed under a dual BSD and GPL v2 license. 14 * See LICENSE file at the root folder of the project. 15 */ 16 #ifndef __NN_MODINV_H__ 17 #define __NN_MODINV_H__ 18 #include <libecc/nn/nn.h> 19 20 ATTRIBUTE_WARN_UNUSED_RET int nn_modinv(nn_t out, nn_src_t x, nn_src_t m); 21 ATTRIBUTE_WARN_UNUSED_RET int nn_modinv_2exp(nn_t out, nn_src_t in, bitcnt_t exp, int *in_isodd); 22 ATTRIBUTE_WARN_UNUSED_RET int nn_modinv_word(nn_t out, word_t w, nn_src_t m); 23 ATTRIBUTE_WARN_UNUSED_RET int nn_modinv_fermat(nn_t out, nn_src_t x, nn_src_t p); 24 ATTRIBUTE_WARN_UNUSED_RET int nn_modinv_fermat_redc(nn_t out, nn_src_t x, nn_src_t p, nn_src_t r, nn_src_t r_square, word_t mpinv); 25 26 #endif /* __NN_MODINV_H__ */ 27