1276707Sdes/* $OpenBSD: cipher-aesctr.h,v 1.1 2014/04/29 15:39:33 markus Exp $ */
2276707Sdes/*
3276707Sdes * Copyright (c) 2014 Markus Friedl
4276707Sdes *
5276707Sdes * Permission to use, copy, modify, and distribute this software for any
6276707Sdes * purpose with or without fee is hereby granted, provided that the above
7276707Sdes * copyright notice and this permission notice appear in all copies.
8276707Sdes *
9276707Sdes * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10276707Sdes * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11276707Sdes * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12276707Sdes * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13276707Sdes * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14276707Sdes * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15276707Sdes * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16276707Sdes */
17276707Sdes
18276707Sdes#ifndef OPENSSH_AESCTR_H
19276707Sdes#define OPENSSH_AESCTR_H
20276707Sdes
21276707Sdes#include "rijndael.h"
22276707Sdes
23276707Sdes#define AES_BLOCK_SIZE 16
24276707Sdes
25276707Sdestypedef struct aesctr_ctx {
26276707Sdes	int	rounds;				/* keylen-dependent #rounds */
27276707Sdes	u32	ek[4*(AES_MAXROUNDS + 1)];	/* encrypt key schedule */
28276707Sdes	u8	ctr[AES_BLOCK_SIZE];		/* counter */
29276707Sdes} aesctr_ctx;
30276707Sdes
31276707Sdesvoid aesctr_keysetup(aesctr_ctx *x,const u8 *k,u32 kbits,u32 ivbits);
32276707Sdesvoid aesctr_ivsetup(aesctr_ctx *x,const u8 *iv);
33276707Sdesvoid aesctr_encrypt_bytes(aesctr_ctx *x,const u8 *m,u8 *c,u32 bytes);
34276707Sdes
35276707Sdes#endif
36