mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-27 07:00:30 +00:00
Use R_LOG in RCrypto
This commit is contained in:
parent
971b5d9b92
commit
78fd7631c4
@ -6,6 +6,7 @@
|
||||
#include <r_lib.h>
|
||||
#include <r_crypto.h>
|
||||
#include <r_util/r_assert.h>
|
||||
#include <r_util/r_log.h>
|
||||
#include <memory.h>
|
||||
|
||||
#define BLOCK_SIZE 8
|
||||
@ -179,7 +180,7 @@ static void blowfish_crypt(struct blowfish_state *const state, const ut8 *inbuf,
|
||||
if (!state || !inbuf || !outbuf || buflen < 0 || buflen%8 != 0) {
|
||||
//let user deal with padding
|
||||
if (buflen % 8 != 0) {
|
||||
eprintf ("Invalid input length %d. Expected length is multiple of 8 bytes.\n", buflen);
|
||||
R_LOG_ERROR ("Invalid input length %d. Expected length is multiple of 8 bytes", buflen);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1,8 +1,9 @@
|
||||
/* radare - LGPL - Copyright 2016 - pancake */
|
||||
/* radare - LGPL - Copyright 2016-2022 - pancake */
|
||||
|
||||
//Implemented AES version of RC6. keylen = 16, 23, or 32 bytes; w = 32; and r = 20.
|
||||
#include <r_lib.h>
|
||||
#include <r_crypto.h>
|
||||
#include <r_util/r_log.h>
|
||||
|
||||
#define Pw 0xb7e15163
|
||||
#define Qw 0x9e3779b9
|
||||
@ -165,7 +166,7 @@ static int rc6_get_key_size(RCryptoJob *cj) {
|
||||
|
||||
static bool update(RCryptoJob *cj, const ut8 *buf, int len) {
|
||||
if (len % BLOCK_SIZE != 0) { //let user handle with with pad.
|
||||
eprintf ("Input should be multiple of 128bit.\n");
|
||||
R_LOG_ERROR ("Input should be multiple of 128bit");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "crypto_serpent_algo.h"
|
||||
#include "r_util/r_assert.h"
|
||||
#include "r_util/r_log.h"
|
||||
|
||||
static const ut8 S[][16] = {
|
||||
{ 3, 8,15, 1,10, 6, 5,11,14,13, 4, 2, 7, 0, 9,12 },/* S0: */
|
||||
@ -94,7 +95,7 @@ static void apply_FP(ut32 in[DW_BY_BLOCK], ut32 out[DW_BY_BLOCK]) {
|
||||
static bool serpent_keyschedule(struct serpent_state st, ut32 subkeys[NB_SUBKEYS *DW_BY_BLOCK]) {
|
||||
if ((st.key_size != 128) && (st.key_size != 192)
|
||||
&& (st.key_size != 256)) {
|
||||
eprintf ("Invalid key size");
|
||||
R_LOG_ERROR ("Invalid key size");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -906,22 +906,25 @@ R_API bool r_run_config_env(RRunProfile *p) {
|
||||
#if HAVE_PTY
|
||||
dyn_init ();
|
||||
#endif
|
||||
|
||||
if (!p->_program && !p->_system && !p->_runlib) {
|
||||
R_LOG_ERROR ("No program, system or runlib rule defined");
|
||||
return false;
|
||||
}
|
||||
// when IO is redirected to a process, handle them together
|
||||
if (!handle_redirection (p->_stdio, true, true, false)) {
|
||||
R_LOG_WARN ("cannot handle stdio redirection");
|
||||
return false;
|
||||
}
|
||||
if (!handle_redirection (p->_stdin, true, false, false)) {
|
||||
R_LOG_WARN ("cannot handle stdin redirection");
|
||||
return false;
|
||||
}
|
||||
if (!handle_redirection (p->_stdout, false, true, false)) {
|
||||
R_LOG_WARN ("cannot handle stdout redirection");
|
||||
return false;
|
||||
}
|
||||
if (!handle_redirection (p->_stderr, false, false, true)) {
|
||||
R_LOG_WARN ("cannot handle stderr redirection");
|
||||
return false;
|
||||
}
|
||||
if (p->_aslr != -1) {
|
||||
|
Loading…
Reference in New Issue
Block a user