Skip to content

Commit

Permalink
Merge commit '6ca95ebc0c63fde42745ededbca09beddd41d8fa' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and [email protected] committed Nov 8, 2014
2 parents 37f2705 + 6ca95eb commit b1aaba5
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion core/net/ipv6/sicslowpan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,7 @@ input(void)

sicslowpan_len = frag_size;
reass_tag = frag_tag;
timer_set(&reass_timer, SICSLOWPAN_REASS_MAXAGE * CLOCK_SECOND / 16);
timer_set(&reass_timer, SICSLOWPAN_REASS_MAXAGE * CLOCK_SECOND);
PRINTFI("sicslowpan input: INIT FRAGMENTATION (len %d, tag %d)\n",
sicslowpan_len, reass_tag);
linkaddr_copy(&frag_sender, packetbuf_addr(PACKETBUF_ADDR_SENDER));
Expand Down
10 changes: 5 additions & 5 deletions core/net/llsec/ccm.c → core/net/llsec/ccm-star.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* Konrad Krentz <[email protected]>
*/

#include "net/llsec/ccm.h"
#include "net/llsec/ccm-star.h"
#include "net/llsec/llsec802154.h"
#include "net/packetbuf.h"
#include "lib/aes-128.h"
Expand Down Expand Up @@ -80,7 +80,7 @@ ctr_step(const uint8_t *extended_source_address,
uint8_t a[AES_128_BLOCK_SIZE];
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);

for(i = 0; (pos + i < m_len) && (i < AES_128_BLOCK_SIZE); i++) {
Expand Down Expand Up @@ -112,13 +112,13 @@ mic(const uint8_t *extended_source_address,
m_len = 0;
}
set_nonce(x,
CCM_AUTH_FLAGS(a_len, mic_len),
CCM_STAR_AUTH_FLAGS(a_len, mic_len),
extended_source_address,
m_len);
#else /* LLSEC802154_USES_ENCRYPTION */
a_len = packetbuf_totlen();
set_nonce(x,
CCM_AUTH_FLAGS(a_len, mic_len),
CCM_STAR_AUTH_FLAGS(a_len, mic_len),
extended_source_address,
0);
#endif /* LLSEC802154_USES_ENCRYPTION */
Expand Down Expand Up @@ -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,
ctr
};
Expand Down
26 changes: 13 additions & 13 deletions core/net/llsec/ccm.h → core/net/llsec/ccm-star.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,26 @@
* Konrad Krentz <[email protected]>
*/

#ifndef CCM_H_
#define CCM_H_
#ifndef CCM_STAR_H_
#define CCM_STAR_H_

#include "contiki.h"
#include "net/mac/frame802154.h"

/* see RFC 3610 */
#define CCM_AUTH_FLAGS(Adata, M) ((Adata ? (1 << 6) : 0) | (((M - 2) >> 1) << 3) | 1)
#define CCM_ENCRYPTION_FLAGS 1
#define CCM_STAR_AUTH_FLAGS(Adata, M) ((Adata ? (1 << 6) : 0) | (((M - 2) >> 1) << 3) | 1)
#define CCM_STAR_ENCRYPTION_FLAGS 1

#ifdef CCM_CONF
#define CCM CCM_CONF
#else /* CCM_CONF */
#define CCM ccm_driver
#endif /* CCM_CONF */
#ifdef CCM_STAR_CONF
#define CCM_STAR CCM_STAR_CONF
#else /* CCM_STAR_CONF */
#define CCM_STAR ccm_star_driver
#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.
Expand All @@ -78,8 +78,8 @@ struct ccm_driver {
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_ */

/** @} */
10 changes: 5 additions & 5 deletions core/net/llsec/noncoresec/noncoresec.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include "net/llsec/noncoresec/noncoresec.h"
#include "net/llsec/anti-replay.h"
#include "net/llsec/llsec802154.h"
#include "net/llsec/ccm.h"
#include "net/llsec/ccm-star.h"
#include "net/mac/frame802154.h"
#include "net/netstack.h"
#include "net/packetbuf.h"
Expand Down Expand Up @@ -116,9 +116,9 @@ on_frame_created(void)
dataptr = packetbuf_dataptr();
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
CCM.ctr(get_extended_address(&linkaddr_node_addr));
CCM_STAR.ctr(get_extended_address(&linkaddr_node_addr));
#endif /* WITH_ENCRYPTION */
packetbuf_set_datalen(data_len + LLSEC802154_MIC_LENGTH);

Expand Down Expand Up @@ -146,9 +146,9 @@ input(void)
packetbuf_set_datalen(packetbuf_datalen() - LLSEC802154_MIC_LENGTH);

#if WITH_ENCRYPTION
CCM.ctr(get_extended_address(sender));
CCM_STAR.ctr(get_extended_address(sender));
#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();
if(memcmp(generated_mic, received_mic, LLSEC802154_MIC_LENGTH) != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "net/packetbuf.h"
#include "net/netstack.h"
#include "net/llsec/llsec802154.h"
#include "net/llsec/ccm.h"
#include "net/llsec/ccm-star.h"
#include "net/mac/frame802154.h"
#include "lib/aes-128.h"
#include <stdio.h>
Expand Down Expand Up @@ -87,7 +87,7 @@ test_sec_lvl_6()
packetbuf_hdrreduce(29);

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) {
printf("Success\n");
Expand All @@ -97,26 +97,26 @@ test_sec_lvl_6()

printf("Testing encryption ... ");

CCM.ctr(extended_source_address);
CCM_STAR.ctr(extended_source_address);
if(((uint8_t *) packetbuf_hdrptr())[29] == 0xD8) {
printf("Success\n");
} else {
printf("Failure\n");
}

printf("Testing decryption ... ");
CCM.ctr(extended_source_address);
CCM_STAR.ctr(extended_source_address);
if(((uint8_t *) packetbuf_hdrptr())[29] == 0xCE) {
printf("Success\n");
} else {
printf("Failure\n");
}
}
/*---------------------------------------------------------------------------*/
PROCESS(ccm_encryption_tests_process, "CCM* encryption tests process");
AUTOSTART_PROCESSES(&ccm_encryption_tests_process);
PROCESS(ccm_star_tests_process, "CCM* 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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "net/packetbuf.h"
#include "net/netstack.h"
#include "net/llsec/llsec802154.h"
#include "net/llsec/ccm.h"
#include "net/llsec/ccm-star.h"
#include "net/mac/frame802154.h"
#include "lib/aes-128.h"
#include <stdio.h>
Expand Down Expand Up @@ -113,7 +113,7 @@ test_sec_lvl_2()
packetbuf_hdrreduce(18);

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) {
printf("Success\n");
Expand All @@ -122,10 +122,10 @@ test_sec_lvl_2()
}
}
/*---------------------------------------------------------------------------*/
PROCESS(ccm_verification_tests_process, "CCM* verification tests process");
AUTOSTART_PROCESSES(&ccm_verification_tests_process);
PROCESS(ccm_star_tests_process, "CCM* 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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
org.contikios.cooja.contikimote.ContikiMoteType
<identifier>mtype139</identifier>
<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>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
Expand All @@ -49,7 +49,7 @@
org.contikios.cooja.contikimote.ContikiMoteType
<identifier>mtype792</identifier>
<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>
<moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
<moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
Expand Down Expand Up @@ -153,7 +153,7 @@
<plugin>
org.contikios.cooja.plugins.Notes
<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>
</plugin_config>
<width>1240</width>
Expand Down
File renamed without changes.

0 comments on commit b1aaba5

Please sign in to comment.