I've tried to write it out in this way but I still have the same problem, to make me sure it is only this my problem I've copyed file aes_cbc.c, renamed its main function AES_CCM_encrypt, renamed the file aes_ccm.c and put the prototype in aes.h.
Then I've tryed to initialize my cipher like I wrote in previous mail, now in file /crypto/evp/e_aes.c I added these lines
static int aes_128_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl)
{
AES_CCM_encrypt(in, out, (long)inl, &((EVP_AES_KEY *)ctx->cipher_data)->ks, ctx->iv, ctx->encrypt);
return 1;
}
BLOCK_CIPHER_def1(aes_128, ccm, ccm, CCM, EVP_AES_KEY, NID_aes_128, 16, 16, 16, 0, aes_init_key, NULL,EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL)
all the parameters received by AES_CCM_encrypt are correct, except the key, which is still not initialized.
All the other ciphers (cbc,ecb,...) are builded in the same way (I suppose) and they get the initialization of the key,
in fact if I add some printf(..) in this function of /crypto/evp/e_aes.c (the same file) I read in output the words I added, it
means that they used the function aes_init_key(...).
When I use my aes_ccm_128 there are no my words in output, so it means the function aes_init_key(..) has been unutilized.
static int aes_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) {
printf("\n I'M INSIDE THIS FUNCTION \n"); if ((ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_CFB_MODE || (ctx->cipher->flags & EVP_CIPH_MODE) == EVP_CIPH_OFB_MODE || enc) { printf("\n I'M CREATING THE KEY \n"); AES_set_encrypt_key(key, ctx->key_len * 8, ctx->cipher_data); printf("\n NOW THE KEY IS READY \n"); } else AES_set_decrypt_key(key, ctx->key_len * 8, ctx->cipher_data);
return 1; }
I think there are two possibilities: 1. I haven't correctly linked the function AES_CCM_encrypt to opennsl 2. I haven't correctly linked the function AES_CCM_encrypt to aes_init_key
Is there anyone who can help me and tell me how to correct my mistake ?
Thanks a lot Greetings
Paolo SERRA
______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]