mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 05:09:43 +00:00
Update r_crypto_list arguments
Some checks are pending
build / linux-wasi (push) Waiting to run
build / linux-wasi-api (push) Waiting to run
build / linux-csnext (push) Waiting to run
build / linux-ssl-crypto (push) Waiting to run
build / tarball (push) Waiting to run
build / linux-static (push) Waiting to run
build / linux-acr-rpm-64 (push) Waiting to run
build / linux-acr-deb (amd64) (push) Waiting to run
build / linux-acr-deb (arm64, aarch64-linux-gnu) (push) Waiting to run
build / linux-acr-deb (i386, multilib) (push) Waiting to run
build / macos-acr (arm64, 13) (push) Waiting to run
build / macos-acr (x86_64, 12) (push) Waiting to run
build / ios (cydia32) (push) Waiting to run
build / ios (true, cydia) (push) Waiting to run
build / android-acr (16, arm) (push) Waiting to run
build / android-acr (aarch64) (push) Waiting to run
build / android-meson (x86_64) (push) Waiting to run
build / w32-meson (push) Waiting to run
build / w64-static-2022 (push) Waiting to run
build / w64-static (push) Waiting to run
build / w64-meson (push) Waiting to run
build / check_abi_compatibility (push) Blocked by required conditions
build / check_release (push) Blocked by required conditions
build / release (push) Blocked by required conditions
CI / linux-acr-oldlibsbug (push) Waiting to run
CI / linux-nocs (push) Waiting to run
CI / linux-acr-gperf (push) Waiting to run
CI / linux-sys-capstone (push) Waiting to run
CI / linux-acr-resymlink (push) Waiting to run
CI / linux-test (push) Waiting to run
CI / linux-static-meson (push) Waiting to run
CI / macos-test (push) Waiting to run
CI / linux-rpath (push) Waiting to run
CI / macos-rpath (push) Waiting to run
CI / linux-meson-spaces (push) Waiting to run
CI / linux-tinyasan-fuzz (push) Waiting to run
CI / linux-asan-fuzz (push) Waiting to run
CI / w64-make (push) Waiting to run
CI / w32-mingw (push) Waiting to run
CI / w64-mingw (push) Waiting to run
Code scanning - action / CodeQL-Build (push) Waiting to run
Coverity Scan / latest (push) Waiting to run
tcc / ubuntu-tcc-newabi (push) Waiting to run
tcc / ubuntu-tcc-test (push) Waiting to run
tcc / ubuntu-tcc-nodbg (push) Waiting to run
tcc / r2pm-tcc (push) Waiting to run
tcc / ubuntu-tcc-syslibs (push) Waiting to run
Some checks are pending
build / linux-wasi (push) Waiting to run
build / linux-wasi-api (push) Waiting to run
build / linux-csnext (push) Waiting to run
build / linux-ssl-crypto (push) Waiting to run
build / tarball (push) Waiting to run
build / linux-static (push) Waiting to run
build / linux-acr-rpm-64 (push) Waiting to run
build / linux-acr-deb (amd64) (push) Waiting to run
build / linux-acr-deb (arm64, aarch64-linux-gnu) (push) Waiting to run
build / linux-acr-deb (i386, multilib) (push) Waiting to run
build / macos-acr (arm64, 13) (push) Waiting to run
build / macos-acr (x86_64, 12) (push) Waiting to run
build / ios (cydia32) (push) Waiting to run
build / ios (true, cydia) (push) Waiting to run
build / android-acr (16, arm) (push) Waiting to run
build / android-acr (aarch64) (push) Waiting to run
build / android-meson (x86_64) (push) Waiting to run
build / w32-meson (push) Waiting to run
build / w64-static-2022 (push) Waiting to run
build / w64-static (push) Waiting to run
build / w64-meson (push) Waiting to run
build / check_abi_compatibility (push) Blocked by required conditions
build / check_release (push) Blocked by required conditions
build / release (push) Blocked by required conditions
CI / linux-acr-oldlibsbug (push) Waiting to run
CI / linux-nocs (push) Waiting to run
CI / linux-acr-gperf (push) Waiting to run
CI / linux-sys-capstone (push) Waiting to run
CI / linux-acr-resymlink (push) Waiting to run
CI / linux-test (push) Waiting to run
CI / linux-static-meson (push) Waiting to run
CI / macos-test (push) Waiting to run
CI / linux-rpath (push) Waiting to run
CI / macos-rpath (push) Waiting to run
CI / linux-meson-spaces (push) Waiting to run
CI / linux-tinyasan-fuzz (push) Waiting to run
CI / linux-asan-fuzz (push) Waiting to run
CI / w64-make (push) Waiting to run
CI / w32-mingw (push) Waiting to run
CI / w64-mingw (push) Waiting to run
Code scanning - action / CodeQL-Build (push) Waiting to run
Coverity Scan / latest (push) Waiting to run
tcc / ubuntu-tcc-newabi (push) Waiting to run
tcc / ubuntu-tcc-test (push) Waiting to run
tcc / ubuntu-tcc-nodbg (push) Waiting to run
tcc / r2pm-tcc (push) Waiting to run
tcc / ubuntu-tcc-syslibs (push) Waiting to run
This commit is contained in:
parent
780b5d6171
commit
07faceaa92
@ -3411,7 +3411,7 @@ static void cmd_print_op(RCore *core, const char *input) {
|
||||
algo = r_list_get_n (args, 1);
|
||||
}
|
||||
if (!args || !algo) {
|
||||
r_crypto_list (core->crypto, r_cons_printf, 0 | (int)R_CRYPTO_TYPE_SIGNATURE << 8);
|
||||
r_crypto_list (core->crypto, r_cons_printf, 0, R_CRYPTO_TYPE_SIGNATURE);
|
||||
r_core_cmd_help_match (core, help_msg_po, "poS");
|
||||
break;
|
||||
}
|
||||
@ -3450,7 +3450,7 @@ static void cmd_print_op(RCore *core, const char *input) {
|
||||
algo = r_list_get_n (args, 1);
|
||||
}
|
||||
if (!args || !algo) {
|
||||
r_crypto_list (core->crypto, r_cons_printf, 0 | (int)R_CRYPTO_TYPE_ENCRYPT << 8);
|
||||
r_crypto_list (core->crypto, r_cons_printf, 0, R_CRYPTO_TYPE_ENCRYPT);
|
||||
r_core_cmd_help_match_spec (core, help_msg_po, "po", input[1]);
|
||||
break;
|
||||
}
|
||||
@ -3917,19 +3917,19 @@ static bool cmd_print_ph(RCore *core, const char *input) {
|
||||
}
|
||||
if (!i0 || i0 == 'l' || i0 == 'L') {
|
||||
RCrypto *cry = r_crypto_new ();
|
||||
r_crypto_list (cry, NULL, 'q' | (int)R_CRYPTO_TYPE_HASHER << 8);
|
||||
r_crypto_list (cry, NULL, 'q', R_CRYPTO_TYPE_HASH);
|
||||
r_crypto_free (cry);
|
||||
return true;
|
||||
}
|
||||
if (i0 == 'j') { // "phj"
|
||||
RCrypto *cry = r_crypto_new ();
|
||||
r_crypto_list (cry, r_cons_printf, 'j' | (int)R_CRYPTO_TYPE_ALL << 8);
|
||||
r_crypto_list (cry, r_cons_printf, 'j', R_CRYPTO_TYPE_ALL);
|
||||
r_crypto_free (cry);
|
||||
return true;
|
||||
}
|
||||
if (i0 == 'J') { // "phJ"
|
||||
RCrypto *cry = r_crypto_new ();
|
||||
r_crypto_list (cry, r_cons_printf, 'J' | (int)R_CRYPTO_TYPE_HASHER << 8);
|
||||
r_crypto_list (cry, r_cons_printf, 'J', R_CRYPTO_TYPE_HASH);
|
||||
r_crypto_free (cry);
|
||||
return true;
|
||||
}
|
||||
|
@ -430,7 +430,7 @@ static int cmd_wo(void *data, const char *input) {
|
||||
if (R_STR_ISNOTEMPTY (algo) && key) {
|
||||
write_encrypted_block (core, algo, key, direction, iv);
|
||||
} else {
|
||||
r_crypto_list (core->crypto, r_cons_printf, 0 | (int)R_CRYPTO_TYPE_ENCRYPT << 8);
|
||||
r_crypto_list (core->crypto, r_cons_printf, 0, R_CRYPTO_TYPE_ENCRYPT);
|
||||
r_core_cmd_help_match_spec (core, help_msg_wo, "wo", input[0]);
|
||||
}
|
||||
free (args);
|
||||
@ -451,7 +451,7 @@ static int cmd_wo(void *data, const char *input) {
|
||||
if (R_STR_ISNOTEMPTY (algo) && key) {
|
||||
write_block_signature (core, algo, key);
|
||||
} else {
|
||||
r_crypto_list (core->crypto, r_cons_printf, 0 | (int)R_CRYPTO_TYPE_SIGNATURE << 8);
|
||||
r_crypto_list (core->crypto, r_cons_printf, 0, R_CRYPTO_TYPE_SIGNATURE);
|
||||
r_core_cmd_help_match_spec (core, help_msg_wo, "wo", input[0]);
|
||||
}
|
||||
free (args);
|
||||
|
@ -192,16 +192,13 @@ static inline void print_plugin_verbose(RCryptoPlugin *cp, PrintfCallback cb_pri
|
||||
cb_printf ("%c %12s %s\n", type, cp->meta.name, desc);
|
||||
}
|
||||
|
||||
R_API void r_crypto_list(RCrypto *cry, R_NULLABLE PrintfCallback cb_printf, int mode) {
|
||||
R_API void r_crypto_list(RCrypto *cry, R_NULLABLE PrintfCallback cb_printf, int mode, RCryptoType type) {
|
||||
R_RETURN_IF_FAIL (cry);
|
||||
if (!cb_printf) {
|
||||
cb_printf = (PrintfCallback)printf;
|
||||
}
|
||||
PJ *pj = NULL;
|
||||
|
||||
// XXX R2_600 - add a type argument to be clearer but will break ABI.
|
||||
RCryptoType type = (RCryptoType)mode >> 8;
|
||||
mode = mode & 0xff;
|
||||
if (mode == 'J') {
|
||||
pj = pj_new ();
|
||||
pj_a (pj);
|
||||
@ -226,7 +223,7 @@ R_API void r_crypto_list(RCrypto *cry, R_NULLABLE PrintfCallback cb_printf, int
|
||||
pj_o (pj);
|
||||
pj_ks (pj, "name", cp->meta.name);
|
||||
switch (cp->type) {
|
||||
case R_CRYPTO_TYPE_HASHER:
|
||||
case R_CRYPTO_TYPE_HASH:
|
||||
pj_ks (pj, "type", "hash");
|
||||
break;
|
||||
case R_CRYPTO_TYPE_ENCRYPT:
|
||||
@ -262,7 +259,7 @@ R_API void r_crypto_list(RCrypto *cry, R_NULLABLE PrintfCallback cb_printf, int
|
||||
}
|
||||
}
|
||||
// TODO: R2_592 move all those static hashes into crypto plugins and remove the code below
|
||||
if (type == R_CRYPTO_TYPE_HASHER || type == R_CRYPTO_TYPE_ALL) {
|
||||
if (type == R_CRYPTO_TYPE_HASH || type == R_CRYPTO_TYPE_ALL) {
|
||||
int i;
|
||||
for (i = 0; i < 64; i++) {
|
||||
ut64 bits = ((ut64)1) << i;
|
||||
|
@ -373,7 +373,7 @@ R_API R_MUSTUSE char *r_hash_tostring(R_NULLABLE RHash *ctx, const char *name, c
|
||||
ctx = r_hash_new (true, algo);
|
||||
}
|
||||
|
||||
if (cj && cj->h->type == R_CRYPTO_TYPE_HASHER) {
|
||||
if (cj && cj->h->type == R_CRYPTO_TYPE_HASH) {
|
||||
r_crypto_job_update (cj, data, len);
|
||||
ut8 *result = r_crypto_job_get_output (cj, &digest_size);
|
||||
memcpy (ctx->digest, result, digest_size);
|
||||
|
@ -52,7 +52,7 @@ RCryptoPlugin r_crypto_plugin_entropy = {
|
||||
.author = "pancake",
|
||||
.license = "MIT",
|
||||
},
|
||||
.type = R_CRYPTO_TYPE_HASHER,
|
||||
.type = R_CRYPTO_TYPE_HASH,
|
||||
.update = update,
|
||||
.end = end
|
||||
};
|
||||
|
@ -19,7 +19,7 @@ RCryptoPlugin r_crypto_plugin_sip = {
|
||||
.author = "pancake",
|
||||
.license = "MIT",
|
||||
},
|
||||
.type = R_CRYPTO_TYPE_HASHER,
|
||||
.type = R_CRYPTO_TYPE_HASH,
|
||||
.implements = "sip",
|
||||
.update = update,
|
||||
.end = update
|
||||
|
@ -20,7 +20,7 @@ RCryptoPlugin r_crypto_plugin_strhash = {
|
||||
.author = "pancake",
|
||||
.license = "MIT",
|
||||
},
|
||||
.type = R_CRYPTO_TYPE_HASHER,
|
||||
.type = R_CRYPTO_TYPE_HASH,
|
||||
.implements = "strhash",
|
||||
.update = update,
|
||||
.end = update
|
||||
|
@ -68,7 +68,7 @@ typedef struct r_crypto_job_t {
|
||||
|
||||
typedef enum {
|
||||
R_CRYPTO_TYPE_ENCODER = 'e',
|
||||
R_CRYPTO_TYPE_HASHER = 'h',
|
||||
R_CRYPTO_TYPE_HASH = 'h',
|
||||
R_CRYPTO_TYPE_ENCRYPT = 'c', // CIPHER
|
||||
R_CRYPTO_TYPE_SIGNATURE = 's',
|
||||
R_CRYPTO_TYPE_ALL = 'a'
|
||||
@ -103,7 +103,7 @@ R_API void r_crypto_init(RCrypto *cry);
|
||||
R_API bool r_crypto_add(RCrypto *cry, RCryptoPlugin *h);
|
||||
R_API RCrypto *r_crypto_new(void);
|
||||
R_API void r_crypto_free(RCrypto *cry);
|
||||
R_API void r_crypto_list(RCrypto *cry, PrintfCallback cb_printf, int mode);
|
||||
R_API void r_crypto_list(RCrypto *cry, PrintfCallback cb_printf, int mode, RCryptoType type);
|
||||
|
||||
// R_API RCryptoHash *r_crypto_hash(RCrypto *cry, bool rst, const char *name);
|
||||
|
||||
|
@ -348,7 +348,7 @@ static int do_help(int line) {
|
||||
|
||||
static void algolist(int mode) {
|
||||
RCrypto *cry = r_crypto_new ();
|
||||
r_crypto_list (cry, NULL, mode | (int)R_CRYPTO_TYPE_ALL << 8);
|
||||
r_crypto_list (cry, NULL, mode, (int)R_CRYPTO_TYPE_ALL);
|
||||
r_crypto_free (cry);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user