Rizin
unix-like reverse engineering framework and cli tools
openssl_common.h File Reference
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/sha.h>
#include <openssl/md4.h>
#include <openssl/md5.h>

Go to the source code of this file.

Macros

#define rz_openssl_plugin_context_new(pluginname)
 
#define rz_openssl_plugin_context_free(pluginname)
 
#define rz_openssl_plugin_digest_size(pluginname, evpmd)
 
#define rz_openssl_plugin_block_size(pluginname, evpmd)
 
#define rz_openssl_plugin_init(pluginname, evpmd)
 
#define rz_openssl_plugin_update(pluginname)
 
#define rz_openssl_plugin_final(pluginname)
 
#define rz_openssl_plugin_small_block(pluginname, evpmd)
 
#define rz_openssl_plugin_define_hash_cfg(pluginname, evpmd, canhmac)
 

Macro Definition Documentation

◆ rz_openssl_plugin_block_size

#define rz_openssl_plugin_block_size (   pluginname,
  evpmd 
)
Value:
static RzHashSize openssl_plugin_##pluginname##_block_size(void *context) { \
return EVP_MD_block_size(evpmd()); \
}
ut32 RzHashSize
Definition: rz_hash.h:24

Definition at line 44 of file openssl_common.h.

◆ rz_openssl_plugin_context_free

#define rz_openssl_plugin_context_free (   pluginname)
Value:
static void openssl_plugin_##pluginname##_context_free(void *context) { \
rz_return_if_fail(context); \
EVP_MD_CTX_free((EVP_MD_CTX *)context); \
}

Definition at line 33 of file openssl_common.h.

◆ rz_openssl_plugin_context_new

#define rz_openssl_plugin_context_new (   pluginname)
Value:
static void *openssl_plugin_##pluginname##_context_new() { \
return EVP_MD_CTX_new(); \
}

Definition at line 28 of file openssl_common.h.

◆ rz_openssl_plugin_define_hash_cfg

#define rz_openssl_plugin_define_hash_cfg (   pluginname,
  evpmd,
  canhmac 
)
Value:
rz_openssl_plugin_context_free(pluginname); \
rz_openssl_plugin_digest_size(pluginname, evpmd); \
rz_openssl_plugin_block_size(pluginname, evpmd); \
rz_openssl_plugin_init(pluginname, evpmd); \
rz_openssl_plugin_update(pluginname); \
rz_openssl_plugin_final(pluginname); \
rz_openssl_plugin_small_block(pluginname, evpmd); \
RzHashPlugin rz_hash_plugin_##pluginname = { \
.name = #pluginname, \
.license = "Apache 2.0", \
.author = "OpenSSL Team", \
.support_hmac = canhmac, \
.context_new = openssl_plugin_##pluginname##_context_new, \
.context_free = openssl_plugin_##pluginname##_context_free, \
.digest_size = openssl_plugin_##pluginname##_digest_size, \
.block_size = openssl_plugin_##pluginname##_block_size, \
.init = openssl_plugin_##pluginname##_init, \
.update = openssl_plugin_##pluginname##_update, \
.final = openssl_plugin_##pluginname##_final, \
.small_block = openssl_plugin_##pluginname##_small_block, \
}
#define rz_openssl_plugin_context_new(pluginname)

Definition at line 119 of file openssl_common.h.

◆ rz_openssl_plugin_digest_size

#define rz_openssl_plugin_digest_size (   pluginname,
  evpmd 
)
Value:
static RzHashSize openssl_plugin_##pluginname##_digest_size(void *context) { \
return EVP_MD_size(evpmd()); \
}

Definition at line 39 of file openssl_common.h.

◆ rz_openssl_plugin_final

#define rz_openssl_plugin_final (   pluginname)
Value:
static bool openssl_plugin_##pluginname##_final(void *context, ut8 *digest) { \
rz_return_val_if_fail((context) && (digest), false); \
if (EVP_DigestFinal_ex((EVP_MD_CTX *)context, digest, NULL) != 1) { \
return false; \
} \
return true; \
}
#define NULL
Definition: cris-opc.c:27
uint8_t ut8
Definition: lh5801.h:11

Definition at line 70 of file openssl_common.h.

◆ rz_openssl_plugin_init

#define rz_openssl_plugin_init (   pluginname,
  evpmd 
)
Value:
static bool openssl_plugin_##pluginname##_init(void *context) { \
rz_return_val_if_fail(context, false); \
if (EVP_DigestInit_ex((EVP_MD_CTX *)context, evpmd(), NULL) != 1) { \
return false; \
} \
return true; \
}

Definition at line 49 of file openssl_common.h.

◆ rz_openssl_plugin_small_block

#define rz_openssl_plugin_small_block (   pluginname,
  evpmd 
)

Definition at line 79 of file openssl_common.h.

◆ rz_openssl_plugin_update

#define rz_openssl_plugin_update (   pluginname)
Value:
static bool openssl_plugin_##pluginname##_update(void *context, const ut8 *data, ut64 size) { \
rz_return_val_if_fail((context) && (data), false); \
if (size < 1) { \
return true; \
} \
if (EVP_DigestUpdate((EVP_MD_CTX *)context, data, size) != 1) { \
return false; \
} \
return true; \
}
voidpf void uLong size
Definition: ioapi.h:138
ut64(WINAPI *w32_GetEnabledXStateFeatures)()

Definition at line 58 of file openssl_common.h.