mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-28 21:19:24 +01:00
dpp-util: add DPP attribute iteration APIs
This commit is contained in:
parent
c511e4be2a
commit
669a92607c
@ -95,6 +95,40 @@ char *dpp_generate_uri(const uint8_t *asn1, size_t asn1_len, uint8_t version,
|
||||
return l_string_unwrap(uri);
|
||||
}
|
||||
|
||||
void dpp_attr_iter_init(struct dpp_attr_iter *iter, const uint8_t *pdu,
|
||||
size_t len)
|
||||
{
|
||||
iter->pos = pdu;
|
||||
iter->end = pdu + len;
|
||||
}
|
||||
|
||||
bool dpp_attr_iter_next(struct dpp_attr_iter *iter,
|
||||
enum dpp_attribute_type *type_out, size_t *len_out,
|
||||
const uint8_t **data_out)
|
||||
{
|
||||
enum dpp_attribute_type type;
|
||||
size_t len;
|
||||
|
||||
if (iter->pos + 4 > iter->end)
|
||||
return false;
|
||||
|
||||
type = l_get_le16(iter->pos);
|
||||
len = l_get_le16(iter->pos + 2);
|
||||
|
||||
iter->pos += 4;
|
||||
|
||||
if (iter->pos + len > iter->end)
|
||||
return false;
|
||||
|
||||
*type_out = type;
|
||||
*len_out = len;
|
||||
*data_out = iter->pos;
|
||||
|
||||
iter->pos += len;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* EasyConnect 2.0 Table 3. Key and Nonce Length Dependency on Prime Length
|
||||
*/
|
||||
|
@ -22,6 +22,55 @@
|
||||
struct l_ecc_point;
|
||||
struct l_ecc_scalar;
|
||||
|
||||
enum dpp_attribute_type {
|
||||
/* 0000 - 0FFF reserved */
|
||||
DPP_ATTR_STATUS = 0x1000,
|
||||
DPP_ATTR_INITIATOR_BOOT_KEY_HASH = 0x1001,
|
||||
DPP_ATTR_RESPONDER_BOOT_KEY_HASH = 0x1002,
|
||||
DPP_ATTR_INITIATOR_PROTOCOL_KEY = 0x1003,
|
||||
DPP_ATTR_WRAPPED_DATA = 0x1004,
|
||||
DPP_ATTR_INITIATOR_NONCE = 0x1005,
|
||||
DPP_ATTR_INITIATOR_CAPABILITIES = 0x1006,
|
||||
DPP_ATTR_RESPONDER_NONCE = 0x1007,
|
||||
DPP_ATTR_RESPONDER_CAPABILITIES = 0x1008,
|
||||
DPP_ATTR_RESPONDER_PROTOCOL_KEY = 0x1009,
|
||||
DPP_ATTR_INITIATOR_AUTH_TAG = 0x100a,
|
||||
DPP_ATTR_RESPONDER_AUTH_TAG = 0x100b,
|
||||
DPP_ATTR_CONFIGURATION_OBJECT = 0x100c,
|
||||
DPP_ATTR_CONNECTOR = 0x100d,
|
||||
DPP_ATTR_CONFIGURATION_REQUEST = 0x100e,
|
||||
DPP_ATTR_BOOTSTRAPPING_KEY = 0x100f,
|
||||
/* 1010 - 1011 reserved */
|
||||
DPP_ATTR_FINITE_CYCLIC_GROUP = 0x1012,
|
||||
DPP_ATTR_ENCRYPTED_KEY = 0x1013,
|
||||
DPP_ATTR_ENROLLEE_NONCE = 0x1014,
|
||||
DPP_ATTR_CODE_IDENTIFIER = 0x1015,
|
||||
DPP_ATTR_TRANSACTION_ID = 0x1016,
|
||||
DPP_ATTR_BOOTSTRAPPING_INFO = 0x1017,
|
||||
DPP_ATTR_CHANNEL = 0x1018,
|
||||
DPP_ATTR_PROTOCOL_VERSION = 0x1019,
|
||||
DPP_ATTR_ENVELOPED_DATA = 0x101a,
|
||||
DPP_ATTR_SEND_CONN_STATUS = 0x101b,
|
||||
DPP_ATTR_CONN_STATUS = 0x101c,
|
||||
DPP_ATTR_RECONFIGURATION_FLAGS = 0x101d,
|
||||
DPP_ATTR_C_SIGN_KEY_HASH = 0x101e,
|
||||
DPP_ATTR_CSR_ATTRIBUTES_REQUEST = 0x101f,
|
||||
DPP_ATTR_ANONCE = 0x1020,
|
||||
DPP_ATTR_EID = 0x1021,
|
||||
DPP_ATTR_CONFIGURATOR_NONCE = 0x1022,
|
||||
};
|
||||
|
||||
struct dpp_attr_iter {
|
||||
const uint8_t *pos;
|
||||
const uint8_t *end;
|
||||
};
|
||||
|
||||
void dpp_attr_iter_init(struct dpp_attr_iter *iter, const uint8_t *pdu,
|
||||
size_t len);
|
||||
bool dpp_attr_iter_next(struct dpp_attr_iter *iter,
|
||||
enum dpp_attribute_type *type, size_t *len,
|
||||
const uint8_t **data);
|
||||
|
||||
char *dpp_generate_uri(const uint8_t *asn1, size_t asn1_len, uint8_t version,
|
||||
const uint8_t *mac, const uint32_t *freqs,
|
||||
size_t freqs_len, const char *info, const char *host);
|
||||
|
Loading…
Reference in New Issue
Block a user