dh.h revision 76259
176259Sgreen/*	$OpenBSD: dh.h,v 1.5 2001/04/03 19:53:29 markus Exp $	*/
276259Sgreen
369587Sgreen/*
469587Sgreen * Copyright (c) 2000 Niels Provos.  All rights reserved.
569587Sgreen *
669587Sgreen * Redistribution and use in source and binary forms, with or without
769587Sgreen * modification, are permitted provided that the following conditions
869587Sgreen * are met:
969587Sgreen * 1. Redistributions of source code must retain the above copyright
1069587Sgreen *    notice, this list of conditions and the following disclaimer.
1169587Sgreen * 2. Redistributions in binary form must reproduce the above copyright
1269587Sgreen *    notice, this list of conditions and the following disclaimer in the
1369587Sgreen *    documentation and/or other materials provided with the distribution.
1469587Sgreen *
1569587Sgreen * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1669587Sgreen * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1769587Sgreen * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1869587Sgreen * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1969587Sgreen * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2069587Sgreen * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2169587Sgreen * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2269587Sgreen * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2369587Sgreen * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2469587Sgreen * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2569587Sgreen */
2669587Sgreen#ifndef DH_H
2769587Sgreen#define DH_H
2869587Sgreen
2969587Sgreenstruct dhgroup {
3069587Sgreen	int size;
3169587Sgreen	BIGNUM *g;
3269587Sgreen	BIGNUM *p;
3369587Sgreen};
3469587Sgreen
3576259SgreenDH	*choose_dh(int min, int nbits, int max);
3676259SgreenDH	*dh_new_group_asc(const char *, const char *);
3776259SgreenDH	*dh_new_group(BIGNUM *, BIGNUM *);
3876259SgreenDH	*dh_new_group1(void);
3969587Sgreen
4076259Sgreenvoid	dh_gen_key(DH *, int);
4176259Sgreenint	dh_pub_is_valid(DH *dh, BIGNUM *dh_pub);
4276259Sgreen
4376259Sgreenint	dh_estimate(int bits);
4476259Sgreen
4576259Sgreen#define DH_GRP_MIN	1024
4676259Sgreen#define DH_GRP_MAX	8192
4776259Sgreen
4869587Sgreen#endif
49