mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2024-10-31 09:20:38 +00:00
Merge branch 'openssl' of https://github.com/PurpleI2P/i2pd into openssl
This commit is contained in:
commit
e1eaa2097e
21
Crypto.cpp
21
Crypto.cpp
@ -224,7 +224,7 @@ namespace crypto
|
||||
|
||||
// DH
|
||||
|
||||
DHKeys::DHKeys (): m_IsUpdated (true)
|
||||
DHKeys::DHKeys ()
|
||||
{
|
||||
m_DH = DH_new ();
|
||||
DH_set0_pqg (m_DH, BN_dup (elgp), NULL, BN_dup (elgg));
|
||||
@ -236,7 +236,7 @@ namespace crypto
|
||||
DH_free (m_DH);
|
||||
}
|
||||
|
||||
void DHKeys::GenerateKeys (uint8_t * priv, uint8_t * pub)
|
||||
void DHKeys::GenerateKeys ()
|
||||
{
|
||||
BIGNUM * priv_key = NULL, * pub_key = NULL;
|
||||
#if !defined(__x86_64__) // use short exponent for non x64
|
||||
@ -261,22 +261,7 @@ namespace crypto
|
||||
DH_get0_key (m_DH, (const BIGNUM **)&pub_key, (const BIGNUM **)&priv_key);
|
||||
}
|
||||
|
||||
if (priv) bn2buf (priv_key, priv, 256);
|
||||
if (pub) bn2buf (pub_key, pub, 256);
|
||||
m_IsUpdated = true;
|
||||
}
|
||||
|
||||
const uint8_t * DHKeys::GetPublicKey ()
|
||||
{
|
||||
if (m_IsUpdated)
|
||||
{
|
||||
const BIGNUM * priv_key, * pub_key;
|
||||
DH_get0_key (m_DH, &pub_key, &priv_key);
|
||||
bn2buf (pub_key, m_PublicKey, 256);
|
||||
DH_set0_key (m_DH, NULL, NULL);
|
||||
m_IsUpdated= false;
|
||||
}
|
||||
return m_PublicKey;
|
||||
bn2buf (pub_key, m_PublicKey, 256);
|
||||
}
|
||||
|
||||
void DHKeys::Agree (const uint8_t * pub, uint8_t * shared)
|
||||
|
5
Crypto.h
5
Crypto.h
@ -36,15 +36,14 @@ namespace crypto
|
||||
DHKeys ();
|
||||
~DHKeys ();
|
||||
|
||||
void GenerateKeys (uint8_t * priv = nullptr, uint8_t * pub = nullptr);
|
||||
const uint8_t * GetPublicKey ();
|
||||
void GenerateKeys ();
|
||||
const uint8_t * GetPublicKey () const { return m_PublicKey; };
|
||||
void Agree (const uint8_t * pub, uint8_t * shared);
|
||||
|
||||
private:
|
||||
|
||||
DH * m_DH;
|
||||
uint8_t m_PublicKey[256];
|
||||
bool m_IsUpdated;
|
||||
};
|
||||
|
||||
// ElGamal
|
||||
|
@ -30,16 +30,16 @@ Where $ARCH is `i686` or `x86_64` (matching your system).
|
||||
- Open MSYS2 Shell (from Start menu).
|
||||
- Install all prerequisites and download i2pd source:
|
||||
|
||||
export ARCH='i686' # or 'x86_64'
|
||||
export MINGW='mingw32' # or 'mingw64'
|
||||
pacman -S mingw-w64-$ARCH-boost mingw-w64-$ARCH-openssl mingw-w64-$ARCH-gcc git make
|
||||
mkdir -p /c/dev/i2pd
|
||||
cd /c/dev/i2pd
|
||||
git clone https://github.com/PurpleI2P/i2pd.git
|
||||
cd i2pd
|
||||
# we need compiler on PATH which is usually heavily cluttered on Windows
|
||||
export PATH=/$MINGW/bin:/usr/bin
|
||||
make
|
||||
export ARCH='i686' # or 'x86_64'
|
||||
export MINGW='mingw32' # or 'mingw64'
|
||||
pacman -S mingw-w64-$ARCH-boost mingw-w64-$ARCH-openssl mingw-w64-$ARCH-gcc git make
|
||||
mkdir -p /c/dev/i2pd
|
||||
cd /c/dev/i2pd
|
||||
git clone https://github.com/PurpleI2P/i2pd.git
|
||||
cd i2pd
|
||||
# we need compiler on PATH which is usually heavily cluttered on Windows
|
||||
export PATH=/$MINGW/bin:/usr/bin
|
||||
make
|
||||
|
||||
### Caveats
|
||||
|
||||
|
@ -48,7 +48,7 @@ Enable/disable i2pd to be started on bootup:
|
||||
|
||||
## Configuring i2pd
|
||||
|
||||
See [configuration page](i2pd.readthedocs.io/page/configuration.html).
|
||||
See [configuration documentation](/page/configuration.html).
|
||||
|
||||
|
||||
## Browsing and hosting websites
|
||||
|
Loading…
Reference in New Issue
Block a user