1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) 2019-2026, Argenox Technologies LLC
// All rights reserved.
//
// SPDX-License-Identifier: GPL-2.0-only OR LicenseRef-Argenox-Commercial-License
//
// This file is part of the NoxTLS Library.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by the
// Free Software Foundation; version 2 of the License.
//
// Alternatively, this file may be used under the terms of a commercial
// license from Argenox Technologies LLC.
//
// See `noxtls/LICENSE` and `noxtls/LICENSE.md` in this repository for full details.
// CONTACT: info@argenox.com
use crateVec;
use ;
/// Encodes one TLS handshake message with a 1-byte type, 3-byte big-endian length, and payload body.
///
/// # Arguments
///
/// * `handshake_type` — TLS `HandshakeType` wire value for this message.
/// * `body` — Handshake message body bytes; length must fit in 24 bits.
///
/// # Returns
///
/// Owned buffer containing `handshake_type || len[3] || body`.
///
/// # Panics
///
/// This function does not panic.
/// Parses a TLS handshake message prefix and returns the type and body slice.
///
/// # Arguments
///
/// * `input` — Full handshake message bytes including the 4-byte header and body.
///
/// # Returns
///
/// On success, `(handshake_type, body)` where `body` borrows from `input`.
///
/// # Errors
///
/// Returns [`Error::ParseFailure`] when the buffer is shorter than four bytes or the declared length does not match the buffer size.
///
/// # Panics
///
/// This function does not panic.