Rizin
unix-like reverse engineering framework and cli tools
algo_fletcher.c File Reference

Go to the source code of this file.

Macros

#define rz_fletcher_common_plugin_context_new(bits)
 
#define rz_fletcher_common_plugin_context_free(bits)
 
#define rz_fletcher_common_plugin_digest_size(bits)
 
#define rz_fletcher_common_plugin_init(bits)
 
#define rz_fletcher_common_plugin_update(bits)
 
#define rz_fletcher_common_plugin_final(bits)
 
#define rz_fletcher_common_plugin_small_block(bits)
 
#define rz_lib_fletcher_common(bits)
 
#define rz_fletcher_common_plugin_define_hash_cfg(bits)
 

Functions

static RzHashSize plugin_fletcher_block_size (void *context)
 
 rz_fletcher_common_plugin_define_hash_cfg (8)
 
 rz_fletcher_common_plugin_define_hash_cfg (16)
 
 rz_fletcher_common_plugin_define_hash_cfg (32)
 
 rz_fletcher_common_plugin_define_hash_cfg (64)
 

Macro Definition Documentation

◆ rz_fletcher_common_plugin_context_free

#define rz_fletcher_common_plugin_context_free (   bits)
Value:
static void plugin_fletcher##bits##_context_free(void *context) { \
free(context); \
}
int bits(struct state *s, int need)
Definition: blast.c:72

Definition at line 14 of file algo_fletcher.c.

◆ rz_fletcher_common_plugin_context_new

#define rz_fletcher_common_plugin_context_new (   bits)
Value:
static void *plugin_fletcher##bits##_context_new() { \
return RZ_NEW0(RzFletcher##bits); \
}
#define RZ_NEW0(x)
Definition: rz_types.h:284

Definition at line 9 of file algo_fletcher.c.

◆ rz_fletcher_common_plugin_define_hash_cfg

#define rz_fletcher_common_plugin_define_hash_cfg (   bits)
Value:
rz_fletcher_common_plugin_context_free(bits); \
rz_fletcher_common_plugin_digest_size(bits); \
rz_fletcher_common_plugin_init(bits); \
rz_fletcher_common_plugin_update(bits); \
rz_fletcher_common_plugin_final(bits); \
rz_fletcher_common_plugin_small_block(bits); \
RzHashPlugin rz_hash_plugin_fletcher##bits = { \
.name = "fletcher" #bits, \
.license = "LGPL3", \
.author = "deroad", \
.support_hmac = false, \
.context_new = plugin_fletcher##bits##_context_new, \
.context_free = plugin_fletcher##bits##_context_free, \
.digest_size = plugin_fletcher##bits##_digest_size, \
.block_size = plugin_fletcher_block_size, \
.init = plugin_fletcher##bits##_init, \
.update = plugin_fletcher##bits##_update, \
.final = plugin_fletcher##bits##_final, \
.small_block = plugin_fletcher##bits##_small_block, \
}; \
rz_lib_fletcher_common(bits)
#define rz_fletcher_common_plugin_context_new(bits)
Definition: algo_fletcher.c:9
static RzHashSize plugin_fletcher_block_size(void *context)
Definition: algo_fletcher.c:98

Definition at line 74 of file algo_fletcher.c.

◆ rz_fletcher_common_plugin_digest_size

#define rz_fletcher_common_plugin_digest_size (   bits)
Value:
static RzHashSize plugin_fletcher##bits##_digest_size(void *context) { \
return RZ_HASH_FLETCHER##bits##_DIGEST_SIZE; \
}
ut32 RzHashSize
Definition: rz_hash.h:24

Definition at line 19 of file algo_fletcher.c.

◆ rz_fletcher_common_plugin_final

#define rz_fletcher_common_plugin_final (   bits)
Value:
static bool plugin_fletcher##bits##_final(void *context, ut8 *digest) { \
rz_return_val_if_fail(context &&digest, false); \
rz_fletcher##bits##_final(digest, (RzFletcher##bits *)context); \
return true; \
}
uint8_t ut8
Definition: lh5801.h:11

Definition at line 38 of file algo_fletcher.c.

◆ rz_fletcher_common_plugin_init

#define rz_fletcher_common_plugin_init (   bits)
Value:
static bool plugin_fletcher##bits##_init(void *context) { \
rz_return_val_if_fail(context, false); \
rz_fletcher##bits##_init((RzFletcher##bits *)context); \
return true; \
}

Definition at line 24 of file algo_fletcher.c.

◆ rz_fletcher_common_plugin_small_block

#define rz_fletcher_common_plugin_small_block (   bits)
Value:
static bool plugin_fletcher##bits##_small_block(const ut8 *data, ut64 size, ut8 **digest, RzHashSize *digest_size) { \
rz_return_val_if_fail(data &&digest, false); \
ut8 *dgst = malloc(RZ_HASH_FLETCHER##bits##_DIGEST_SIZE); \
if (!dgst) { \
return false; \
} \
RzFletcher##bits ctx; \
rz_fletcher##bits##_init(&ctx); \
rz_fletcher##bits##_update(&ctx, data, size); \
rz_fletcher##bits##_final(dgst, &ctx); \
*digest = dgst; \
if (digest_size) { \
*digest_size = RZ_HASH_FLETCHER##bits##_DIGEST_SIZE; \
} \
return true; \
}
voidpf void uLong size
Definition: ioapi.h:138
void * malloc(size_t size)
Definition: malloc.c:123
ut64(WINAPI *w32_GetEnabledXStateFeatures)()

Definition at line 45 of file algo_fletcher.c.

◆ rz_fletcher_common_plugin_update

#define rz_fletcher_common_plugin_update (   bits)
Value:
static bool plugin_fletcher##bits##_update(void *context, const ut8 *data, ut64 size) { \
rz_return_val_if_fail(context &&data, false); \
rz_fletcher##bits##_update((RzFletcher##bits *)context, data, size); \
return true; \
}

Definition at line 31 of file algo_fletcher.c.

◆ rz_lib_fletcher_common

#define rz_lib_fletcher_common (   bits)
Value:
.data = &rz_hash_plugin_fletcher##bits, \
.version = RZ_VERSION \
}
RZ_API RzLibStruct rizin_plugin
#define RZ_API
@ RZ_LIB_TYPE_HASH
Definition: rz_lib.h:82
#define RZ_VERSION
Definition: rz_version.h:8

Definition at line 64 of file algo_fletcher.c.

Function Documentation

◆ plugin_fletcher_block_size()

static RzHashSize plugin_fletcher_block_size ( void *  context)
static

Definition at line 98 of file algo_fletcher.c.

98  {
100 }
#define RZ_HASH_FLETCHER_BLOCK_LENGTH
Definition: fletcher.h:10

References RZ_HASH_FLETCHER_BLOCK_LENGTH.

◆ rz_fletcher_common_plugin_define_hash_cfg() [1/4]

rz_fletcher_common_plugin_define_hash_cfg ( 16  )

◆ rz_fletcher_common_plugin_define_hash_cfg() [2/4]

rz_fletcher_common_plugin_define_hash_cfg ( 32  )

◆ rz_fletcher_common_plugin_define_hash_cfg() [3/4]

rz_fletcher_common_plugin_define_hash_cfg ( 64  )

◆ rz_fletcher_common_plugin_define_hash_cfg() [4/4]

rz_fletcher_common_plugin_define_hash_cfg ( )