diff options
author | Patrick McHardy <kaber@trash.net> | 2010-08-05 00:19:53 +0200 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2010-08-05 10:42:15 +0200 |
commit | 766807cf0e9a7d4359145c6b73369bd6f9c5298c (patch) | |
tree | 29e415e9a6ffd8e346c03ecd3131e90570a009ce | |
parent | a32f8ab727e11737fb92dcf7a598df90e1e6f6c4 (diff) |
ie: add support for default cipher key index reception and transmission
Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r-- | include/dect/ie.h | 1 | ||||
-rw-r--r-- | src/s_msg.c | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/dect/ie.h b/include/dect/ie.h index 35eb528..a1cae97 100644 --- a/include/dect/ie.h +++ b/include/dect/ie.h @@ -488,6 +488,7 @@ struct dect_ie_auth_type { uint8_t auth_key_num; uint8_t flags; uint8_t cipher_key_num; + uint16_t defck_index; }; /** diff --git a/src/s_msg.c b/src/s_msg.c index 00b53bb..a874095 100644 --- a/src/s_msg.c +++ b/src/s_msg.c @@ -737,6 +737,9 @@ static void dect_sfmt_dump_auth_type(const struct dect_ie_common *_ie) ie->flags & DECT_AUTH_FLAG_DEF ? 1 : 0, ie->flags & DECT_AUTH_FLAG_TXC ? 1 : 0, ie->flags & DECT_AUTH_FLAG_UPC ? 1 : 0); + if (ie->flags & DECT_AUTH_FLAG_DEF) + sfmt_debug("\tdefault cipher key index: %u\n", + ie->defck_index); } static int dect_sfmt_parse_auth_type(const struct dect_handle *dh, @@ -756,6 +759,13 @@ static int dect_sfmt_parse_auth_type(const struct dect_handle *dh, dst->flags = src->data[n] & 0xf0; dst->cipher_key_num = src->data[n] & 0x0f; + n++; + + /* Octets 5a and 5b are only present if the DEF flag is set */ + if (dst->flags & DECT_AUTH_FLAG_DEF) + dst->defck_index = src->data[n] << 8 | + src->data[n + 1]; + return 0; } @@ -777,6 +787,12 @@ static int dect_sfmt_build_auth_type(struct dect_sfmt_ie *dst, dst->data[n] |= src->cipher_key_num; n++; + /* Octets 5a and 5b are only present if the DEF flag is set */ + if (src->flags & DECT_AUTH_FLAG_DEF) { + dst->data[n++] = src->defck_index >> 8; + dst->data[n++] = src->defck_index; + } + dst->len = n; return 0; } |