matter_pase.c
PASE message codec over Matter TLV.
Overview
PASE message codec over Matter TLV.
depends on matter_pase.h matter_tlv.h
API
Fstatic int ctx_tag(const struct matter_tlv_reader *r)
Context tag number of the loaded element, or -1 if it is not a context tag.
decode_one, matter_pase_pake2_decode, matter_pase_pbkdf_req_decode, matter_pase_pbkdf_resp_decode, read_pbkdf_params, read_session_paramsFstatic int get_fixed(const struct matter_tlv_reader *r, uint8_t *dst, size_t want)
Copy a byte string that must be exactly @p want long.
decode_one, matter_pase_pake2_decode, matter_pase_pbkdf_req_decode, matter_pase_pbkdf_resp_decodeFstatic int read_session_params(struct matter_tlv_reader *r, struct matter_session_params *out)
Read a session-parameters structure the reader is currently sitting on.
matter_pase_pbkdf_req_decode, matter_pase_pbkdf_resp_decode · calls ctx_tagFstatic int open_message(struct matter_tlv_reader *r, const uint8_t *buf, size_t len)
Open the outer anonymous structure every PASE message is wrapped in.
decode_one, matter_pase_pake2_decode, matter_pase_pbkdf_req_decode, matter_pase_pbkdf_resp_decodeFint matter_pase_pbkdf_req_decode(const uint8_t *buf, size_t len, struct matter_pase_pbkdf_req *out)
Decode a PBKDF request message; extracts initiator random, session ID, and optional PBKDF parameters; returns MATTER_E_STATE if required fields are missing and MATTER_E_INVAL if passcode ID is not 0.
ctx_tag, get_fixed, open_message, read_session_paramsFint matter_pase_pbkdf_req_encode(const struct matter_pase_pbkdf_req *r, uint8_t *buf, size_t cap, size_t *written)
Encode a PBKDF request message with initiator random, session ID, optional passcode and session parameters.
Fstatic int read_pbkdf_params(struct matter_tlv_reader *r, struct matter_pase_pbkdf_resp *out)
Decode a PBKDF parameters structure from the reader's current position; extracts iteration count and salt, validating that iteration count is within the minimum and maximum allowed range; returns MATTER_E_STATE if either field is missing.
matter_pase_pbkdf_resp_decode · calls ctx_tagFint matter_pase_pbkdf_resp_decode(const uint8_t *buf, size_t len, struct matter_pase_pbkdf_resp *out)
Decode a PBKDF response message: extract initiator and responder randomness, responder session ID, PBKDF parameters, and session parameters. Require all three random and session ID fields.
ctx_tag, get_fixed, open_message, read_pbkdf_params, read_session_paramsFint matter_pase_pbkdf_resp_encode(const struct matter_pase_pbkdf_resp *r, uint8_t *buf, size_t cap, size_t *written)
Encode a PBKDF response message with responder random, session ID, and optional PBKDF parameters (salt and iteration count); validates that salt and iteration counts are within allowed ranges if present.
Fstatic int decode_one(const uint8_t *buf, size_t len, unsigned int tag, uint8_t *dst, size_t want)
Decode a single context-tagged field from a PASE message; scans the entire message for the given tag and copies its fixed-length value to dst, returning MATTER_E_STATE if the tag is not found.
matter_pase_pake1_decode, matter_pase_pake3_decode · calls ctx_tag, get_fixed, open_messageFint matter_pase_pake1_decode(const uint8_t *buf, size_t len, struct matter_pase_pake1 *out)
Decode the initiator's P_A point from a PASE Pake1 message.
decode_oneFint matter_pase_pake1_encode(const struct matter_pase_pake1 *r, uint8_t *buf, size_t cap, size_t *written)
Encode a PAKE1 message containing the initiator's ephemeral public point.
Fint matter_pase_pake2_decode(const uint8_t *buf, size_t len, struct matter_pase_pake2 *out)
Decode a PAKE2 message containing the responder's ephemeral public point and confirmation hash; returns MATTER_E_STATE if either field is missing.
ctx_tag, get_fixed, open_messageFint matter_pase_pake2_encode(const struct matter_pase_pake2 *r, uint8_t *buf, size_t cap, size_t *written)
Encode a PAKE2 message containing the responder's ephemeral public point and confirmation hash.
Fint matter_pase_pake3_decode(const uint8_t *buf, size_t len, struct matter_pase_pake3 *out)
Decode the committer's C_A hash from a PASE Pake3 message.
decode_oneFint matter_pase_pake3_encode(const struct matter_pase_pake3 *r, uint8_t *buf, size_t cap, size_t *written)
Encode a PAKE3 message containing the initiator's confirmation hash.