mirror of
https://github.com/GOSTSec/gostcoin
synced 2025-01-19 19:20:02 +00:00
correct base64 I2P address check
This commit is contained in:
parent
e8364fc666
commit
573b273b56
@ -21,7 +21,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SAM_BUFSIZE 65536
|
#define SAM_BUFSIZE 65536
|
||||||
#define I2P_DESTINATION_SIZE 522 // EcDSA, GOST and EdDSA
|
#define I2P_DESTINATION_SIZE 524 // EcDSA, GOST and EdDSA
|
||||||
|
|
||||||
namespace SAM
|
namespace SAM
|
||||||
{
|
{
|
||||||
|
@ -1379,9 +1379,9 @@ void MapPort(bool)
|
|||||||
|
|
||||||
|
|
||||||
static const char *strI2PDNSSeed[][2] = {
|
static const char *strI2PDNSSeed[][2] = {
|
||||||
/* {"cblulrose7qdxdgl6qpnduazj6vc6syg7rcrg7hb3giziovo7hdq.b32.i2p", "cblulrose7qdxdgl6qpnduazj6vc6syg7rcrg7hb3giziovo7hdq.b32.i2p"} ,
|
/* {"cblulrose7qdxdgl6qpnduazj6vc6syg7rcrg7hb3giziovo7hdq.b32.i2p", "cblulrose7qdxdgl6qpnduazj6vc6syg7rcrg7hb3giziovo7hdq.b32.i2p"} ,
|
||||||
{"fgk23qeerln5ajlwba6x4rxuib2vvl3uzywtxcanz5erbjae6ina.b32.i2p",
|
{"fgk23qeerln5ajlwba6x4rxuib2vvl3uzywtxcanz5erbjae6ina.b32.i2p",
|
||||||
"fgk23qeerln5ajlwba6x4rxuib2vvl3uzywtxcanz5erbjae6ina.b32.i2p}*/
|
"fgk23qeerln5ajlwba6x4rxuib2vvl3uzywtxcanz5erbjae6ina.b32.i2p"}*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1478,8 +1478,8 @@ unsigned int pnSeed[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
const std::string pstrI2PSeed[] = {
|
const std::string pstrI2PSeed[] = {
|
||||||
"7nY-~dTIV1dCuRkOJHTDDs-nUtfL-eLUkVOYAn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,7 +593,7 @@ bool CNetAddr::SetSpecial(const std::string &strName)
|
|||||||
const bool isBase32Addr = (strName.size() == NATIVE_I2P_B32ADDR_SIZE) && (strName.substr(strName.size() - 8, 8) == ".b32.i2p");
|
const bool isBase32Addr = (strName.size() == NATIVE_I2P_B32ADDR_SIZE) && (strName.substr(strName.size() - 8, 8) == ".b32.i2p");
|
||||||
const std::string addr = isBase32Addr ? I2PSession::Instance().namingLookup(strName) : strName;
|
const std::string addr = isBase32Addr ? I2PSession::Instance().namingLookup(strName) : strName;
|
||||||
|
|
||||||
if ((addr.size() == NATIVE_I2P_DESTINATION_SIZE) && (addr.substr(addr.size() - 4, 4) == "AAAA")) { // last 4 symbols of b64-destination must be AAAA
|
if ((addr.size() == NATIVE_I2P_DESTINATION_SIZE) && (addr.substr(addr.size() - 5, 5) == "AAA==")) { // last 5 symbols of b64-destination must be AAA==
|
||||||
memcpy(i2pDest, addr.c_str(), NATIVE_I2P_DESTINATION_SIZE);
|
memcpy(i2pDest, addr.c_str(), NATIVE_I2P_DESTINATION_SIZE);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -723,7 +723,7 @@ bool CNetAddr::IsTor() const
|
|||||||
|
|
||||||
bool CNetAddr::IsNativeI2P() const
|
bool CNetAddr::IsNativeI2P() const
|
||||||
{
|
{
|
||||||
static const unsigned char pchAAA[] = {'A','A','A','='}; // EdDSA, TODO:
|
static const unsigned char pchAAA[] = {'A','A','A','=','='}; // EdDSA, TODO:
|
||||||
return (memcmp(i2pDest + NATIVE_I2P_DESTINATION_SIZE - sizeof(pchAAA), pchAAA, sizeof(pchAAA)) == 0);
|
return (memcmp(i2pDest + NATIVE_I2P_DESTINATION_SIZE - sizeof(pchAAA), pchAAA, sizeof(pchAAA)) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ extern int nConnectTimeout;
|
|||||||
#undef SetPort
|
#undef SetPort
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NATIVE_I2P_DESTINATION_SIZE 522
|
#define NATIVE_I2P_DESTINATION_SIZE 524
|
||||||
#define NATIVE_I2P_B32ADDR_SIZE 60
|
#define NATIVE_I2P_B32ADDR_SIZE 60
|
||||||
#define NATIVE_I2P_NET_STRING "i2p"
|
#define NATIVE_I2P_NET_STRING "i2p"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user