Skip to content

Commit

Permalink
correctly initialize counter blocks' flags field
Browse files Browse the repository at this point in the history
git-svn-id: svn://anonsvn.mit.edu/krb5/branches/aes-ccm@21601 dc483132-0cff-0310-8789-dd5450dbe970
  • Loading branch information
lhoward committed Dec 26, 2008
1 parent 1d1a7fd commit e9013c6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/crypto/enc_provider/aes_ctr.c
Expand Up @@ -29,6 +29,8 @@
#include "aes.h"
#include "../aead.h"

#define CCM_COUNTER_LENGTH 3

static void xorblock(unsigned char *out, const unsigned char *in)
{
int z;
Expand Down Expand Up @@ -62,7 +64,7 @@ krb5int_aes_encrypt_ctr_iov(const krb5_keyblock *key,
else
memset(ctr, 0, BLOCK_SIZE);

ctr[0] &= 0x7;
ctr[0] = CCM_COUNTER_LENGTH - 1; /* q=3 */

blockno = (ctr[13] << 16);
blockno |= (ctr[14] << 8 );
Expand Down Expand Up @@ -120,7 +122,7 @@ krb5int_aes_decrypt_ctr_iov(const krb5_keyblock *key,
else
memset(ctr, 0, BLOCK_SIZE);

ctr[0] &= 0x7;
ctr[0] = CCM_COUNTER_LENGTH - 1; /* q=3 */

blockno = (ctr[13] << 16);
blockno |= (ctr[14] << 8 );
Expand Down

0 comments on commit e9013c6

Please sign in to comment.