36 lines
1.1 KiB
C
36 lines
1.1 KiB
C
|
/***********************************************************************
|
||
|
* Copyright (c) 2020 Peter Dettman *
|
||
|
* Distributed under the MIT software license, see the accompanying *
|
||
|
* file COPYING or https://www.opensource.org/licenses/mit-license.php.*
|
||
|
**********************************************************************/
|
||
|
|
||
|
#ifndef SECP256K1_MODINV64_H
|
||
|
#define SECP256K1_MODINV64_H
|
||
|
|
||
|
#if defined HAVE_CONFIG_H
|
||
|
#include "libsecp256k1-config.h"
|
||
|
#endif
|
||
|
|
||
|
#include "util.h"
|
||
|
|
||
|
#ifndef SECP256K1_WIDEMUL_INT128
|
||
|
#error "modinv64 requires 128-bit wide multiplication support"
|
||
|
#endif
|
||
|
|
||
|
typedef struct {
|
||
|
int64_t v[5];
|
||
|
} secp256k1_modinv64_signed62;
|
||
|
|
||
|
typedef struct {
|
||
|
/* The modulus in signed62 notation. */
|
||
|
secp256k1_modinv64_signed62 modulus;
|
||
|
|
||
|
/* modulus^{-1} mod 2^62 */
|
||
|
uint64_t modulus_inv62;
|
||
|
} secp256k1_modinv64_modinfo;
|
||
|
|
||
|
static void secp256k1_modinv64(secp256k1_modinv64_signed62 *x, const secp256k1_modinv64_modinfo *modinfo);
|
||
|
static void secp256k1_modinv64_var(secp256k1_modinv64_signed62 *x, const secp256k1_modinv64_modinfo *modinfo);
|
||
|
|
||
|
#endif /* SECP256K1_MODINV64_H */
|