| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
#ifndef RCTSIGS_H |
| 36 |
#define RCTSIGS_H |
| 37 |
|
| 38 |
#include <cstddef> |
| 39 |
#include <vector> |
| 40 |
#include <tuple> |
| 41 |
|
| 42 |
#include "crypto/generic-ops.h" |
| 43 |
|
| 44 |
extern "C" { |
| 45 |
#include "crypto/random.h" |
| 46 |
#include "crypto/keccak.h" |
| 47 |
} |
| 48 |
#include "crypto/crypto.h" |
| 49 |
|
| 50 |
|
| 51 |
#include "rctTypes.h" |
| 52 |
#include "rctOps.h" |
| 53 |
|
| 54 |
|
| 55 |
#ifdef DBG |
| 56 |
#define DP(x) dp(x) |
| 57 |
#else |
| 58 |
#define DP(x) |
| 59 |
#endif |
| 60 |
|
| 61 |
namespace hw { |
| 62 |
class device; |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
namespace rct { |
| 67 |
|
| 68 |
boroSig genBorromean(const key64 x, const key64 P1, const key64 P2, const bits indices); |
| 69 |
bool verifyBorromean(const boroSig &bb, const key64 P1, const key64 P2); |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
mgSig MLSAG_Gen(const key &message, const keyM & pk, const keyV & xx, const unsigned int index, size_t dsRows, hw::device &hwdev); |
| 78 |
bool MLSAG_Ver(const key &message, const keyM &pk, const mgSig &sig, size_t dsRows); |
| 79 |
|
| 80 |
clsag CLSAG_Gen(const key &message, const keyV & P, const key & p, const keyV & C, const key & z, const keyV & C_nonzero, const key & C_offset, const unsigned int l, hw::device &hwdev); |
| 81 |
clsag CLSAG_Gen(const key &message, const keyV & P, const key & p, const keyV & C, const key & z, const keyV & C_nonzero, const key & C_offset, const unsigned int l); |
| 82 |
clsag proveRctCLSAGSimple(const key &, const ctkeyV &, const ctkey &, const key &, const key &, unsigned int, hw::device &); |
| 83 |
bool verRctCLSAGSimple(const key &, const clsag &, const ctkeyV &, const key &); |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
rangeSig proveRange(key & C, key & mask, const xmr_amount & amount); |
| 93 |
bool verRange(const key & C, const rangeSig & as); |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
mgSig proveRctMG(const ctkeyM & pubs, const ctkeyV & inSk, const keyV &outMasks, const ctkeyV & outPk, unsigned int index, const key &txnFee, const key &message, hw::device &hwdev); |
| 104 |
mgSig proveRctMGSimple(const key & message, const ctkeyV & pubs, const ctkey & inSk, const key &a , const key &Cout, unsigned int index, hw::device &hwdev); |
| 105 |
bool verRctMG(const mgSig &mg, const ctkeyM & pubs, const ctkeyV & outPk, const key &txnFee, const key &message); |
| 106 |
bool verRctMGSimple(const key &message, const mgSig &mg, const ctkeyV & pubs, const key & C); |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
void getKeyFromBlockchain(ctkey & a, size_t reference_index); |
| 114 |
std::tuple<ctkeyM, xmr_amount> populateFromBlockchain(ctkeyV inPk, int mixin); |
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
rctSig genRct(const key &message, const ctkeyV & inSk, const keyV & destinations, const std::vector<xmr_amount> & amounts, const ctkeyM &mixRing, const keyV &amount_keys, unsigned int index, ctkeyV &outSk, const RCTConfig &rct_config, hw::device &hwdev); |
| 127 |
rctSig genRct(const key &message, const ctkeyV & inSk, const ctkeyV & inPk, const keyV & destinations, const std::vector<xmr_amount> & amounts, const keyV &amount_keys, const int mixin, const RCTConfig &rct_config, hw::device &hwdev); |
| 128 |
rctSig genRctSimple(const key & message, const ctkeyV & inSk, const ctkeyV & inPk, const keyV & destinations, const std::vector<xmr_amount> & inamounts, const std::vector<xmr_amount> & outamounts, const keyV &amount_keys, xmr_amount txnFee, unsigned int mixin, const RCTConfig &rct_config, hw::device &hwdev); |
| 129 |
rctSig genRctSimple(const key & message, const ctkeyV & inSk, const keyV & destinations, const std::vector<xmr_amount> & inamounts, const std::vector<xmr_amount> & outamounts, xmr_amount txnFee, const ctkeyM & mixRing, const keyV &amount_keys, const std::vector<unsigned int> & index, ctkeyV &outSk, const RCTConfig &rct_config, hw::device &hwdev); |
| 130 |
bool verRct(const rctSig & rv, bool semantics); |
| 131 |
static inline bool verRct(const rctSig & rv) { return verRct(rv, true) && verRct(rv, false); } |
| 132 |
bool verRctSemanticsSimple(const rctSig & rv); |
| 133 |
bool verRctSemanticsSimple(const std::vector<const rctSig*> & rv); |
| 134 |
bool verRctNonSemanticsSimple(const rctSig & rv); |
| 135 |
static inline bool verRctSimple(const rctSig & rv) { return verRctSemanticsSimple(rv) && verRctNonSemanticsSimple(rv); } |
| 136 |
xmr_amount decodeRct(const rctSig & rv, const key & sk, unsigned int i, key & mask, hw::device &hwdev); |
| 137 |
xmr_amount decodeRct(const rctSig & rv, const key & sk, unsigned int i, hw::device &hwdev); |
| 138 |
xmr_amount decodeRctSimple(const rctSig & rv, const key & sk, unsigned int i, key & mask, hw::device &hwdev); |
| 139 |
xmr_amount decodeRctSimple(const rctSig & rv, const key & sk, unsigned int i, hw::device &hwdev); |
| 140 |
key get_pre_mlsag_hash(const rctSig &rv, hw::device &hwdev); |
| 141 |
} |
| 142 |
#endif |
| 143 |
|