references/kyber-submission-nist-round2/NIST-PQ-Submission-Kyber-20190330/Reference_Implementation/crypto_kem/kyber768/aes256ctr.c
/*************************************************
* Name:        aes256_prf
*
* Description: AES256 stream generation in CTR mode using 32-bit counter, 
*              nonce is zero-padded to 12 bytes, counter starts at zero
*
* Arguments:   - unsigned char *output:      pointer to output
*              - unsigned long long outlen:  length of requested output in bytes
*              - const unsigned char *key:   pointer to 32-byte key
*              - const unsigned char nonce:  1-byte nonce (will be zero-padded to 12 bytes)
**************************************************/
aes256_prf
Description: AES256 stream generation in CTR mode using 32-bit counter,
nonce is zero-padded to 12 bytes, counter starts at zero

- unsigned char *output:      pointer to output
unsigned long long outlen:  length of requested output in bytes
const unsigned char *key:   pointer to 32-byte key
const unsigned char nonce:  1-byte nonce (will be zero-padded to 12 bytes)
aes256_prf Description : AES256 stream generation in CTR mode using 32 - bit counter nonce is zero - padded to 12 bytes counter starts at zero - unsigned char * output : pointer to output unsigned long long outlen : length of requested output in bytes const unsigned char * key : pointer to 32 - byte key const unsigned char nonce : 1 - byte nonce ( will be zero - padded to 12 bytes )
void aes256_prf(unsigned char *output, unsigned long long outlen, const unsigned char *key, const unsigned char nonce)
{
  uint64_t sk_exp[120];
  unsigned char iv[12];
  for(int i=1;i<12;i++)
    iv[i] = 0;
  iv[0] = nonce;
  br_aes_ct64_ctr_init(sk_exp, key);
  br_aes_ct64_ctr_run(sk_exp, iv, 0, output, outlen);
}
void aes256_prf ( unsigned char * output , unsigned long long outlen , const unsigned char * key , const unsigned char nonce ) { uint64_t sk_exp [ 120 ] ; unsigned char iv [ 12 ] ; for ( int i = 1 ; i < 12 ; i ++ ) iv [ i ] = 0 ; iv [ 0 ] = nonce ; br_aes_ct64_ctr_init ( sk_exp , key ) ; br_aes_ct64_ctr_run ( sk_exp , iv , 0 , output , outlen ) ; }
Name:        aes256_prf
Description: AES256 stream generation in CTR mode using 32-bit counter,
nonce is zero-padded to 12 bytes, counter starts at zero
Name : aes256_prf Description : AES256 stream generation in CTR mode using 32 - bit counter nonce is zero - padded to 12 bytes counter starts at zero