mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-08-26 10:10:24 +01:00
offline signature for close packet
Some checks failed
Build containers / Building container for linux/arm64 (push) Has been cancelled
Build Debian packages / bookworm (push) Has been cancelled
Build Debian packages / bullseye (push) Has been cancelled
Build Debian packages / trixie (push) Has been cancelled
Build on FreeBSD / with UPnP (push) Has been cancelled
Build on OSX / With USE_UPNP=no (push) Has been cancelled
Build on OSX / With USE_UPNP=yes (push) Has been cancelled
Build on Windows / clang-x86_64 (push) Has been cancelled
Build on Windows / i686 (push) Has been cancelled
Build on Windows / ucrt-x86_64 (push) Has been cancelled
Build on Windows / x86_64 (push) Has been cancelled
Build on Windows / CMake clang-x86_64 (push) Has been cancelled
Build on Windows / CMake i686 (push) Has been cancelled
Build on Windows / CMake ucrt-x86_64 (push) Has been cancelled
Build on Windows / CMake x86_64 (push) Has been cancelled
Build on Windows / XP (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=no (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=yes (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Has been cancelled
Build containers / Building container for linux/amd64 (push) Has been cancelled
Build containers / Building container for linux/arm/v7 (push) Has been cancelled
Build containers / Building container for linux/386 (push) Has been cancelled
Build containers / Pushing merged manifest (push) Has been cancelled
Some checks failed
Build containers / Building container for linux/arm64 (push) Has been cancelled
Build Debian packages / bookworm (push) Has been cancelled
Build Debian packages / bullseye (push) Has been cancelled
Build Debian packages / trixie (push) Has been cancelled
Build on FreeBSD / with UPnP (push) Has been cancelled
Build on OSX / With USE_UPNP=no (push) Has been cancelled
Build on OSX / With USE_UPNP=yes (push) Has been cancelled
Build on Windows / clang-x86_64 (push) Has been cancelled
Build on Windows / i686 (push) Has been cancelled
Build on Windows / ucrt-x86_64 (push) Has been cancelled
Build on Windows / x86_64 (push) Has been cancelled
Build on Windows / CMake clang-x86_64 (push) Has been cancelled
Build on Windows / CMake i686 (push) Has been cancelled
Build on Windows / CMake ucrt-x86_64 (push) Has been cancelled
Build on Windows / CMake x86_64 (push) Has been cancelled
Build on Windows / XP (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=no (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=yes (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Has been cancelled
Build containers / Building container for linux/amd64 (push) Has been cancelled
Build containers / Building container for linux/arm/v7 (push) Has been cancelled
Build containers / Building container for linux/386 (push) Has been cancelled
Build containers / Pushing merged manifest (push) Has been cancelled
This commit is contained in:
parent
20ba95ee52
commit
9276042078
1 changed files with 9 additions and 1 deletions
|
@ -1225,7 +1225,6 @@ namespace stream
|
||||||
htobe16buf (packet + size, flags);
|
htobe16buf (packet + size, flags);
|
||||||
size += 2; // flags
|
size += 2; // flags
|
||||||
size_t identityLen = m_LocalDestination.GetOwner ()->GetIdentity ()->GetFullLen ();
|
size_t identityLen = m_LocalDestination.GetOwner ()->GetIdentity ()->GetFullLen ();
|
||||||
size_t signatureLen = m_LocalDestination.GetOwner ()->GetPrivateKeys ().GetSignatureLen ();
|
|
||||||
uint8_t * optionsSize = packet + size; // set options size later
|
uint8_t * optionsSize = packet + size; // set options size later
|
||||||
size += 2; // options size
|
size += 2; // options size
|
||||||
m_LocalDestination.GetOwner ()->GetIdentity ()->ToBuffer (packet + size, identityLen);
|
m_LocalDestination.GetOwner ()->GetIdentity ()->ToBuffer (packet + size, identityLen);
|
||||||
|
@ -1240,6 +1239,7 @@ namespace stream
|
||||||
memcpy (packet + size, offlineSignature.data (), offlineSignature.size ());
|
memcpy (packet + size, offlineSignature.data (), offlineSignature.size ());
|
||||||
size += offlineSignature.size (); // offline signature
|
size += offlineSignature.size (); // offline signature
|
||||||
}
|
}
|
||||||
|
size_t signatureLen = m_LocalDestination.GetOwner ()->GetPrivateKeys ().GetSignatureLen ();
|
||||||
uint8_t * signature = packet + size; // set it later
|
uint8_t * signature = packet + size; // set it later
|
||||||
memset (signature, 0, signatureLen); // zeroes for now
|
memset (signature, 0, signatureLen); // zeroes for now
|
||||||
size += signatureLen; // signature
|
size += signatureLen; // signature
|
||||||
|
@ -1301,6 +1301,8 @@ namespace stream
|
||||||
size++; // resend delay
|
size++; // resend delay
|
||||||
uint16_t flags = PACKET_FLAG_CLOSE;
|
uint16_t flags = PACKET_FLAG_CLOSE;
|
||||||
if (!m_DontSign) flags |= PACKET_FLAG_SIGNATURE_INCLUDED;
|
if (!m_DontSign) flags |= PACKET_FLAG_SIGNATURE_INCLUDED;
|
||||||
|
bool isOfflineSignature = m_LocalDestination.GetOwner ()->GetPrivateKeys ().IsOfflineSignature ();
|
||||||
|
if (isOfflineSignature) flags |= PACKET_FLAG_OFFLINE_SIGNATURE;
|
||||||
htobe16buf (packet + size, flags);
|
htobe16buf (packet + size, flags);
|
||||||
size += 2; // flags
|
size += 2; // flags
|
||||||
if (m_DontSign)
|
if (m_DontSign)
|
||||||
|
@ -1310,6 +1312,12 @@ namespace stream
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (isOfflineSignature)
|
||||||
|
{
|
||||||
|
const auto& offlineSignature = m_LocalDestination.GetOwner ()->GetPrivateKeys ().GetOfflineSignature ();
|
||||||
|
memcpy (packet + size, offlineSignature.data (), offlineSignature.size ());
|
||||||
|
size += offlineSignature.size (); // offline signature
|
||||||
|
}
|
||||||
size_t signatureLen = m_LocalDestination.GetOwner ()->GetPrivateKeys ().GetSignatureLen ();
|
size_t signatureLen = m_LocalDestination.GetOwner ()->GetPrivateKeys ().GetSignatureLen ();
|
||||||
htobe16buf (packet + size, signatureLen); // signature only
|
htobe16buf (packet + size, signatureLen); // signature only
|
||||||
size += 2; // options size
|
size += 2; // options size
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue