diff options
author | WuKong <rebirthmonkey@gmail.com> | 2015-09-04 09:25:34 +0200 |
---|---|---|
committer | WuKong <rebirthmonkey@gmail.com> | 2015-09-04 09:25:34 +0200 |
commit | 3baeb11a8fbcfcdbc31976d421f17b85503b3ecd (patch) | |
tree | 04891d88c1127148f1b390b5a24414e85b270aee /moon-abe/pbc-0.5.14/include/pbc_mnt.h | |
parent | 67c5b73910f5fc437429c356978081b252a59480 (diff) |
init attribute-based encryption
Change-Id: Iba1a3d722110abf747a0fba366f3ebc911d25b25
Diffstat (limited to 'moon-abe/pbc-0.5.14/include/pbc_mnt.h')
-rw-r--r-- | moon-abe/pbc-0.5.14/include/pbc_mnt.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/moon-abe/pbc-0.5.14/include/pbc_mnt.h b/moon-abe/pbc-0.5.14/include/pbc_mnt.h new file mode 100644 index 00000000..82e4993b --- /dev/null +++ b/moon-abe/pbc-0.5.14/include/pbc_mnt.h @@ -0,0 +1,49 @@ +//requires +// * gmp.h +#ifndef __PBC_MNT_H__ +#define __PBC_MNT_H__ + +struct pbc_cm_s { + mpz_t q; //curve defined over F_q + mpz_t n; //has order n (= q - t + 1) in F_q (and r^2 in F_q^k) + mpz_t h; //h * r = n, r is prime + mpz_t r; + int D; //discrminant needed to find j-invariant + int k; //embedding degree +}; + +typedef struct pbc_cm_s *pbc_cm_ptr; +typedef struct pbc_cm_s pbc_cm_t[1]; + +/*@manual cminfo +Initializes 'cm'. +*/ +void pbc_cm_init(pbc_cm_t cm); +/*@manual cminfo +Clears 'cm'. +*/ +void pbc_cm_clear(pbc_cm_t cm); + +/*@manual cminfo +For a given discriminant D, searches for type D pairings suitable for +cryptography (MNT curves of embedding degree 6). +The group order is at most 'bitlimit' bits. For each set of CM parameters +found, call 'callback' with +pbc_cm_t+ and given +void *+. If the callback +returns nonzero, stops search and returns that value. +Otherwise returns 0. +*/ +int pbc_cm_search_d(int (*callback)(pbc_cm_ptr, void *), void *data, + unsigned int D, unsigned int bitlimit); + +/*@manual cminfo +For a given discriminant D, searches for type G pairings suitable for +cryptography (Freeman curve). +The group order is at most 'bitlimit' bits. For each set of CM parameters +found, call 'callback' with +pbc_cm_t+ and given +void *+. If the callback +returns nonzero, stops search and returns that value. +Otherwise returns 0. +*/ +int pbc_cm_search_g(int (*callback)(pbc_cm_ptr, void *), void *data, + unsigned int D, unsigned int bitlimit); + +#endif //__PBC_MNT_H__ |