Merge pull request #811 from kkrentz/llsec-renaming

llsec renaming
This commit is contained in:
Nicolas Tsiftes 2014-11-07 22:20:15 +01:00
commit 6ca95ebc0c
11 changed files with 38 additions and 38 deletions

View File

@ -42,7 +42,7 @@
* Konrad Krentz <konrad.krentz@gmail.com> * Konrad Krentz <konrad.krentz@gmail.com>
*/ */
#include "net/llsec/ccm.h" #include "net/llsec/ccm-star.h"
#include "net/llsec/llsec802154.h" #include "net/llsec/llsec802154.h"
#include "net/packetbuf.h" #include "net/packetbuf.h"
#include "lib/aes-128.h" #include "lib/aes-128.h"
@ -80,7 +80,7 @@ ctr_step(const uint8_t *extended_source_address,
uint8_t a[AES_128_BLOCK_SIZE]; uint8_t a[AES_128_BLOCK_SIZE];
uint8_t i; uint8_t i;
set_nonce(a, CCM_ENCRYPTION_FLAGS, extended_source_address, counter); set_nonce(a, CCM_STAR_ENCRYPTION_FLAGS, extended_source_address, counter);
AES_128.encrypt(a); AES_128.encrypt(a);
for(i = 0; (pos + i < m_len) && (i < AES_128_BLOCK_SIZE); i++) { for(i = 0; (pos + i < m_len) && (i < AES_128_BLOCK_SIZE); i++) {
@ -112,13 +112,13 @@ mic(const uint8_t *extended_source_address,
m_len = 0; m_len = 0;
} }
set_nonce(x, set_nonce(x,
CCM_AUTH_FLAGS(a_len, mic_len), CCM_STAR_AUTH_FLAGS(a_len, mic_len),
extended_source_address, extended_source_address,
m_len); m_len);
#else /* LLSEC802154_USES_ENCRYPTION */ #else /* LLSEC802154_USES_ENCRYPTION */
a_len = packetbuf_totlen(); a_len = packetbuf_totlen();
set_nonce(x, set_nonce(x,
CCM_AUTH_FLAGS(a_len, mic_len), CCM_STAR_AUTH_FLAGS(a_len, mic_len),
extended_source_address, extended_source_address,
0); 0);
#endif /* LLSEC802154_USES_ENCRYPTION */ #endif /* LLSEC802154_USES_ENCRYPTION */
@ -181,7 +181,7 @@ ctr(const uint8_t *extended_source_address)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
const struct ccm_driver ccm_driver = { const struct ccm_star_driver ccm_star_driver = {
mic, mic,
ctr ctr
}; };

View File

@ -42,26 +42,26 @@
* Konrad Krentz <konrad.krentz@gmail.com> * Konrad Krentz <konrad.krentz@gmail.com>
*/ */
#ifndef CCM_H_ #ifndef CCM_STAR_H_
#define CCM_H_ #define CCM_STAR_H_
#include "contiki.h" #include "contiki.h"
#include "net/mac/frame802154.h" #include "net/mac/frame802154.h"
/* see RFC 3610 */ /* see RFC 3610 */
#define CCM_AUTH_FLAGS(Adata, M) ((Adata ? (1 << 6) : 0) | (((M - 2) >> 1) << 3) | 1) #define CCM_STAR_AUTH_FLAGS(Adata, M) ((Adata ? (1 << 6) : 0) | (((M - 2) >> 1) << 3) | 1)
#define CCM_ENCRYPTION_FLAGS 1 #define CCM_STAR_ENCRYPTION_FLAGS 1
#ifdef CCM_CONF #ifdef CCM_STAR_CONF
#define CCM CCM_CONF #define CCM_STAR CCM_STAR_CONF
#else /* CCM_CONF */ #else /* CCM_STAR_CONF */
#define CCM ccm_driver #define CCM_STAR ccm_star_driver
#endif /* CCM_CONF */ #endif /* CCM_STAR_CONF */
/** /**
* Structure of CCM drivers. * Structure of CCM* drivers.
*/ */
struct ccm_driver { struct ccm_star_driver {
/** /**
* \brief Generates a MIC over the frame in the packetbuf. * \brief Generates a MIC over the frame in the packetbuf.
@ -78,8 +78,8 @@ struct ccm_driver {
void (* ctr)(const uint8_t *extended_source_address); void (* ctr)(const uint8_t *extended_source_address);
}; };
extern const struct ccm_driver CCM; extern const struct ccm_star_driver CCM_STAR;
#endif /* CCM_H_ */ #endif /* CCM_STAR_H_ */
/** @} */ /** @} */

View File

@ -45,7 +45,7 @@
#include "net/llsec/noncoresec/noncoresec.h" #include "net/llsec/noncoresec/noncoresec.h"
#include "net/llsec/anti-replay.h" #include "net/llsec/anti-replay.h"
#include "net/llsec/llsec802154.h" #include "net/llsec/llsec802154.h"
#include "net/llsec/ccm.h" #include "net/llsec/ccm-star.h"
#include "net/mac/frame802154.h" #include "net/mac/frame802154.h"
#include "net/netstack.h" #include "net/netstack.h"
#include "net/packetbuf.h" #include "net/packetbuf.h"
@ -116,9 +116,9 @@ on_frame_created(void)
dataptr = packetbuf_dataptr(); dataptr = packetbuf_dataptr();
data_len = packetbuf_datalen(); data_len = packetbuf_datalen();
CCM.mic(get_extended_address(&linkaddr_node_addr), dataptr + data_len, LLSEC802154_MIC_LENGTH); CCM_STAR.mic(get_extended_address(&linkaddr_node_addr), dataptr + data_len, LLSEC802154_MIC_LENGTH);
#if WITH_ENCRYPTION #if WITH_ENCRYPTION
CCM.ctr(get_extended_address(&linkaddr_node_addr)); CCM_STAR.ctr(get_extended_address(&linkaddr_node_addr));
#endif /* WITH_ENCRYPTION */ #endif /* WITH_ENCRYPTION */
packetbuf_set_datalen(data_len + LLSEC802154_MIC_LENGTH); packetbuf_set_datalen(data_len + LLSEC802154_MIC_LENGTH);
@ -146,9 +146,9 @@ input(void)
packetbuf_set_datalen(packetbuf_datalen() - LLSEC802154_MIC_LENGTH); packetbuf_set_datalen(packetbuf_datalen() - LLSEC802154_MIC_LENGTH);
#if WITH_ENCRYPTION #if WITH_ENCRYPTION
CCM.ctr(get_extended_address(sender)); CCM_STAR.ctr(get_extended_address(sender));
#endif /* WITH_ENCRYPTION */ #endif /* WITH_ENCRYPTION */
CCM.mic(get_extended_address(sender), generated_mic, LLSEC802154_MIC_LENGTH); CCM_STAR.mic(get_extended_address(sender), generated_mic, LLSEC802154_MIC_LENGTH);
received_mic = ((uint8_t *) packetbuf_dataptr()) + packetbuf_datalen(); received_mic = ((uint8_t *) packetbuf_dataptr()) + packetbuf_datalen();
if(memcmp(generated_mic, received_mic, LLSEC802154_MIC_LENGTH) != 0) { if(memcmp(generated_mic, received_mic, LLSEC802154_MIC_LENGTH) != 0) {

View File

@ -41,7 +41,7 @@
#include "net/packetbuf.h" #include "net/packetbuf.h"
#include "net/netstack.h" #include "net/netstack.h"
#include "net/llsec/llsec802154.h" #include "net/llsec/llsec802154.h"
#include "net/llsec/ccm.h" #include "net/llsec/ccm-star.h"
#include "net/mac/frame802154.h" #include "net/mac/frame802154.h"
#include "lib/aes-128.h" #include "lib/aes-128.h"
#include <stdio.h> #include <stdio.h>
@ -87,7 +87,7 @@ test_sec_lvl_6()
packetbuf_hdrreduce(29); packetbuf_hdrreduce(29);
AES_128.set_key(key); AES_128.set_key(key);
CCM.mic(extended_source_address, mic, LLSEC802154_MIC_LENGTH); CCM_STAR.mic(extended_source_address, mic, LLSEC802154_MIC_LENGTH);
if(memcmp(mic, oracle, LLSEC802154_MIC_LENGTH) == 0) { if(memcmp(mic, oracle, LLSEC802154_MIC_LENGTH) == 0) {
printf("Success\n"); printf("Success\n");
@ -97,7 +97,7 @@ test_sec_lvl_6()
printf("Testing encryption ... "); printf("Testing encryption ... ");
CCM.ctr(extended_source_address); CCM_STAR.ctr(extended_source_address);
if(((uint8_t *) packetbuf_hdrptr())[29] == 0xD8) { if(((uint8_t *) packetbuf_hdrptr())[29] == 0xD8) {
printf("Success\n"); printf("Success\n");
} else { } else {
@ -105,7 +105,7 @@ test_sec_lvl_6()
} }
printf("Testing decryption ... "); printf("Testing decryption ... ");
CCM.ctr(extended_source_address); CCM_STAR.ctr(extended_source_address);
if(((uint8_t *) packetbuf_hdrptr())[29] == 0xCE) { if(((uint8_t *) packetbuf_hdrptr())[29] == 0xCE) {
printf("Success\n"); printf("Success\n");
} else { } else {
@ -113,10 +113,10 @@ test_sec_lvl_6()
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS(ccm_encryption_tests_process, "CCM* encryption tests process"); PROCESS(ccm_star_tests_process, "CCM* tests process");
AUTOSTART_PROCESSES(&ccm_encryption_tests_process); AUTOSTART_PROCESSES(&ccm_star_tests_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS_THREAD(ccm_encryption_tests_process, ev, data) PROCESS_THREAD(ccm_star_tests_process, ev, data)
{ {
PROCESS_BEGIN(); PROCESS_BEGIN();

View File

@ -41,7 +41,7 @@
#include "net/packetbuf.h" #include "net/packetbuf.h"
#include "net/netstack.h" #include "net/netstack.h"
#include "net/llsec/llsec802154.h" #include "net/llsec/llsec802154.h"
#include "net/llsec/ccm.h" #include "net/llsec/ccm-star.h"
#include "net/mac/frame802154.h" #include "net/mac/frame802154.h"
#include "lib/aes-128.h" #include "lib/aes-128.h"
#include <stdio.h> #include <stdio.h>
@ -113,7 +113,7 @@ test_sec_lvl_2()
packetbuf_hdrreduce(18); packetbuf_hdrreduce(18);
AES_128.set_key(key); AES_128.set_key(key);
CCM.mic(extended_source_address, mic, LLSEC802154_MIC_LENGTH); CCM_STAR.mic(extended_source_address, mic, LLSEC802154_MIC_LENGTH);
if(memcmp(mic, oracle, LLSEC802154_MIC_LENGTH) == 0) { if(memcmp(mic, oracle, LLSEC802154_MIC_LENGTH) == 0) {
printf("Success\n"); printf("Success\n");
@ -122,10 +122,10 @@ test_sec_lvl_2()
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS(ccm_verification_tests_process, "CCM* verification tests process"); PROCESS(ccm_star_tests_process, "CCM* tests process");
AUTOSTART_PROCESSES(&ccm_verification_tests_process); AUTOSTART_PROCESSES(&ccm_star_tests_process);
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
PROCESS_THREAD(ccm_verification_tests_process, ev, data) PROCESS_THREAD(ccm_star_tests_process, ev, data)
{ {
PROCESS_BEGIN(); PROCESS_BEGIN();

View File

@ -24,7 +24,7 @@
org.contikios.cooja.contikimote.ContikiMoteType org.contikios.cooja.contikimote.ContikiMoteType
<identifier>mtype139</identifier> <identifier>mtype139</identifier>
<description>Verification</description> <description>Verification</description>
<source>[CONTIKI_DIR]/examples/llsec/ccm-tests/verification/tests.c</source> <source>[CONTIKI_DIR]/examples/llsec/ccm-star-tests/verification/tests.c</source>
<commands>make tests.cooja TARGET=cooja</commands> <commands>make tests.cooja TARGET=cooja</commands>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface> <moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface> <moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
@ -49,7 +49,7 @@
org.contikios.cooja.contikimote.ContikiMoteType org.contikios.cooja.contikimote.ContikiMoteType
<identifier>mtype792</identifier> <identifier>mtype792</identifier>
<description>Encryption</description> <description>Encryption</description>
<source>[CONTIKI_DIR]/examples/llsec/ccm-tests/encryption/tests.c</source> <source>[CONTIKI_DIR]/examples/llsec/ccm-star-tests/encryption/tests.c</source>
<commands>make tests.cooja TARGET=cooja</commands> <commands>make tests.cooja TARGET=cooja</commands>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface> <moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface> <moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
@ -153,7 +153,7 @@
<plugin> <plugin>
org.contikios.cooja.plugins.Notes org.contikios.cooja.plugins.Notes
<plugin_config> <plugin_config>
<notes>A simple test script that runs the tests in examples/llsec/ccm-tests/</notes> <notes>A simple test script that runs the tests in examples/llsec/ccm-star-tests/</notes>
<decorations>true</decorations> <decorations>true</decorations>
</plugin_config> </plugin_config>
<width>1240</width> <width>1240</width>