stream/chacha ivlen cosmetics

This commit is contained in:
Karel Miko 2017-04-25 01:10:15 +02:00
parent e4793b50d0
commit 0d998fd4c8
3 changed files with 4 additions and 1 deletions

View File

@ -36,6 +36,7 @@ int chacha_ivctr32(chacha_state *st, const unsigned char *iv, unsigned long ivle
LOAD32L(st->input[14], iv + 4); LOAD32L(st->input[14], iv + 4);
LOAD32L(st->input[15], iv + 8); LOAD32L(st->input[15], iv + 8);
st->ksleft = 0; st->ksleft = 0;
st->ivlen = ivlen;
return CRYPT_OK; return CRYPT_OK;
} }

View File

@ -36,6 +36,7 @@ int chacha_ivctr64(chacha_state *st, const unsigned char *iv, unsigned long ivle
LOAD32L(st->input[14], iv + 0); LOAD32L(st->input[14], iv + 0);
LOAD32L(st->input[15], iv + 4); LOAD32L(st->input[15], iv + 4);
st->ksleft = 0; st->ksleft = 0;
st->ivlen = ivlen;
return CRYPT_OK; return CRYPT_OK;
} }

View File

@ -53,7 +53,8 @@ int chacha_setup(chacha_state *st, const unsigned char *key, unsigned long keyle
LOAD32L(st->input[1], constants + 4); LOAD32L(st->input[1], constants + 4);
LOAD32L(st->input[2], constants + 8); LOAD32L(st->input[2], constants + 8);
LOAD32L(st->input[3], constants + 12); LOAD32L(st->input[3], constants + 12);
st->rounds = rounds; /* e.g. 20 for chacha20 */ st->rounds = rounds; /* e.g. 20 for chacha20 */
st->ivlen = 0; /* will be set later by chacha_ivctr(32|64) */
return CRYPT_OK; return CRYPT_OK;
} }