/*
 * elgamal-gen.c
 *
 * Copyright (C) 2012 Jerônimo C. Pellegrini
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to:
 *   The Free Software Foundation, Inc.,
 *   51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <stdlib.h>
#include <stdio.h>
#include <gmp.h>
#include <math.h>
#include <fcntl.h>
#include <unistd.h>

#include "elgamal.h"



int main() {
	elg_pk pk;
	elg_sk sk;
	
	printf("Using gmp %s\n", gmp_version);
	gen_keys(&pk,&sk);
	
	save_sk(&sk,"sk");
	save_pk(&pk,"pk");

	gmp_printf("n= %Zd\ng= %Zd\nh= %Zd\nx= %Zd\n",
		   sk.n,sk.g,sk.h,sk.x);

	/* Release memory alocated by libmgp */
	clear_elg_pk(pk);
	clear_elg_sk(sk);

	return EXIT_SUCCESS;
}
