I am doing some AES encryption using C. But the errors ocurred.

The code is following by the error displayed.

1 Code

#include <stdlib.h>
#include  <openssl/evp.h>
#include <string.h>

int main(){

	//declaring the variables

	char source[6]="Shahab";
	char target[6];

	char mykey[EVP_MAX_KEY_LENGTH]="hardtobreak";
	char iv[EVP_MAX_IV_LENGTH] = "an_iv"; 
	int in_len, out_len=0;
	int check;	
        EVP_CIPHER_CTX ctx; 



	printf("This is the text before ciphering %s\n",source);

	printf("The length of the string is %d\n",in_len);

	//starting the encryption process




	printf("Program is working");

return 0;


2. Errors

gcc aesimpl.c -o impl -lcrypto

aesimpl.c:(.text+0x12b): undefined reference to `EVP_EncrpytInit_ex'

collect2: ld returned 1 exit status

Please help me solve this problem

EVP_EncrpytInit_ex does not exist in any files or libraries you used to try an link the program.

Either you are missing a library or you have the function name wrong or the function really does not exist anywhere.

I think its the second did you mean EVP_EncryptInit_ex?

well, yes, it's obvious. you dont' have to mince words about it. We can plainly see that he's misspelled "encrypt" in one of the encryption functions. "encrpyt" is not a word.