AES CTR mode on ATMEL AES DRIVER - SAMA5D36

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I am working on a SAMA5D36-EK boar, I try to understand and measure the performance of AES hw acceleration.

 

But I have a question, if I analyze the atmel-aes.c file, in the atmel_aes_crypt function, there are special modification for CF8 or CF16... but not for CTR mode.

 

See: http://lxr.free-electrons.com/so...

 

My question is where the incrementation is done (when the atmel-aes.ko module is loaded of course) ?

 

As a recall, if we use the linux kernel crypto, the incrementation is inside the encrypt function in ctr.c :

 

static int crypto_ctr_crypt_segment(struct blkcipher_walk *walk,
                                    struct crypto_cipher *tfm)
{
        void (*fn)(struct crypto_tfm *, u8 *, const u8 *) =
                   crypto_cipher_alg(tfm)->cia_encrypt;
        unsigned int bsize = crypto_cipher_blocksize(tfm);
        u8 *ctrblk = walk->iv;
        u8 *src = walk->src.virt.addr;
        u8 *dst = walk->dst.virt.addr;
        unsigned int nbytes = walk->nbytes;

        do {
                /* create keystream */
                fn(crypto_cipher_tfm(tfm), dst, ctrblk);
                crypto_xor(dst, src, bsize);

                /*HERE HERE !!!!*/
                /* increment counter in counterblock */
                crypto_inc(ctrblk, bsize);

                src += bsize;
                dst += bsize;
        } while ((nbytes -= bsize) >= bsize);

        return nbytes;
}

 

Thank you.

Last Edited: Sat. Nov 7, 2015 - 06:40 AM