I am looking for an example for Polarssl AES counter mode. Couldn't find it anywhere.
Documentation is difficult to understand for a beginner like me. It is defined in polarssl as
int aes_crypt_ctr (aes_context *ctx, size_t length, size_t *nc_off, unsigned char nonce_counter[16], unsigned char stream_block[16], const unsigned char *input, unsigned char *output)
I wrote like this
aes_context aes;
unsigned char key[32];
unsigned char iv[16];
unsigned char input [128]="Hello";
unsigned char output[128];
size_t input_len = 40;
size_t output_len = 0;
aes_setkey_enc(&aes, key, 128);
aes_crypt_ctr (&aes, 64, size_t *nc_off, unsigned char nonce_counter[16], unsigned char stream_block[16], input, output);
I couldnt understand certain parameters in the call to encryption. I am looking for a minimal working example.