X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilcmath%2Fsilcmath.h;h=c3e09b470c0c4ac696ff1c6b251fe9a8e50e1868;hb=e7b6c157b80152bf9fb9266e6bdd93f9fb0db776;hp=ef2241bf82eeeedef9d441794cca8f07da2daa31;hpb=ae81323a6c29c176f6dd235aea5f6ce4b42263ea;p=silc.git diff --git a/lib/silcmath/silcmath.h b/lib/silcmath/silcmath.h index ef2241bf..c3e09b47 100644 --- a/lib/silcmath/silcmath.h +++ b/lib/silcmath/silcmath.h @@ -1,24 +1,23 @@ -/****h* silcmath/silcmath.h - * - * NAME - * - * silcmath.h - * - * COPYRIGHT - * - * Author: Pekka Riikonen - * - * Copyright (C) 1997 - 2000 Pekka Riikonen - * - * 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 2 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. +/* + + silcmath.h + + Author: Pekka Riikonen + + Copyright (C) 1997 - 2007 Pekka Riikonen + + 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; version 2 of the License. + + 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. + +*/ + +/****h* silcmath/SILC Math Interface * * DESCRIPTION * @@ -26,29 +25,34 @@ * prime generation, and conversion routines. See the silcmp.h for the * SILC MP interface. * - */ + ***/ #ifndef SILCMATH_H #define SILCMATH_H +#include "silcrng.h" + /****f* silcmath/SilcMathAPI/silc_math_gen_prime * * SYNOPSIS * - * int silc_math_gen_prime(SilcMPInt *prime, uint32 bits, int verbose); + * SilcBool silc_math_gen_prime(SilcMPInt *prime, SilcUInt32 bits, + * SilcBool verbose, SilcRng rng); * * DESCRIPTION * - * Find appropriate prime. It generates a number by taking random bytes. - * It then tests the number that it's not divisible by any of the small - * primes and then it performs Fermat's prime test. I thank Rieks Joosten - * (r.joosten@pijnenburg.nl) for such a good help with prime tests. + * Find appropriate prime. It generates a number by taking random bytes. + * It then tests the number that it's not divisible by any of the small + * primes and then it performs Fermat's prime test. * * If argument verbose is TRUE this will display some status information - * about the progress of generation. + * about the progress of generation. If the `rng' is NULL then global + * RNG is used, if non-NULL then `rng' is used to generate the random + * number number. * ***/ -int silc_math_gen_prime(SilcMPInt *prime, uint32 bits, int verbose); +SilcBool silc_math_gen_prime(SilcMPInt *prime, SilcUInt32 bits, + SilcBool verbose, SilcRng rng); /****f* silcmath/SilcMathAPI/silc_math_prime_test * @@ -58,10 +62,10 @@ int silc_math_gen_prime(SilcMPInt *prime, uint32 bits, int verbose); * * DESCRIPTION * - * Performs primality testings for given number. Returns TRUE if the + * Performs primality testings for given number. Returns TRUE if the * number is probably a prime. * ***/ -int silc_math_prime_test(SilcMPInt *p); +SilcBool silc_math_prime_test(SilcMPInt *p); #endif