MCPcopy Create free account
hub / github.com/DNSCrypt/encrypted-dns-server / control_block

Function control_block

src/pq.rs:276–284  ·  view source on GitHub ↗

Build the response control block that carries a freshly issued ticket.

(ticket_lifetime: u32, ticket: &[u8])

Source from the content-addressed store, hash-verified

274
275/// Build the response control block that carries a freshly issued ticket.
276pub fn control_block(ticket_lifetime: u32, ticket: &[u8]) -> Vec<u8> {
277 let mut c = Vec::with_capacity(4 + 1 + 4 + 2 + ticket.len());
278 c.extend_from_slice(&PQ_CONTROL_MAGIC);
279 c.push(PQ_CONTROL_VERSION);
280 c.extend_from_slice(&ticket_lifetime.to_be_bytes());
281 c.extend_from_slice(&(ticket.len() as u16).to_be_bytes());
282 c.extend_from_slice(ticket);
283 c
284}
285
286/// ISO/IEC 7816-4 padding to the next multiple of 64, with a minimum floor
287/// (itself a multiple of 64). Always appends at least the `0x80` marker.

Callers 2

appendix3_vectorsFunction · 0.85
decrypt_pq_ciphertextFunction · 0.85

Calls

no outgoing calls

Tested by 1

appendix3_vectorsFunction · 0.68