error: undefined reference

Hi everyone, i'm writing a program to encrypt the ARC4 cryptography
I'm using this library : GitHub - wolfeidau/mbedtls and I i was successful to write program to encrypt AES crypto
But when i compile this program, it has error like this : undefined reference to mbedtls_arc4_init' undefined reference to mbedtls_arc4_setup'
undefined reference to mbedtls_arc4_crypt' undefined reference to mbedtls_arc4_free'

What should i do to solve this problem ? Thank you verymuch
Here is my code

#include"mbedtls/arc4.h"
void encrypt(char * plainText,char * key, unsigned char* output){
mbedtls_arc4_context arc;
mbedtls_arc4_init(&arc);
mbedtls_arc4_setup( &arc, (const unsigned char *)key,strlen(key ));
mbedtls_arc4_crypt( &arc, sizeof plainText, (const unsigned char *)plainText,output );
mbedtls_arc4_free( &arc);
}


                 
void setup() {
  // put your setup code here, to run once:
Serial.begin(115200);
 char * key = "abcdefghijklmnop";

  char *plainText = "nghi123";
  unsigned char cipherTextOutput[7];
  //unsigned char decipheredTextOutput[7];

  encrypt(plainText, key, cipherTextOutput);
 // decrypt(cipherTextOutput, key, decipheredTextOutput);

  Serial.println("\nOriginal plain text:");
  Serial.println(plainText);

  Serial.println("\nCiphered text:");
  for (int i = 0; i < 7; i++) {

}
}

void loop() {
  // put your main code here, to run repeatedly:

}

Don't post snippets (Snippets R Us!)

By the name it feels like a mbed library. Can you give more details on what you do, which platform etc... ?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.