QSC Post Quantum Cryptographic Library 1.3.0.0 (C1)
A post quantum secure library written in Ansi C
Loading...
Searching...
No Matches
tlstranscript.h File Reference

TLS 1.3 transcript-hash helpers. More...

#include "qsccommon.h"
#include "tlsstate.h"
#include "tlserrors.h"

Go to the source code of this file.

Functions

QSC_EXPORT_API qsc_tls_status qsc_tls_transcript_initialize (qsc_tls_transcript_state *state, qsc_tls_hash_algorithm hash)
 Initialize a transcript hash state.
QSC_EXPORT_API void qsc_tls_transcript_dispose (qsc_tls_transcript_state *state)
 Dispose of a transcript hash state.
QSC_EXPORT_API qsc_tls_status qsc_tls_transcript_update (qsc_tls_transcript_state *state, const uint8_t *input, size_t inplen)
 Append serialized handshake bytes to the transcript hash.
QSC_EXPORT_API qsc_tls_status qsc_tls_transcript_snapshot (const qsc_tls_transcript_state *state, uint8_t *output, size_t outlen, size_t *written)
 Snapshot the current transcript digest without disturbing the ongoing hash state.
QSC_EXPORT_API qsc_tls_status qsc_tls_transcript_replace_with_message_hash (qsc_tls_transcript_state *state)
 Replace the transcript with the synthetic message_hash form used after HelloRetryRequest.
QSC_EXPORT_API size_t qsc_tls_transcript_digest_size (qsc_tls_hash_algorithm hash)
 Get the digest size in bytes for a TLS transcript hash algorithm.

Detailed Description

TLS 1.3 transcript-hash helpers.

This header exposes the transcript hashing helpers used by the TLS 1.3 handshake layer. The transcript state stores an incremental hash context selected by the negotiated cipher suite hash. Callers update the transcript with serialized handshake bytes and may request digest snapshots without disturbing the active hash state.

Function Documentation

◆ qsc_tls_transcript_digest_size()

QSC_EXPORT_API size_t qsc_tls_transcript_digest_size ( qsc_tls_hash_algorithm hash)

Get the digest size in bytes for a TLS transcript hash algorithm.

Parameters
hash[enum] The transcript hash algorithm.
Returns
[size_t] Returns the digest size in bytes, or zero if the algorithm is unsupported.

◆ qsc_tls_transcript_dispose()

QSC_EXPORT_API void qsc_tls_transcript_dispose ( qsc_tls_transcript_state * state)

Dispose of a transcript hash state.

Securely erases the active transcript state and any retained intermediate hash context.

Parameters
state[struct*] The transcript state to clear.

◆ qsc_tls_transcript_initialize()

QSC_EXPORT_API qsc_tls_status qsc_tls_transcript_initialize ( qsc_tls_transcript_state * state,
qsc_tls_hash_algorithm hash )

Initialize a transcript hash state.

Parameters
state[struct*] The transcript state to initialize.
hash[enum] The hash algorithm to activate.
Returns
[qsc_tls_status] Returns qsc_tls_status_success on success.

◆ qsc_tls_transcript_replace_with_message_hash()

QSC_EXPORT_API qsc_tls_status qsc_tls_transcript_replace_with_message_hash ( qsc_tls_transcript_state * state)

Replace the transcript with the synthetic message_hash form used after HelloRetryRequest.

Replaces the current transcript contents with the synthetic handshake message defined by RFC 8446 Section 4.4.1, consisting of the message_hash handshake type and the digest of the previous ClientHello.

Parameters
state[struct*] The active transcript state.
Returns
[qsc_tls_status] Returns qsc_tls_status_success on success.

◆ qsc_tls_transcript_snapshot()

QSC_EXPORT_API qsc_tls_status qsc_tls_transcript_snapshot ( const qsc_tls_transcript_state * state,
uint8_t * output,
size_t outlen,
size_t * written )

Snapshot the current transcript digest without disturbing the ongoing hash state.

Clones the underlying hash context, finalizes the clone into the caller-supplied output buffer, and leaves the live transcript state unchanged.

Parameters
state[const struct*] The active transcript state.
output[uint8_t*] The destination buffer for the transcript digest.
outlen[size_t] The destination buffer length in bytes.
written[size_t*] Receives the number of digest bytes written.
Returns
[qsc_tls_status] Returns qsc_tls_status_success on success.

◆ qsc_tls_transcript_update()

QSC_EXPORT_API qsc_tls_status qsc_tls_transcript_update ( qsc_tls_transcript_state * state,
const uint8_t * input,
size_t inplen )

Append serialized handshake bytes to the transcript hash.

Parameters
state[struct*] The active transcript state.
input[const uint8_t*] The serialized handshake bytes to append.
inplen[size_t] The number of bytes to append.
Returns
[qsc_tls_status] Returns qsc_tls_status_success on success.