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$ 2765686Smarkm */ 2865686Smarkm 29256381Smarkm#ifndef SYS_DEV_RANDOM_HASH_H_INCLUDED 30256381Smarkm#define SYS_DEV_RANDOM_HASH_H_INCLUDED 31256381Smarkm 32255362Smarkm#define KEYSIZE 32 /* (in bytes) == 256 bits */ 33255362Smarkm#define BLOCKSIZE 16 /* (in bytes) == 128 bits */ 3465686Smarkm 35255362Smarkmstruct randomdev_hash { /* Big! Make static! */ 36100082Smarkm SHA256_CTX sha; 3765686Smarkm}; 3865686Smarkm 39255362Smarkmstruct randomdev_key { /* Big! Make static! */ 4074072Smarkm keyInstance key; /* Key schedule */ 4174072Smarkm cipherInstance cipher; /* Rijndael internal */ 4265686Smarkm}; 4365686Smarkm 44255362Smarkmvoid randomdev_hash_init(struct randomdev_hash *); 45255362Smarkmvoid randomdev_hash_iterate(struct randomdev_hash *, void *, size_t); 46255362Smarkmvoid randomdev_hash_finish(struct randomdev_hash *, void *); 47255362Smarkmvoid randomdev_encrypt_init(struct randomdev_key *, void *); 48255362Smarkmvoid randomdev_encrypt(struct randomdev_key *context, void *, void *, unsigned); 49256381Smarkm 50256381Smarkm#endif 51