mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-26 17:03:43 +02:00
docs
This commit is contained in:
parent
7fa60b10a3
commit
32145fbe8d
1 changed files with 6 additions and 6 deletions
|
@ -113,24 +113,24 @@ fn try_aead_decrypt(secret: &SymmetricSecret, packet_frag0_payload_bytes: &[u8],
|
||||||
}
|
}
|
||||||
|
|
||||||
security_constants::CIPHER_AES_GMAC_SIV => {
|
security_constants::CIPHER_AES_GMAC_SIV => {
|
||||||
let mut aes = secret.aes_gmac_siv.get();
|
let mut aes_gmac_siv = secret.aes_gmac_siv.get();
|
||||||
aes.decrypt_init(&packet_header.aes_gmac_siv_tag());
|
aes_gmac_siv.decrypt_init(&packet_header.aes_gmac_siv_tag());
|
||||||
aes.decrypt_set_aad(&packet_header.aad_bytes());
|
aes_gmac_siv.decrypt_set_aad(&packet_header.aad_bytes());
|
||||||
|
|
||||||
if let Ok(b) = payload.append_bytes_get_mut(packet_frag0_payload_bytes.len()) {
|
if let Ok(b) = payload.append_bytes_get_mut(packet_frag0_payload_bytes.len()) {
|
||||||
aes.decrypt(packet_frag0_payload_bytes, b);
|
aes_gmac_siv.decrypt(packet_frag0_payload_bytes, b);
|
||||||
}
|
}
|
||||||
for f in fragments.iter() {
|
for f in fragments.iter() {
|
||||||
if let Some(f) = f.as_ref() {
|
if let Some(f) = f.as_ref() {
|
||||||
if let Ok(f) = f.as_bytes_starting_at(packet_constants::FRAGMENT_HEADER_SIZE) {
|
if let Ok(f) = f.as_bytes_starting_at(packet_constants::FRAGMENT_HEADER_SIZE) {
|
||||||
if let Ok(b) = payload.append_bytes_get_mut(f.len()) {
|
if let Ok(b) = payload.append_bytes_get_mut(f.len()) {
|
||||||
aes.decrypt(f, b);
|
aes_gmac_siv.decrypt(f, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(tag) = aes.decrypt_finish() {
|
if let Some(tag) = aes_gmac_siv.decrypt_finish() {
|
||||||
// AES-GMAC-SIV encrypts the packet ID too as part of its computation of a single
|
// AES-GMAC-SIV encrypts the packet ID too as part of its computation of a single
|
||||||
// opaque 128-bit tag, so to get the original packet ID we have to grab it from the
|
// opaque 128-bit tag, so to get the original packet ID we have to grab it from the
|
||||||
// decrypted tag.
|
// decrypted tag.
|
||||||
|
|
Loading…
Add table
Reference in a new issue