Skip to content

Commit

Permalink
sys: replace DEBUGF with corresponding DEBUG calls
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegHahm committed Sep 19, 2015
1 parent 2841a08 commit fac9580
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 22 deletions.
12 changes: 8 additions & 4 deletions sys/crypto/3des.c
Expand Up @@ -285,15 +285,17 @@ int tripledes_encrypt(const cipher_context_t *context, const uint8_t *plain, uin
uint32_t work[2];

if (!key) {
DEBUGF("[ERROR] Could NOT malloc space for the des3_key_s struct.\r\n");
DEBUG("%s:%d in %s: [ERROR] Could NOT malloc space for the des3_key_s struct.\r\n",
RIOT_FILE_RELATIVE, __LINE__, DEBUG_FUNC);
return -1;
}

memset(key, 0, sizeof(des3_key_s));
res = des3_key_setup(context->context, key);

if (res < 0) {
DEBUGF("[ERROR] des3_key_setup failed with Code %i\r\n", res);
DEBUG("%s:%d in %s: [ERROR] des3_key_setup failed with Code %i\r\n",
RIOT_FILE_RELATIVE, __LINE__, DEBUG_FUNC, res);
free(key);
return -2;
}
Expand All @@ -318,15 +320,17 @@ int tripledes_decrypt(const cipher_context_t *context, const uint8_t *crypt, uin
uint32_t work[2];

if (!key) {
DEBUGF("[ERROR] Could NOT malloc space for the des3_key_s struct.\r\n");
DEBUG("%s:%d in %s: [ERROR] Could NOT malloc space for the des3_key_s struct.\r\n",
__FILE__, __LINE__, DEBUG_FUNC);
return -1;
}

memset(key, 0, sizeof(des3_key_s));
res = des3_key_setup(context->context, key);

if (res < 0) {
DEBUGF("[ERROR] des3_key_setup failed with Code %i\r\n", res);
DEBUG("%s:%d in %s: [ERROR] des3_key_setup failed with Code %i\r\n",
__FILE__, __LINE__, DEBUG_FUNC, res);
free(key);
return -2;
}
Expand Down
19 changes: 11 additions & 8 deletions sys/crypto/twofish.c
Expand Up @@ -540,8 +540,9 @@ static int twofish_setup_key(twofish_context_t *ctx, const uint8_t *key, uint8_t

/* Check key length. */
if (((keylen - 16) | 16) != 16) {
DEBUGF("[ERROR] invalid key-length!\r\n");
return -1;//GPG_ERR_INV_KEYLEN;
DEBUG("%s:%d in %s: [ERROR] invalid key-length!\r\n", RIOT_FILE_RELATIVE,
__LINE__, DEBUG_FUNC);
return -1;
}


Expand Down Expand Up @@ -660,15 +661,16 @@ 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) {
DEBUGF("[ERROR] Could NOT malloc space for the twofish_context_t \
struct.\r\n");
DEBUG("%s:%d in %s: [ERROR] Could NOT malloc space for the twofish_context_t \
struct.\r\n", RIOT_FILE_RELATIVE, __LINE__, DEBUG_FUNC);
return -1;
}

res = twofish_setup_key(ctx, context->context, TWOFISH_KEY_SIZE);

if (res < 0) {
DEBUGF("[ERROR] twofish_setKey failed with Code %i\r\n", res);
DEBUG("%s:%d in %s: [ERROR] twofish_setKey failed with Code %i\r\n",
RIOT_FILE_RELATIVE, __LINE__, DEBUG_FUNC, res);
free(ctx);
return -2;
}
Expand Down Expand Up @@ -716,15 +718,16 @@ 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) {
DEBUGF("[ERROR] Could NOT malloc space for the twofish_context_t \
struct.\r\n");
DEBUG("%s:%d in %s: [ERROR] Could NOT malloc space for the twofish_context_t \
struct.\r\n", RIOT_FILE_RELATIVE, __LINE__, DEBUG_FUNC);
return -1;
}

res = twofish_setup_key(ctx, context->context, TWOFISH_KEY_SIZE);

if (res < 0) {
DEBUGF("[ERROR] twofish_setKey failed with Code %i\r\n", res);
DEBUG("%s:%d in %s: [ERROR] twofish_setKey failed with Code %i\r\n",
RIOT_FILE_RELATIVE, __LINE__, DEBUG_FUNC, res);
free(ctx);
return -2;
}
Expand Down
15 changes: 8 additions & 7 deletions sys/net/routing/nhdp/iib_table.c
Expand Up @@ -194,7 +194,8 @@ void iib_fill_wr_addresses(kernel_pid_t if_pid, struct rfc5444_writer *wr)

default:
/* Should not happen */
DEBUGF("[WARNING] Unknown link tuple status\n");
DEBUG("%s:%d in %s: [WARNING] Unknown link tuple status\n",
__FILE__, __LINE__, DEBUG_FUNC);
break;
}
}
Expand Down Expand Up @@ -260,8 +261,8 @@ void iib_process_metric_msg(iib_link_set_entry_t *ls_entry, uint64_t int_time)
/* NHDP_METRIC is not set properly */
(void)ls_entry;
(void)int_time;
DEBUGF("[WARNING] Unknown NHDP_METRIC setting\n");
#endif
DEBUG("%s:%d in %s: [WARNING] Unknown NHDP_METRIC setting\n", __FILE__,
__LINE__, DEBUG_FUNC); #endif
}

void iib_process_metric_pckt(iib_link_set_entry_t *ls_entry, uint32_t metric_out, uint16_t seq_no)
Expand Down Expand Up @@ -332,8 +333,8 @@ void iib_process_metric_pckt(iib_link_set_entry_t *ls_entry, uint32_t metric_out
(void)ls_entry;
(void)metric_out;
(void)seq_no;
DEBUGF("[WARNING] Unknown NHDP_METRIC setting\n");
#endif
DEBUG("%s:%d in %s: [WARNING] Unknown NHDP_METRIC setting\n", __FILE__,
__LINE__, DEBUG_FUNC); #endif
}

void iib_process_metric_refresh(void)
Expand All @@ -344,8 +345,8 @@ void iib_process_metric_refresh(void)
dat_metric_refresh();
#else
/* NHDP_METRIC is not set properly */
DEBUGF("[WARNING] Unknown NHDP_METRIC setting\n");
#endif
DEBUG("%s:%d in %s: [WARNING] Unknown NHDP_METRIC setting\n", __FILE__,
__LINE__, DEBUG_FUNC); #endif
}


Expand Down
7 changes: 4 additions & 3 deletions sys/trickle/trickle.c
Expand Up @@ -37,11 +37,12 @@ void trickle_interval(trickle_t *trickle)
DEBUG("TRICKLE new Interval %" PRIu32 "\n", trickle->I);

if (trickle->I == 0) {
DEBUGF("[WARNING] Interval was 0\n");
DEBUG("%s:%d in %s: [WARNING] Interval was 0\n", __FILE__, __LINE__,
DEBUG_FUNC);

if (trickle->Imax == 0) {
DEBUGF("[WARNING] Imax == 0\n");
}
DEBUG("%s:%d in %s: [WARNING] Imax == 0\n", __FILE__, __LINE__,
DEBUG_FUNC); }

trickle->I = (trickle->Imin << trickle->Imax);
}
Expand Down

0 comments on commit fac9580

Please sign in to comment.