Proxmark3 community

Research, development and trades concerning the powerful Proxmark3 device.

Remember; sharing is caring. Bring something back to the community.


"Learn the tools of the trade the hard way." +Fravia

You are not logged in.

Announcement

Time changes and with it the technology
Proxmark3 @ discord

Users of this forum, please be aware that information stored on this site is not private.

#1 2020-10-23 15:25:32

LuckyD1ce
Contributor
Registered: 2020-10-23
Posts: 6

Error - undefined reference to function

Hello everyone,

i'm currently working at a project using the proxmark and the newest version of the repo. In order to advance, i need to calculate the sha1 hash of a given input.
My code is based in armsrc/epa.c and compiles without errors, but after including a sha1 hash function from the repo:

#include "../common/mbedtls/sha1.h"

and using the function:

const char input_str[] = "The quick brown fox jumps over the lazy dog";
const unsigned char *input = (const unsigned char *) input_str;
const size_t input_len = strlen(input_str);
unsigned char output[20];
func_return = mbedtls_sha1_ret(input, input_len, output);

The code won't compile anymore. I use the Makefile "make clean && make all", which should make everything needed in order to compile the code, but i get the following error:

undefined reference to `mbedtls_sha1_ret'

After searching on stack overflow (not that much experience with C), it seems to be a problem with the linker, but the Makefile seems right and the "common/mbedtls" directory is compiled before the error occurs (snippet from the "make all" command):

Compiling mbedtls
cd ../common/mbedtls && make all
make[2]: Entering directory '/pm3/common/mbedtls'
ar rcs libmbedtls.a aes.o asn1parse.o asn1write.o base64.o bignum.o ctr_drbg.o entropy_poll.o entropy.o error.o timing.o ecp.o ecp_curves.o certs.o camellia.o blowfish.o cipher_wrap.o cipher.o cmac.o des.o ecdsa.o md.o md_wrap.o md5.o oid.o pem.o arc4.o pk.o pk_wrap.o pkwrite.o pkcs5.o pkcs12.o pkparse.o platform.o platform_util.o rsa.o rsa_internal.o sha1.o sha256.o sha512.o threading.o x509.o x509_crl.o x509_crt.o
ranlib libmbedtls.a
make[2]: Leaving directory '/pm3/common/mbedtls'

Thanks in advance and I hope someone knows a possible solution smile

Kind regards

Offline

Board footer

Powered by FluxBB