mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
commit
1e2fd34d1e
@ -293,7 +293,6 @@ unsigned char SSP0_write(const uint16_t data, uint8_t device)
|
|||||||
case BMA180_EXTERN:
|
case BMA180_EXTERN:
|
||||||
case L3G_EXTERN:
|
case L3G_EXTERN:
|
||||||
case NANOPAN: {
|
case NANOPAN: {
|
||||||
printf("[%s] line: %d\n", __FUNCTION__, __LINE__);
|
|
||||||
FIO0CLR = SSP0_SELN;
|
FIO0CLR = SSP0_SELN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -64,16 +64,6 @@ extern "C" {
|
|||||||
#define LED_RED_TOGGLE /* not available */
|
#define LED_RED_TOGGLE /* not available */
|
||||||
/* @} */
|
/* @} */
|
||||||
|
|
||||||
/**
|
|
||||||
* @name Macros defined for quick debugging purposes.
|
|
||||||
* @{
|
|
||||||
*/
|
|
||||||
#define TRACE printf("TRACE %s:%d: %s\n", __FILE__, __LINE__, __FUNCTION__)
|
|
||||||
#define VAL_I(x) printf(#x ": %d\n",x);
|
|
||||||
#define VAL_X(x) printf(#x ":0x%X\n", (unsigned int)x);
|
|
||||||
#define VAL_S(x) printf(#x ":%s\n", x);
|
|
||||||
/* @} */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
||||||
*/
|
*/
|
||||||
|
@ -40,6 +40,9 @@
|
|||||||
#include "crypto/3des.h"
|
#include "crypto/3des.h"
|
||||||
#include "crypto/ciphers.h"
|
#include "crypto/ciphers.h"
|
||||||
|
|
||||||
|
#define ENABLE_DEBUG (0)
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
/*************** GLOBALS ******************/
|
/*************** GLOBALS ******************/
|
||||||
/**
|
/**
|
||||||
* @brief Interface to the 3DES cipher
|
* @brief Interface to the 3DES cipher
|
||||||
@ -282,8 +285,7 @@ int tripledes_encrypt(const cipher_context_t *context, const uint8_t *plain, uin
|
|||||||
uint32_t work[2];
|
uint32_t work[2];
|
||||||
|
|
||||||
if (!key) {
|
if (!key) {
|
||||||
printf("%-40s: [ERROR] Could NOT malloc space for the des3_key_s \
|
DEBUGF("[ERROR] Could NOT malloc space for the des3_key_s struct.\r\n");
|
||||||
struct.\r\n", __FUNCTION__);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,8 +293,7 @@ int tripledes_encrypt(const cipher_context_t *context, const uint8_t *plain, uin
|
|||||||
res = des3_key_setup(context->context, key);
|
res = des3_key_setup(context->context, key);
|
||||||
|
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
printf("%-40s: [ERROR] des3_key_setup failed with Code %i\r\n",
|
DEBUGF("[ERROR] des3_key_setup failed with Code %i\r\n", res);
|
||||||
__FUNCTION__, res);
|
|
||||||
free(key);
|
free(key);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@ -317,8 +318,7 @@ int tripledes_decrypt(const cipher_context_t *context, const uint8_t *crypt, uin
|
|||||||
uint32_t work[2];
|
uint32_t work[2];
|
||||||
|
|
||||||
if (!key) {
|
if (!key) {
|
||||||
printf("%-40s: [ERROR] Could NOT malloc space for the des3_key_s \
|
DEBUGF("[ERROR] Could NOT malloc space for the des3_key_s struct.\r\n");
|
||||||
struct.\r\n", __FUNCTION__);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,8 +326,7 @@ int tripledes_decrypt(const cipher_context_t *context, const uint8_t *crypt, uin
|
|||||||
res = des3_key_setup(context->context, key);
|
res = des3_key_setup(context->context, key);
|
||||||
|
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
printf("%-40s: [ERROR] des3_key_setup failed with Code %i\r\n",
|
DEBUGF("[ERROR] des3_key_setup failed with Code %i\r\n", res);
|
||||||
__FUNCTION__, res);
|
|
||||||
free(key);
|
free(key);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
#include "crypto/twofish.h"
|
#include "crypto/twofish.h"
|
||||||
#include "crypto/ciphers.h"
|
#include "crypto/ciphers.h"
|
||||||
|
|
||||||
|
#define ENABLE_DEBUG (0)
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
//prototype
|
//prototype
|
||||||
static int twofish_setup_key(twofish_context_t *ctx, const uint8_t *key, uint8_t keylen);
|
static int twofish_setup_key(twofish_context_t *ctx, const uint8_t *key, uint8_t keylen);
|
||||||
@ -538,7 +540,7 @@ static int twofish_setup_key(twofish_context_t *ctx, const uint8_t *key, uint8_t
|
|||||||
|
|
||||||
/* Check key length. */
|
/* Check key length. */
|
||||||
if (((keylen - 16) | 16) != 16) {
|
if (((keylen - 16) | 16) != 16) {
|
||||||
printf("%-40s: [ERROR] invalid key-length!\r\n", __FUNCTION__);
|
DEBUGF("[ERROR] invalid key-length!\r\n");
|
||||||
return -1;//GPG_ERR_INV_KEYLEN;
|
return -1;//GPG_ERR_INV_KEYLEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,16 +660,15 @@ int twofish_encrypt(const cipher_context_t *context, const uint8_t *in, uint8_t
|
|||||||
twofish_context_t *ctx = malloc(sizeof(twofish_context_t));
|
twofish_context_t *ctx = malloc(sizeof(twofish_context_t));
|
||||||
|
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
printf("%-40s: [ERROR] Could NOT malloc space for the twofish_context_t \
|
DEBUGF("[ERROR] Could NOT malloc space for the twofish_context_t \
|
||||||
struct.\r\n", __FUNCTION__);
|
struct.\r\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = twofish_setup_key(ctx, context->context, TWOFISH_KEY_SIZE);
|
res = twofish_setup_key(ctx, context->context, TWOFISH_KEY_SIZE);
|
||||||
|
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
printf("%-40s: [ERROR] twofish_setKey failed with Code %i\r\n",
|
DEBUGF("[ERROR] twofish_setKey failed with Code %i\r\n", res);
|
||||||
__FUNCTION__, res);
|
|
||||||
free(ctx);
|
free(ctx);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@ -715,16 +716,15 @@ int twofish_decrypt(const cipher_context_t *context, const uint8_t *in, uint8_t
|
|||||||
twofish_context_t *ctx = malloc(sizeof(twofish_context_t));
|
twofish_context_t *ctx = malloc(sizeof(twofish_context_t));
|
||||||
|
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
printf("%-40s: [ERROR] Could NOT malloc space for the twofish_context_t \
|
DEBUGF("[ERROR] Could NOT malloc space for the twofish_context_t \
|
||||||
struct.\r\n", __FUNCTION__);
|
struct.\r\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = twofish_setup_key(ctx, context->context, TWOFISH_KEY_SIZE);
|
res = twofish_setup_key(ctx, context->context, TWOFISH_KEY_SIZE);
|
||||||
|
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
printf("%-40s: [ERROR] twofish_setKey failed with Code %i\r\n",
|
DEBUGF("[ERROR] twofish_setKey failed with Code %i\r\n", res);
|
||||||
__FUNCTION__, res);
|
|
||||||
free(ctx);
|
free(ctx);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user