Add Apache License version 2.0.
[pbc.git] / include / pbc_mnt.h
blob82e4993b27fb1e76c68e0d8cdbbf4d5cfd12235b
1 //requires
2 // * gmp.h
3 #ifndef __PBC_MNT_H__
4 #define __PBC_MNT_H__
6 struct pbc_cm_s {
7 mpz_t q; //curve defined over F_q
8 mpz_t n; //has order n (= q - t + 1) in F_q (and r^2 in F_q^k)
9 mpz_t h; //h * r = n, r is prime
10 mpz_t r;
11 int D; //discrminant needed to find j-invariant
12 int k; //embedding degree
15 typedef struct pbc_cm_s *pbc_cm_ptr;
16 typedef struct pbc_cm_s pbc_cm_t[1];
18 /*@manual cminfo
19 Initializes 'cm'.
21 void pbc_cm_init(pbc_cm_t cm);
22 /*@manual cminfo
23 Clears 'cm'.
25 void pbc_cm_clear(pbc_cm_t cm);
27 /*@manual cminfo
28 For a given discriminant D, searches for type D pairings suitable for
29 cryptography (MNT curves of embedding degree 6).
30 The group order is at most 'bitlimit' bits. For each set of CM parameters
31 found, call 'callback' with +pbc_cm_t+ and given +void *+. If the callback
32 returns nonzero, stops search and returns that value.
33 Otherwise returns 0.
35 int pbc_cm_search_d(int (*callback)(pbc_cm_ptr, void *), void *data,
36 unsigned int D, unsigned int bitlimit);
38 /*@manual cminfo
39 For a given discriminant D, searches for type G pairings suitable for
40 cryptography (Freeman curve).
41 The group order is at most 'bitlimit' bits. For each set of CM parameters
42 found, call 'callback' with +pbc_cm_t+ and given +void *+. If the callback
43 returns nonzero, stops search and returns that value.
44 Otherwise returns 0.
46 int pbc_cm_search_g(int (*callback)(pbc_cm_ptr, void *), void *data,
47 unsigned int D, unsigned int bitlimit);
49 #endif //__PBC_MNT_H__