diff options
Diffstat (limited to 'src/utils.h')
| -rw-r--r-- | src/utils.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h new file mode 100644 index 0000000..58c8955 --- /dev/null +++ b/src/utils.h @@ -0,0 +1,43 @@ +/** + * utils.h + * + * Created on 2020-11-27 + * @author: qyc + * + * @explain: + */ +#ifndef UTILS_H +#define UTILS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "glib.h" + +/* + * Decodes a variable-length integer used in QUIC protocol + * See https://tools.ietf.org/html/draft-ietf-quic-transport-08#section-8.1 + */ +#define ENC_VARINT_QUIC 0x00000004 + +/* Explicit and implicit nonce length (RFC 5116 - Section 3.2.1) */ +#define TLS13_AEAD_NONCE_LENGTH 12 + + +/* XXX Should we use GByteArray instead? */ +typedef struct _StringInfo { + // Backing storage which may be larger than data_len + guchar *data; + // Length of the meaningful part of data + guint data_len; +} StringInfo; + +gboolean tls13_hkdf_expand_label(int md, const StringInfo *secret, const char *label_prefix, const char *label, guint16 out_len, guchar **out); +guint tvb_get_varint(const char *tvb, guint offset, guint maxlen, guint64 *value, const guint encoding); + +#ifdef __cplusplus +} +#endif + +#endif //UTILS_H |
