Browse Source

initialize crpto constants on demand

pull/100/head
orignal 10 years ago
parent
commit
c4c614bc3d
  1. 19
      CryptoConst.cpp
  2. 25
      CryptoConst.h
  3. 2
      version.h

19
CryptoConst.cpp

@ -25,9 +25,6 @@ namespace crypto @@ -25,9 +25,6 @@ namespace crypto
0x15, 0x72, 0x8E, 0x5A, 0x8A, 0xAC, 0xAA, 0x68, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
};
const CryptoPP::Integer elgp (elgp_, 256);
const CryptoPP::Integer elgg (2);
const uint8_t dsap_[128]=
{
0x9c, 0x05, 0xb2, 0xaa, 0x96, 0x0d, 0x9b, 0x97, 0xb8, 0x93, 0x19, 0x63, 0xc9, 0xcc, 0x9e, 0x8c,
@ -58,9 +55,19 @@ namespace crypto @@ -58,9 +55,19 @@ namespace crypto
0xb3, 0xdb, 0xb1, 0x4a, 0x90, 0x5e, 0x7b, 0x2b, 0x3e, 0x93, 0xbe, 0x47, 0x08, 0xcb, 0xcc, 0x82
};
const CryptoPP::Integer dsap (dsap_, 128);
const CryptoPP::Integer dsaq (dsaq_, 20);
const CryptoPP::Integer dsag (dsag_, 128);
const CryptoConstants& GetCryptoConstants ()
{
static CryptoConstants cryptoConstants =
{
{elgp_, 256}, // elgp
{2}, // elgg
{dsap_, 128}, // dsap
{dsaq_, 20}, // dsaq
{dsag_, 128} // dsag
};
return cryptoConstants;
}
}
}

25
CryptoConst.h

@ -7,15 +7,28 @@ namespace i2p @@ -7,15 +7,28 @@ namespace i2p
{
namespace crypto
{
// DH
extern const CryptoPP::Integer elgp;
extern const CryptoPP::Integer elgg;
struct CryptoConstants
{
// DH/ElGamal
const CryptoPP::Integer elgp;
const CryptoPP::Integer elgg;
// DSA
const CryptoPP::Integer dsap;
const CryptoPP::Integer dsaq;
const CryptoPP::Integer dsag;
};
const CryptoConstants& GetCryptoConstants ();
// DH/ElGamal
#define elgp GetCryptoConstants ().elgp
#define elgg GetCryptoConstants ().elgg
// DSA
extern const CryptoPP::Integer dsap;
extern const CryptoPP::Integer dsaq;
extern const CryptoPP::Integer dsag;
#define dsap GetCryptoConstants ().dsap
#define dsaq GetCryptoConstants ().dsaq
#define dsag GetCryptoConstants ().dsag
}
}

2
version.h

@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
#define CODENAME "Purple"
#define I2P_VERSION "0.9.14.1"
#define I2P_VERSION "0.9.15"
/* TEMPORARY STORE FOR IMAGE CODES */

Loading…
Cancel
Save