diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-10-10 15:47:08 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-11-14 16:56:10 +0000 |
commit | 383ff4f68943c5d998fba8caa20aee481583f214 (patch) | |
tree | 23eefe275400a75af13faa49af8198ba3ab1183c /src/ringct | |
parent | Merge pull request #2720 (diff) | |
download | monero-383ff4f68943c5d998fba8caa20aee481583f214.tar.xz |
remove "using namespace std" from headers
It's nasty, and actually breaks on Solaris, where if.h fails to
build due to:
struct map *if_memmap;
Diffstat (limited to 'src/ringct')
-rw-r--r-- | src/ringct/rctOps.h | 11 | ||||
-rw-r--r-- | src/ringct/rctSigs.h | 14 | ||||
-rw-r--r-- | src/ringct/rctTypes.h | 19 |
3 files changed, 15 insertions, 29 deletions
diff --git a/src/ringct/rctOps.h b/src/ringct/rctOps.h index cb19bbbd6..412450c18 100644 --- a/src/ringct/rctOps.h +++ b/src/ringct/rctOps.h @@ -35,8 +35,6 @@ #define RCTOPS_H #include <cstddef> -#include <mutex> -#include <vector> #include <tuple> #include "crypto/generic-ops.h" @@ -57,9 +55,6 @@ extern "C" { #define DP(x) #endif -using namespace std; -using namespace crypto; - namespace rct { //Various key initialization functions @@ -99,13 +94,13 @@ namespace rct { key pkGen(); //generates a random secret and corresponding public key void skpkGen(key &sk, key &pk); - tuple<key, key> skpkGen(); + std::tuple<key, key> skpkGen(); //generates a <secret , public> / Pedersen commitment to the amount - tuple<ctkey, ctkey> ctskpkGen(xmr_amount amount); + std::tuple<ctkey, ctkey> ctskpkGen(xmr_amount amount); //generates C =aG + bH from b, a is random void genC(key & C, const key & a, xmr_amount amount); //this one is mainly for testing, can take arbitrary amounts.. - tuple<ctkey, ctkey> ctskpkGen(const key &bH); + std::tuple<ctkey, ctkey> ctskpkGen(const key &bH); // make a pedersen commitment with given key key commit(xmr_amount amount, const key &mask); // make a pedersen commitment with zero key diff --git a/src/ringct/rctSigs.h b/src/ringct/rctSigs.h index ca40ddd85..d158f06f0 100644 --- a/src/ringct/rctSigs.h +++ b/src/ringct/rctSigs.h @@ -36,7 +36,6 @@ #define RCTSIGS_H #include <cstddef> -#include <mutex> #include <vector> #include <tuple> @@ -61,9 +60,6 @@ extern "C" { -using namespace std; -using namespace crypto; - namespace rct { boroSig genBorromean(const key64 x, const key64 P1, const key64 P2, const bits indices); @@ -110,7 +106,7 @@ namespace rct { //populateFromBlockchain creates a keymatrix with "mixin" columns and one of the columns is inPk // the return value are the key matrix, and the index where inPk was put (random). void getKeyFromBlockchain(ctkey & a, size_t reference_index); - tuple<ctkeyM, xmr_amount> populateFromBlockchain(ctkeyV inPk, int mixin); + std::tuple<ctkeyM, xmr_amount> populateFromBlockchain(ctkeyV inPk, int mixin); //RingCT protocol //genRct: @@ -122,10 +118,10 @@ namespace rct { //decodeRct: (c.f. http://eprint.iacr.org/2015/1098 section 5.1.1) // uses the attached ecdh info to find the amounts represented by each output commitment // must know the destination private key to find the correct amount, else will return a random number - rctSig genRct(const key &message, const ctkeyV & inSk, const keyV & destinations, const vector<xmr_amount> & amounts, const ctkeyM &mixRing, const keyV &amount_keys, unsigned int index, ctkeyV &outSk); - rctSig genRct(const key &message, const ctkeyV & inSk, const ctkeyV & inPk, const keyV & destinations, const vector<xmr_amount> & amounts, const keyV &amount_keys, const int mixin); - rctSig genRctSimple(const key & message, const ctkeyV & inSk, const ctkeyV & inPk, const keyV & destinations, const vector<xmr_amount> & inamounts, const vector<xmr_amount> & outamounts, const keyV &amount_keys, xmr_amount txnFee, unsigned int mixin); - rctSig genRctSimple(const key & message, const ctkeyV & inSk, const keyV & destinations, const vector<xmr_amount> & inamounts, const vector<xmr_amount> & outamounts, xmr_amount txnFee, const ctkeyM & mixRing, const keyV &amount_keys, const std::vector<unsigned int> & index, ctkeyV &outSk); + 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); + 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); + 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); + 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); bool verRct(const rctSig & rv, bool semantics); static inline bool verRct(const rctSig & rv) { return verRct(rv, true) && verRct(rv, false); } bool verRctSimple(const rctSig & rv, bool semantics); diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h index cc0000ad6..8147cb602 100644 --- a/src/ringct/rctTypes.h +++ b/src/ringct/rctTypes.h @@ -33,9 +33,7 @@ #define RCT_TYPES_H #include <cstddef> -#include <mutex> #include <vector> -#include <tuple> #include <iostream> #include <cinttypes> @@ -67,9 +65,6 @@ extern "C" { //for printing large ints -using namespace std; -using namespace crypto; - //Namespace specifically for ring ct code namespace rct { //basic ops containers @@ -89,8 +84,8 @@ namespace rct { bool operator==(const key &k) const { return !memcmp(bytes, k.bytes, sizeof(bytes)); } unsigned char bytes[32]; }; - typedef vector<key> keyV; //vector of keys - typedef vector<keyV> keyM; //matrix of keys (indexed by column first) + typedef std::vector<key> keyV; //vector of keys + typedef std::vector<keyV> keyM; //matrix of keys (indexed by column first) //containers For CT operations //if it's representing a private ctkey then "dest" contains the secret key of the address @@ -101,8 +96,8 @@ namespace rct { key dest; key mask; //C here if public }; - typedef vector<ctkey> ctkeyV; - typedef vector<ctkeyV> ctkeyM; + typedef std::vector<ctkey> ctkeyV; + typedef std::vector<ctkeyV> ctkeyM; //data for passing the amount to the receiver secretly // If the pedersen commitment to an amount is C = aG + bH, @@ -184,7 +179,7 @@ namespace rct { ctkeyM mixRing; //the set of all pubkeys / copy //pairs that you mix with keyV pseudoOuts; //C - for simple rct - vector<ecdhTuple> ecdhInfo; + std::vector<ecdhTuple> ecdhInfo; ctkeyV outPk; xmr_amount txnFee; // contains b @@ -245,8 +240,8 @@ namespace rct { } }; struct rctSigPrunable { - vector<rangeSig> rangeSigs; - vector<mgSig> MGs; // simple rct has N, full has 1 + std::vector<rangeSig> rangeSigs; + std::vector<mgSig> MGs; // simple rct has N, full has 1 template<bool W, template <bool> class Archive> bool serialize_rctsig_prunable(Archive<W> &ar, uint8_t type, size_t inputs, size_t outputs, size_t mixin) |