diff --git a/libi2pd/ChaCha20.cpp b/libi2pd/ChaCha20.cpp index e43f1514..0ab98fb2 100644 --- a/libi2pd/ChaCha20.cpp +++ b/libi2pd/ChaCha20.cpp @@ -7,6 +7,8 @@ Kovri go write your own code */ + +#if LEGACY_OPENSSL namespace i2p { namespace crypto @@ -144,4 +146,6 @@ void chacha20(uint8_t * buf, size_t sz, const uint8_t * nonce, const uint8_t * k } } -} \ No newline at end of file +} +#endif + diff --git a/libi2pd/ChaCha20.h b/libi2pd/ChaCha20.h index c88325d5..5a8ce145 100644 --- a/libi2pd/ChaCha20.h +++ b/libi2pd/ChaCha20.h @@ -9,7 +9,9 @@ #define LIBI2PD_CHACHA20_H #include #include +#include "Crypto.h" +#if LEGACY_OPENSSL namespace i2p { namespace crypto @@ -22,5 +24,6 @@ namespace crypto } } +#endif #endif diff --git a/libi2pd/Ed25519.cpp b/libi2pd/Ed25519.cpp index 17264926..2c64c475 100644 --- a/libi2pd/Ed25519.cpp +++ b/libi2pd/Ed25519.cpp @@ -411,6 +411,7 @@ namespace crypto } } +#if !OPENSSL_X25519 BIGNUM * Ed25519::ScalarMul (const BIGNUM * u, const BIGNUM * k, BN_CTX * ctx) const { BN_CTX_start (ctx); @@ -488,6 +489,7 @@ namespace crypto EncodeBN (q1, buf, 32); BN_free (p1); BN_free (n); BN_free (q1); } +#endif void Ed25519::ExpandPrivateKey (const uint8_t * key, uint8_t * expandedKey) { diff --git a/libi2pd/Ed25519.h b/libi2pd/Ed25519.h index fc23a457..48b3a665 100644 --- a/libi2pd/Ed25519.h +++ b/libi2pd/Ed25519.h @@ -3,6 +3,7 @@ #include #include +#include "Crypto.h" namespace i2p { @@ -75,8 +76,10 @@ namespace crypto EDDSAPoint GeneratePublicKey (const uint8_t * expandedPrivateKey, BN_CTX * ctx) const; EDDSAPoint DecodePublicKey (const uint8_t * buf, BN_CTX * ctx) const; void EncodePublicKey (const EDDSAPoint& publicKey, uint8_t * buf, BN_CTX * ctx) const; +#if !OPENSSL_X25519 void ScalarMul (const uint8_t * p, const uint8_t * e, uint8_t * buf, BN_CTX * ctx) const; // p is point, e is number for x25519 void ScalarMulB (const uint8_t * e, uint8_t * buf, BN_CTX * ctx) const; +#endif bool Verify (const EDDSAPoint& publicKey, const uint8_t * digest, const uint8_t * signature) const; void Sign (const uint8_t * expandedPrivateKey, const uint8_t * publicKeyEncoded, const uint8_t * buf, size_t len, uint8_t * signature) const; @@ -100,8 +103,10 @@ namespace crypto BIGNUM * DecodeBN (const uint8_t * buf) const; void EncodeBN (const BIGNUM * bn, uint8_t * buf, size_t len) const; +#if !OPENSSL_X25519 // for x25519 BIGNUM * ScalarMul (const BIGNUM * p, const BIGNUM * e, BN_CTX * ctx) const; +#endif private: diff --git a/libi2pd/Poly1305.cpp b/libi2pd/Poly1305.cpp index 9ee46640..a33e9d1b 100644 --- a/libi2pd/Poly1305.cpp +++ b/libi2pd/Poly1305.cpp @@ -6,6 +6,8 @@ Kovri go write your own code */ + +#if LEGACY_OPENSSL namespace i2p { namespace crypto @@ -249,3 +251,5 @@ namespace crypto } } } +#endif + diff --git a/libi2pd/Poly1305.h b/libi2pd/Poly1305.h index 2c62c5aa..d47e2e66 100644 --- a/libi2pd/Poly1305.h +++ b/libi2pd/Poly1305.h @@ -9,7 +9,9 @@ #define LIBI2PD_POLY1305_H #include #include +#include "Crypto.h" +#if LEGACY_OPENSSL namespace i2p { namespace crypto @@ -24,5 +26,6 @@ namespace crypto } } +#endif #endif diff --git a/libi2pd/Siphash.h b/libi2pd/Siphash.h index aa8b8631..70822466 100644 --- a/libi2pd/Siphash.h +++ b/libi2pd/Siphash.h @@ -9,7 +9,9 @@ #define SIPHASH_H #include +#include "Crypto.h" +#if !OPENSSL_SIPHASH namespace i2p { namespace crypto @@ -148,5 +150,6 @@ namespace crypto } } } +#endif #endif