updates.
[crypto.git] / lib / silcmath / silcmath.h
index b4892d01654a5f8b108553e78011387fc97bbbdd..0c1141ee493d1c102cc402e0d90b8e4ee95afd4b 100644 (file)
 #ifndef SILCMATH_H
 #define SILCMATH_H
 
-/****f* silcmath/SilcMathAPI/silc_mp_modinv
- *
- * SYNOPSIS
- *
- *    void silc_mp_modinv(SilcInt *inv, SilcInt *a, SilcInt *n);
- *
- * DESCRIPTION
- *
- *    Find multiplicative inverse using Euclid's extended algorithm. 
- *    Computes inverse such that a * inv mod n = 1, where 0 < a < n. 
- *    Algorithm goes like this:
- *  
- *    g(0) = n    v(0) = 0
- *    g(1) = a    v(1) = 1
- * 
- *    y = g(i-1) / g(i)
- *    g(i+1) = g(i-1) - y * g(i) = g(i)-1 mod g(i)
- *    v(i+1) = v(i-1) - y * v(i)
- * 
- *    do until g(i) = 0, then inverse = v(i-1). If inverse is negative then n, 
- *    is added to inverse making it positive again. (Sometimes the algorithm 
- *    has a variable u defined too and it behaves just like v, except that 
- *    initalize values are swapped (i.e. u(0) = 1, u(1) = 0). However, u is 
- *    not needed by the algorithm so it does not have to be included.)
- *
- ***/
-void silc_mp_modinv(SilcInt *inv, SilcInt *a, SilcInt *n);
-
-/****f* silcmath/SilcMathAPI/silc_mp_mp2bin
- *
- * SYNOPSIS
- *
- *    unsigned char *silc_mp_mp2bin(SilcInt *val, uint32 len,
- *                                  uint32 *ret_len);
- *
- * DESCRIPTION
- *
- *    Encodes MP integer into binary data. Returns allocated data that
- *    must be free'd by the caller. If `len' is provided the destination
- *    buffer is allocated that large. If zero then the size is approximated.
- *
- ***/
-unsigned char *silc_mp_mp2bin(SilcInt *val, uint32 len,
-                             uint32 *ret_len);
-
-/****f* silcmath/SilcMathAPI/silc_mp_mp2bin_noalloc
- *
- * SYNOPSIS
- *
- *    void silc_mp_mp2bin_noalloc(SilcInt *val, unsigned char *dst,
- *                                uint32 dst_len);
- *
- * DESCRIPTION
- *
- *    Same as silc_mp_mp2bin but does not allocate any memory.  The
- *    encoded data is returned into `dst' and it's length to the `ret_len'.
- *
- ***/
-void silc_mp_mp2bin_noalloc(SilcInt *val, unsigned char *dst,
-                           uint32 dst_len);
-
-/****f* silcmath/SilcMathAPI/silc_mp_bin2mp
- *
- * SYNOPSIS
- *
- *    void silc_mp_bin2mp(unsigned char *data, uint32 len, SilcInt *ret);
- *
- * DESCRIPTION
- *
- *    Decodes binary data into MP integer. The integer sent as argument
- *    must be initialized.
- *
- ***/
-void silc_mp_bin2mp(unsigned char *data, uint32 len, SilcInt *ret);
-
 /****f* silcmath/SilcMathAPI/silc_math_gen_prime
  *
  * SYNOPSIS