altos: Note changes to configured AES key for SPI radio convenience
authorKeith Packard <keithp@keithp.com>
Wed, 29 Aug 2012 18:19:17 +0000 (11:19 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 29 Aug 2012 18:19:17 +0000 (11:19 -0700)
Keep a sequence number to mark when the AES key is changed so that the
radio code can avoid sending the key before every CMAC radio operation.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/core/ao.h
src/core/ao_config.c

index b8bedd85ee212b7749076d6b4239831a3e4dc00f..66c0881f7862cb01a949c4e8d1cca9be5d0da804 100644 (file)
@@ -718,6 +718,8 @@ extern __xdata uint8_t ao_force_freq;
 
 #define AO_AES_LEN 16
 
 
 #define AO_AES_LEN 16
 
+extern __xdata uint8_t ao_config_aes_seq;
+
 struct ao_config {
        uint8_t         major;
        uint8_t         minor;
 struct ao_config {
        uint8_t         major;
        uint8_t         minor;
index f19dd9cd8d198b6f0724119afa5bdeebfb0b882d..ce855ad1b51e1dcfdd6afb8d2d455fe45528e2d9 100644 (file)
@@ -463,6 +463,9 @@ ao_config_radio_enable_set(void) __reentrant
 #endif /* HAS_RADIO */
        
 #if HAS_AES
 #endif /* HAS_RADIO */
        
 #if HAS_AES
+
+__xdata uint8_t        ao_config_aes_seq = 1;
+
 void
 ao_config_key_show(void) __reentrant
 {
 void
 ao_config_key_show(void) __reentrant
 {
@@ -485,6 +488,7 @@ ao_config_key_set(void) __reentrant
                        break;
                ao_config.aes_key[i] = ao_cmd_lex_i;
        }
                        break;
                ao_config.aes_key[i] = ao_cmd_lex_i;
        }
+       ++ao_config_aes_seq;
        _ao_config_edit_finish();
 }
 #endif
        _ao_config_edit_finish();
 }
 #endif