![]() |
The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Code common to EAP-SIM/AKA/AKA' clients and servers. More...
#include <freeradius-devel/io/test_point.h>#include <freeradius-devel/server/module.h>#include <freeradius-devel/tls/strerror.h>#include <freeradius-devel/util/debug.h>#include <freeradius-devel/util/sha1.h>#include <freeradius-devel/util/decode.h>#include <freeradius-devel/eap/types.h>#include "attrs.h"#include "base.h"#include "crypto_priv.h"
Include dependency graph for decode.c:Go to the source code of this file.
Functions | |
| static int | _test_ctx_free (UNUSED fr_aka_sim_ctx_t *ctx) |
| static int | decode_test_ctx_aka (void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict, UNUSED fr_dict_attr_t const *root_da) |
| static int | decode_test_ctx_sim (void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict, UNUSED fr_dict_attr_t const *root_da) |
| static int | decode_test_ctx_sim_rfc4186 (void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict, UNUSED fr_dict_attr_t const *root_da) |
| int | fr_aka_sim_decode (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_t const *dict, uint8_t const *data, size_t data_len, fr_aka_sim_ctx_t *decode_ctx) |
| Decode SIM/AKA/AKA' specific packet data. | |
| ssize_t | fr_aka_sim_decode_pair (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, uint8_t const *data, size_t data_len, void *decode_ctx) |
| Decode SIM/AKA/AKA' attributes. | |
| static int | sim_array_members (size_t *out, size_t len, fr_dict_attr_t const *da) |
| Returns the number of array members for arrays with fixed element sizes. | |
| static ssize_t | sim_decode_array (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, uint8_t const *data, size_t const attr_len, UNUSED size_t data_len, void *decode_ctx) |
| static ssize_t | sim_decode_pair_internal (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, uint8_t const *data, size_t data_len, void *decode_ctx) |
| Decode SIM/AKA/AKA' attributes. | |
| static ssize_t | sim_decode_pair_value (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, uint8_t const *data, size_t const attr_len, size_t const data_len, void *decode_ctx) |
| Create any kind of VP from the attribute contents. | |
| static ssize_t | sim_decode_tlv (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, uint8_t const *data, size_t const attr_len, size_t data_len, void *decode_ctx) |
| Break apart a TLV attribute into individual attributes. | |
| static int | sim_iv_extract (uint8_t out[AKA_SIM_IV_SIZE], uint8_t const *in, size_t in_len) |
| Extract the IV value from an AT_IV attribute. | |
| static ssize_t | sim_value_decrypt (TALLOC_CTX *ctx, uint8_t **out, uint8_t const *data, size_t const attr_len, size_t const data_len, void *decode_ctx) |
| Decrypt an AES-128-CBC encrypted attribute. | |
| static fr_aka_sim_ctx_t * | test_ctx_init (TALLOC_CTX *ctx, uint8_t const *k_encr, size_t k_encr_len) |
Variables | |
| fr_test_point_pair_decode_t | aka_tp_decode |
| fr_test_point_pair_decode_t | sim_tp_decode |
| fr_test_point_pair_decode_t | sim_tp_decode_rfc4186 |
Code common to EAP-SIM/AKA/AKA' clients and servers.
The development of the EAP-SIM support was funded by Internet Foundation Austria (http://www.nic.at/ipa).
Definition in file decode.c.
|
static |
|
static |
|
static |
|
static |
| int fr_aka_sim_decode | ( | TALLOC_CTX * | ctx, |
| fr_pair_list_t * | out, | ||
| fr_dict_t const * | dict, | ||
| uint8_t const * | data, | ||
| size_t | data_len, | ||
| fr_aka_sim_ctx_t * | decode_ctx | ||
| ) |
Decode SIM/AKA/AKA' specific packet data.
Extracts the SUBTYPE and adds it an attribute, then decodes any TLVs in the SIM/AKA/AKA' packet.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Code | Identifier | Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Subtype | Reserved | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
The first byte of the data pointer should be the subtype.
| [in] | ctx | where to allocate the pairs. |
| [in] | out | where to write out attributes. |
| [in] | dict | for looking up attributes. |
| [in] | data | to convert to pairs. |
| [in] | data_len | length of data to convert. |
| [in] | decode_ctx | holds the state of the decoder. |
Definition at line 942 of file decode.c.
Here is the call graph for this function:
Here is the caller graph for this function:| ssize_t fr_aka_sim_decode_pair | ( | TALLOC_CTX * | ctx, |
| fr_pair_list_t * | out, | ||
| fr_dict_attr_t const * | parent, | ||
| uint8_t const * | data, | ||
| size_t | data_len, | ||
| void * | decode_ctx | ||
| ) |
Decode SIM/AKA/AKA' attributes.
| [in] | ctx | to allocate attributes in. |
| [in] | out | where to insert the attributes. |
| [in] | parent | for looking up attributes. |
| [in] | data | data to parse. |
| [in] | data_len | length of data. For top level attributes packet_ctx must be the length of the packet (so we can hunt for AT_IV), for Sub-TLVs it should be the length of the container value. |
| [in] | decode_ctx | extra context to pass to the decoder. |
Definition at line 909 of file decode.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Returns the number of array members for arrays with fixed element sizes.
| [out] | out | The element length. |
| [in] | len | the total length of the array. |
| [in] | da | the specifying the array type. |
Definition at line 250 of file decode.c.
Here is the caller graph for this function:
|
static |
|
static |
Decode SIM/AKA/AKA' attributes.
| [in] | ctx | to allocate attributes in. |
| [in] | out | where to insert the attributes. |
| [in] | parent | of current attribute being decoded. |
| [in] | data | data to parse. |
| [in] | data_len | length of data. For top level attributes packet_ctx must be the length of the packet (so we can hunt for AT_IV), for Sub-TLVs it should be the length of the container value. |
| [in] | decode_ctx | extra context to pass to the decoder. |
Definition at line 831 of file decode.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Create any kind of VP from the attribute contents.
| [in] | ctx | to allocate new attributes in. |
| [in] | out | to add new attributes to. |
| [in] | parent | the current attribute we're processing. |
| [in] | data | to parse. Points to the data field of the attribute. |
| [in] | attr_len | length of the attribute being parsed. |
| [in] | data_len | length of the remaining data in the packet. |
| [in] | decode_ctx | IVs, keys etc... |
Definition at line 525 of file decode.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Break apart a TLV attribute into individual attributes.
| [in] | ctx | to allocate new attributes in. |
| [in] | out | to add new attributes to. |
| [in] | parent | the current attribute TLV attribute we're processing. |
| [in] | data | to parse. Points to the data field of the attribute. |
| [in] | attr_len | length of the TLV attribute. |
| [in] | data_len | remaining data in the packet. |
| [in] | decode_ctx | IVs, keys etc... |
Definition at line 368 of file decode.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestatic |
Extract the IV value from an AT_IV attribute.
SIM uses padding at the start of the attribute to make it a multiple of 4. We need to strip packet_ctx and check that it was set to zero.
| [out] | out | Where to write IV. |
| [in] | in | value of AT_IV attribute. |
| [in] | in_len | the length of the AT_IV attribute (should be 18). |
Definition at line 79 of file decode.c.
Here is the caller graph for this function:
|
static |
Decrypt an AES-128-CBC encrypted attribute.
| [in] | ctx | to allocate decr buffer in. |
| [out] | out | where to write pointer to decr buffer. |
| [in] | data | to decrypt. |
| [in] | attr_len | length of encrypted data. |
| [in] | data_len | length of data remaining in the packet. |
| [in] | decode_ctx | containing keys, and the IV (if we already found it). |
Definition at line 115 of file decode.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
| fr_test_point_pair_decode_t aka_tp_decode |
| fr_test_point_pair_decode_t sim_tp_decode |
| fr_test_point_pair_decode_t sim_tp_decode_rfc4186 |
1.9.8