ieee802154_security: adapt to Kconfig
This commit is contained in:
parent
d09ca43a84
commit
93759a747b
@ -101,17 +101,14 @@ struct ieee802154_sec_dev {
|
|||||||
void *ctx;
|
void *ctx;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !defined(IEEE802154_SEC_DEFAULT_KEY) || defined(DOXYGEN)
|
#if !defined(CONFIG_IEEE802154_SEC_DEFAULT_KEY) || defined(DOXYGEN)
|
||||||
/**
|
/**
|
||||||
* @brief AES key that is used in the test vectors from the specification
|
* @brief AES default key
|
||||||
*
|
*
|
||||||
* @note Predefine it yourself,
|
* @note Predefine it yourself,
|
||||||
* if you want another key to be set up on initialization
|
* if you want another key to be set up on initialization
|
||||||
*/
|
*/
|
||||||
#define IEEE802154_SEC_DEFAULT_KEY { 0xc0, 0xc1, 0xc2, 0xc3, \
|
#define CONFIG_IEEE802154_SEC_DEFAULT_KEY "pizza_margherita"
|
||||||
0xc4, 0xc5, 0xc6, 0xc7, \
|
|
||||||
0xc8, 0xc9, 0xca, 0xcb, \
|
|
||||||
0xcc, 0xcd, 0xce, 0xcf }
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -401,7 +401,8 @@ void ieee802154_sec_init(ieee802154_sec_context_t *ctx)
|
|||||||
memset(ctx->key_source, 0, sizeof(ctx->key_source));
|
memset(ctx->key_source, 0, sizeof(ctx->key_source));
|
||||||
ctx->key_index = 0;
|
ctx->key_index = 0;
|
||||||
ctx->frame_counter = 0;
|
ctx->frame_counter = 0;
|
||||||
uint8_t key[] = IEEE802154_SEC_DEFAULT_KEY;
|
uint8_t key[] = CONFIG_IEEE802154_SEC_DEFAULT_KEY;
|
||||||
|
assert(sizeof(key) >= IEEE802154_SEC_KEY_LENGTH);
|
||||||
assert(CIPHER_MAX_CONTEXT_SIZE >= IEEE802154_SEC_KEY_LENGTH);
|
assert(CIPHER_MAX_CONTEXT_SIZE >= IEEE802154_SEC_KEY_LENGTH);
|
||||||
cipher_init(&ctx->cipher, CIPHER_AES, key, IEEE802154_SEC_KEY_LENGTH);
|
cipher_init(&ctx->cipher, CIPHER_AES, key, IEEE802154_SEC_KEY_LENGTH);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user