1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-21 23:54:14 +00:00

initialize crpto constants on demand

This commit is contained in:
orignal 2014-09-21 18:17:16 -04:00
parent 5e179c166b
commit c4c614bc3d
3 changed files with 33 additions and 13 deletions

View File

@ -24,9 +24,6 @@ namespace crypto
0x39, 0x95, 0x49, 0x7C, 0xEA, 0x95, 0x6A, 0xE5, 0x15, 0xD2, 0x26, 0x18, 0x98, 0xFA, 0x05, 0x10, 0x39, 0x95, 0x49, 0x7C, 0xEA, 0x95, 0x6A, 0xE5, 0x15, 0xD2, 0x26, 0x18, 0x98, 0xFA, 0x05, 0x10,
0x15, 0x72, 0x8E, 0x5A, 0x8A, 0xAC, 0xAA, 0x68, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF 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]= const uint8_t dsap_[128]=
{ {
@ -58,9 +55,19 @@ namespace crypto
0xb3, 0xdb, 0xb1, 0x4a, 0x90, 0x5e, 0x7b, 0x2b, 0x3e, 0x93, 0xbe, 0x47, 0x08, 0xcb, 0xcc, 0x82 0xb3, 0xdb, 0xb1, 0x4a, 0x90, 0x5e, 0x7b, 0x2b, 0x3e, 0x93, 0xbe, 0x47, 0x08, 0xcb, 0xcc, 0x82
}; };
const CryptoPP::Integer dsap (dsap_, 128); const CryptoConstants& GetCryptoConstants ()
const CryptoPP::Integer dsaq (dsaq_, 20); {
const CryptoPP::Integer dsag (dsag_, 128); static CryptoConstants cryptoConstants =
{
{elgp_, 256}, // elgp
{2}, // elgg
{dsap_, 128}, // dsap
{dsaq_, 20}, // dsaq
{dsag_, 128} // dsag
};
return cryptoConstants;
}
} }
} }

View File

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

View File

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