Fix compilation with -lcrypto ##build

This commit is contained in:
pancake 2022-11-10 15:29:35 +01:00 committed by pancake
parent c9b90b8926
commit 756ace8393
5 changed files with 6 additions and 103 deletions

View File

@ -1,33 +0,0 @@
include ../config.mk
NAME=r_hash
BINDEPS+=r_util
PCLIBS=@LIBXXHASH@
# HACK
ifneq ($(OSTYPE),darwin)
ifneq ($(OSTYPE),haiku)
LDFLAGS+=-lm
LINK=-lm
endif
endif
R2DEPS=r_util
OBJS=state.o hash.o hamdist.o crca.o fletcher.o sip.o
OBJS+=entropy.o hcalc.o adler32.o luhn.o ssdeep.o
ifeq ($(HAVE_LIB_SSL),1)
CFLAGS+=${SSL_CFLAGS}
LDFLAGS+=${SSL_LDFLAGS}
LINK+=${SSL_LDFLAGS}
else
OBJS+=md4.o md5.o sha1.o sha2.o
endif
ifeq ($(USE_LIB_XXHASH),1)
LDFLAGS+=${LIB_XXHASH}
LINK+=${LIBXXHASH}
else
OBJS+=xxhash.o
endif
include ../rules.mk

View File

@ -140,7 +140,7 @@ static void copy4(ut8 *out, ut32 x) {
out[3] = (x >> 24) & 0xFF;
}
void MD4(const ut8 *in, int n, ut8 *out) {
R_IPI void r_hash_md4(const ut8 *in, int n, ut8 *out) {
ut8 buf[128];
ut32 M[16];
ut32 b = n * 8;
@ -189,7 +189,7 @@ void MD4(const ut8 *in, int n, ut8 *out) {
}
#else
void MD4(const ut8 *in, int n, ut8 *out) {
R_IPI void r_hash_md4(const ut8 *in, int n, ut8 *out) {
R_LOG_ERROR ("md4 is only available on GPL builds");
}
#endif

View File

@ -1,6 +1,6 @@
#ifndef _R_MD4_H
#define _R_MD4_H
#ifndef R_HASH_MD4_H
#define R_HASH_MD4_H
void MD4(const ut8 *in, int n, ut8 *out);
R_IPI void r_hash_md4 (const ut8 *in, int n, ut8 *out);
#endif

View File

@ -1,64 +0,0 @@
r_hash_sources = files(
'adler32.c',
'hcalc.c',
'crca.c',
'sip.c',
'entropy.c',
'fletcher.c',
'hamdist.c',
'hash.c',
'ssdeep.c',
'luhn.c',
'state.c'
)
dependencies = [mth, r_util_dep]
if use_sys_xxhash
dependencies += files(sys_xxhash)
else
r_hash_sources += files('xxhash.c')
endif
if use_sys_openssl
dependencies += [sys_openssl]
else
r_hash_sources += files('md4.c', 'md5.c', 'sha1.c', 'sha2.c')
endif
r_hash = library('r_hash', r_hash_sources,
include_directories: [platform_inc],
c_args: library_cflags,
dependencies: dependencies,
install: true,
implicit_include_directories: false,
install_rpath: rpath_lib,
soversion: r2_libversion
)
r_hash_dep = declare_dependency(link_with: r_hash,
include_directories: [platform_inc])
if get_option('blob')
r_hash_static = static_library('r_hash_static', r_hash_sources,
include_directories: [platform_inc],
c_args: library_cflags,
dependencies: [ mth, r_util_static_dep ],
install: true,
implicit_include_directories: false,
)
r_hash_static_dep = declare_dependency(link_with: r_hash_static,
include_directories: [platform_inc])
endif
# pkgconfig_mod.generate(r_hash,
# subdirs: 'libr',
# version: r2_version,
# name: 'r_hash',
# filebase: 'r_hash',
# libraries: pkgcfg_sanitize_libs,
# requires: [
# 'r_util'
# ],
# description: 'radare foundation libraries'
# )

View File

@ -177,7 +177,7 @@ R_API ut8 *r_hash_do_md5(RHash *ctx, const ut8 *input, int len) {
R_API ut8 *r_hash_do_md4(RHash *ctx, const ut8 *input, int len) {
if (len >= 0) {
MD4 (input, len, ctx->digest);
r_hash_md4 (input, len, ctx->digest);
return ctx->digest;
}
return NULL;