Changeset View
Changeset View
Standalone View
Standalone View
src/secp256k1/src/ecmult.h
/********************************************************************** | /********************************************************************** | ||||
* Copyright (c) 2013, 2014 Pieter Wuille * | * Copyright (c) 2013, 2014 Pieter Wuille * | ||||
* Distributed under the MIT software license, see the accompanying * | * Distributed under the MIT software license, see the accompanying * | ||||
* file COPYING or http://www.opensource.org/licenses/mit-license.php.* | * file COPYING or http://www.opensource.org/licenses/mit-license.php.* | ||||
**********************************************************************/ | **********************************************************************/ | ||||
#ifndef _SECP256K1_ECMULT_ | #ifndef SECP256K1_ECMULT_H | ||||
#define _SECP256K1_ECMULT_ | #define SECP256K1_ECMULT_H | ||||
#include "num.h" | #include "num.h" | ||||
#include "group.h" | #include "group.h" | ||||
typedef struct { | typedef struct { | ||||
/* For accelerating the computation of a*P + b*G: */ | /* For accelerating the computation of a*P + b*G: */ | ||||
secp256k1_ge_storage (*pre_g)[]; /* odd multiples of the generator */ | secp256k1_ge_storage (*pre_g)[]; /* odd multiples of the generator */ | ||||
#ifdef USE_ENDOMORPHISM | #ifdef USE_ENDOMORPHISM | ||||
secp256k1_ge_storage (*pre_g_128)[]; /* odd multiples of 2^128*generator */ | secp256k1_ge_storage (*pre_g_128)[]; /* odd multiples of 2^128*generator */ | ||||
#endif | #endif | ||||
} secp256k1_ecmult_context; | } secp256k1_ecmult_context; | ||||
static void secp256k1_ecmult_context_init(secp256k1_ecmult_context *ctx); | static void secp256k1_ecmult_context_init(secp256k1_ecmult_context *ctx); | ||||
static void secp256k1_ecmult_context_build(secp256k1_ecmult_context *ctx, const secp256k1_callback *cb); | static void secp256k1_ecmult_context_build(secp256k1_ecmult_context *ctx, const secp256k1_callback *cb); | ||||
static void secp256k1_ecmult_context_clone(secp256k1_ecmult_context *dst, | static void secp256k1_ecmult_context_clone(secp256k1_ecmult_context *dst, | ||||
const secp256k1_ecmult_context *src, const secp256k1_callback *cb); | const secp256k1_ecmult_context *src, const secp256k1_callback *cb); | ||||
static void secp256k1_ecmult_context_clear(secp256k1_ecmult_context *ctx); | static void secp256k1_ecmult_context_clear(secp256k1_ecmult_context *ctx); | ||||
static int secp256k1_ecmult_context_is_built(const secp256k1_ecmult_context *ctx); | static int secp256k1_ecmult_context_is_built(const secp256k1_ecmult_context *ctx); | ||||
/** Double multiply: R = na*A + ng*G */ | /** Double multiply: R = na*A + ng*G */ | ||||
static void secp256k1_ecmult(const secp256k1_ecmult_context *ctx, secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng); | static void secp256k1_ecmult(const secp256k1_ecmult_context *ctx, secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_scalar *na, const secp256k1_scalar *ng); | ||||
#endif | #endif /* SECP256K1_ECMULT_H */ |