hash.h revision 255362
165686Smarkm/*-
2255362Smarkm * Copyright (c) 2000-2013 Mark R V Murray
365686Smarkm * All rights reserved.
465686Smarkm *
565686Smarkm * Redistribution and use in source and binary forms, with or without
665686Smarkm * modification, are permitted provided that the following conditions
765686Smarkm * are met:
865686Smarkm * 1. Redistributions of source code must retain the above copyright
965686Smarkm *    notice, this list of conditions and the following disclaimer
1065686Smarkm *    in this position and unchanged.
1165686Smarkm * 2. Redistributions in binary form must reproduce the above copyright
1265686Smarkm *    notice, this list of conditions and the following disclaimer in the
1365686Smarkm *    documentation and/or other materials provided with the distribution.
1465686Smarkm *
1565686Smarkm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1665686Smarkm * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1765686Smarkm * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1865686Smarkm * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1965686Smarkm * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2065686Smarkm * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2165686Smarkm * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2265686Smarkm * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2365686Smarkm * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2465686Smarkm * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2565686Smarkm *
2665686Smarkm * $FreeBSD: head/sys/dev/random/hash.h 255362 2013-09-07 14:15:13Z markm $
2765686Smarkm */
2865686Smarkm
29255362Smarkm#define	KEYSIZE		32	/* (in bytes) == 256 bits */
30255362Smarkm#define	BLOCKSIZE	16	/* (in bytes) == 128 bits */
3165686Smarkm
32255362Smarkmstruct randomdev_hash {		/* Big! Make static! */
33100082Smarkm	SHA256_CTX	sha;
3465686Smarkm};
3565686Smarkm
36255362Smarkmstruct randomdev_key {		/* Big! Make static! */
3774072Smarkm	keyInstance key;	/* Key schedule */
3874072Smarkm	cipherInstance cipher;	/* Rijndael internal */
3965686Smarkm};
4065686Smarkm
41255362Smarkmvoid randomdev_hash_init(struct randomdev_hash *);
42255362Smarkmvoid randomdev_hash_iterate(struct randomdev_hash *, void *, size_t);
43255362Smarkmvoid randomdev_hash_finish(struct randomdev_hash *, void *);
44255362Smarkmvoid randomdev_encrypt_init(struct randomdev_key *, void *);
45255362Smarkmvoid randomdev_encrypt(struct randomdev_key *context, void *, void *, unsigned);
46