xref: /openbsd-src/sbin/isakmpd/prf.h (revision fb9475d6c32c045a1caf949a79ce84d7f6c7c00a)
1*fb9475d6Sderaadt /* $OpenBSD: prf.h,v 1.10 2004/04/15 18:39:26 deraadt Exp $	 */
201f1f88eSniklas /* $EOM: prf.h,v 1.1 1998/07/11 20:06:22 provos Exp $	 */
32040585eSniklas 
42040585eSniklas /*
52040585eSniklas  * Copyright (c) 1998 Niels Provos.  All rights reserved.
642af7185Sniklas  * Copyright (c) 2001 Niklas Hallqvist.  All rights reserved.
72040585eSniklas  *
82040585eSniklas  * Redistribution and use in source and binary forms, with or without
92040585eSniklas  * modification, are permitted provided that the following conditions
102040585eSniklas  * are met:
112040585eSniklas  * 1. Redistributions of source code must retain the above copyright
122040585eSniklas  *    notice, this list of conditions and the following disclaimer.
132040585eSniklas  * 2. Redistributions in binary form must reproduce the above copyright
142040585eSniklas  *    notice, this list of conditions and the following disclaimer in the
152040585eSniklas  *    documentation and/or other materials provided with the distribution.
162040585eSniklas  *
172040585eSniklas  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
182040585eSniklas  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
192040585eSniklas  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
202040585eSniklas  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
212040585eSniklas  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
222040585eSniklas  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232040585eSniklas  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242040585eSniklas  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252040585eSniklas  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
262040585eSniklas  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272040585eSniklas  */
282040585eSniklas 
292040585eSniklas /*
302040585eSniklas  * This code was written under funding by Ericsson Radio Systems.
312040585eSniklas  */
322040585eSniklas 
332040585eSniklas #ifndef _PRF_H_
342040585eSniklas #define _PRF_H_
352040585eSniklas 
362040585eSniklas /* Enumeration of possible PRF - Pseudo-Random Functions.  */
372040585eSniklas enum prfs {
3817120c27Sderaadt 	PRF_HMAC = 0		/* No PRFs in drafts, this is the default */
392040585eSniklas };
402040585eSniklas 
412040585eSniklas struct prf {
422040585eSniklas 	enum prfs       type;	/* Type of PRF */
432040585eSniklas 	void           *prfctx;	/* Context for PRF */
442040585eSniklas 	u_int8_t        blocksize;	/* The blocksize of PRF */
452040585eSniklas 	void            (*Init) (void *);
462040585eSniklas 	void            (*Update) (void *, unsigned char *, unsigned int);
472040585eSniklas 	void            (*Final) (unsigned char *, void *);
482040585eSniklas };
492040585eSniklas 
502040585eSniklas struct prf_hash_ctx {
512040585eSniklas 	struct hash    *hash;	/* Hash type to use */
522040585eSniklas 	void           *ctx, *ctx2;	/* Contexts we need for later */
532040585eSniklas };
542040585eSniklas 
55f1d529f7Sho struct prf     *prf_alloc(enum prfs, int, unsigned char *, unsigned int);
562040585eSniklas void            prf_free(struct prf *);
572040585eSniklas 
582040585eSniklas #endif				/* _PRF_H_ */
59