Build the response control block that carries a freshly issued ticket.
(ticket_lifetime: u32, ticket: &[u8])
| 274 | |
| 275 | /// Build the response control block that carries a freshly issued ticket. |
| 276 | pub 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. |
no outgoing calls