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 L3G_EXTERN:
|
||||
case NANOPAN: {
|
||||
printf("[%s] line: %d\n", __FUNCTION__, __LINE__);
|
||||
FIO0CLR = SSP0_SELN;
|
||||
break;
|
||||
}
|
||||
|
@ -64,16 +64,6 @@ extern "C" {
|
||||
#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
|
||||
*/
|
||||
|
@ -40,6 +40,9 @@
|
||||
#include "crypto/3des.h"
|
||||
#include "crypto/ciphers.h"
|
||||
|
||||
#define ENABLE_DEBUG (0)
|
||||
#include "debug.h"
|
||||
|
||||
/*************** GLOBALS ******************/
|
||||
/**
|
||||
* @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];
|
||||
|
||||
if (!key) {
|
||||
printf("%-40s: [ERROR] Could NOT malloc space for the des3_key_s \
|
||||
struct.\r\n", __FUNCTION__);
|
||||
DEBUGF("[ERROR] Could NOT malloc space for the des3_key_s struct.\r\n");
|
||||
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);
|
||||
|
||||
if (res < 0) {
|
||||
printf("%-40s: [ERROR] des3_key_setup failed with Code %i\r\n",
|
||||
__FUNCTION__, res);
|
||||
DEBUGF("[ERROR] des3_key_setup failed with Code %i\r\n", res);
|
||||
free(key);
|
||||
return -2;
|
||||
}
|
||||
@ -317,8 +318,7 @@ int tripledes_decrypt(const cipher_context_t *context, const uint8_t *crypt, uin
|
||||
uint32_t work[2];
|
||||
|
||||
if (!key) {
|
||||
printf("%-40s: [ERROR] Could NOT malloc space for the des3_key_s \
|
||||
struct.\r\n", __FUNCTION__);
|
||||
DEBUGF("[ERROR] Could NOT malloc space for the des3_key_s struct.\r\n");
|
||||
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);
|
||||
|
||||
if (res < 0) {
|
||||
printf("%-40s: [ERROR] des3_key_setup failed with Code %i\r\n",
|
||||
__FUNCTION__, res);
|
||||
DEBUGF("[ERROR] des3_key_setup failed with Code %i\r\n", res);
|
||||
free(key);
|
||||
return -2;
|
||||
}
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include "crypto/twofish.h"
|
||||
#include "crypto/ciphers.h"
|
||||
|
||||
#define ENABLE_DEBUG (0)
|
||||
#include "debug.h"
|
||||
|
||||
//prototype
|
||||
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. */
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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));
|
||||
|
||||
if (!ctx) {
|
||||
printf("%-40s: [ERROR] Could NOT malloc space for the twofish_context_t \
|
||||
struct.\r\n", __FUNCTION__);
|
||||
DEBUGF("[ERROR] Could NOT malloc space for the twofish_context_t \
|
||||
struct.\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
res = twofish_setup_key(ctx, context->context, TWOFISH_KEY_SIZE);
|
||||
|
||||
if (res < 0) {
|
||||
printf("%-40s: [ERROR] twofish_setKey failed with Code %i\r\n",
|
||||
__FUNCTION__, res);
|
||||
DEBUGF("[ERROR] twofish_setKey failed with Code %i\r\n", res);
|
||||
free(ctx);
|
||||
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));
|
||||
|
||||
if (!ctx) {
|
||||
printf("%-40s: [ERROR] Could NOT malloc space for the twofish_context_t \
|
||||
struct.\r\n", __FUNCTION__);
|
||||
DEBUGF("[ERROR] Could NOT malloc space for the twofish_context_t \
|
||||
struct.\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
res = twofish_setup_key(ctx, context->context, TWOFISH_KEY_SIZE);
|
||||
|
||||
if (res < 0) {
|
||||
printf("%-40s: [ERROR] twofish_setKey failed with Code %i\r\n",
|
||||
__FUNCTION__, res);
|
||||
DEBUGF("[ERROR] twofish_setKey failed with Code %i\r\n", res);
|
||||
free(ctx);
|
||||
return -2;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user