예제 #1
0
# file "identity_build.py"

from pygroupsig.common_build import ffibuilder

ffibuilder.cdef("""
typedef struct {
uint8_t scheme;
void *id;
} identity_t;
""")

ffibuilder.cdef("""
typedef identity_t* (*identity_init_f)(void);
""")

ffibuilder.cdef("""
typedef int (*identity_free_f)(identity_t *id);
""")

ffibuilder.cdef("""
typedef int (*identity_copy_f)(identity_t *dst, identity_t *src);
""")

ffibuilder.cdef("""
typedef uint8_t (*identity_cmp_f)(identity_t *id1, identity_t *id2);
""")

ffibuilder.cdef("""
typedef char* (*identity_to_string_f)(identity_t *id);
""")
예제 #2
0
# file "trapdoor_build.py"

from pygroupsig.common_build import ffibuilder

ffibuilder.cdef("""
typedef struct {
uint8_t scheme;
void *trap;
} trapdoor_t;
""")

ffibuilder.cdef("""
typedef trapdoor_t* (*trapdoor_init_f)(void);
""")

ffibuilder.cdef("""
typedef int (*trapdoor_free_f)(trapdoor_t *trap);
""")

ffibuilder.cdef("""
typedef int (*trapdoor_copy_f)(trapdoor_t *dst, trapdoor_t *src);
""")

ffibuilder.cdef("""
typedef char* (*trapdoor_to_string_f)(trapdoor_t *trap);
""")

ffibuilder.cdef("""
typedef trapdoor_t* (*trapdoor_from_string_f)(char *strap);
""")
예제 #3
0
int groupsig_convert(groupsig_blindsig_t **csig,
groupsig_blindsig_t **bsig, uint32_t n_bsigs,
groupsig_key_t *grpkey, groupsig_key_t *mgrkey,
groupsig_key_t *bldkey, message_t *msg);

int groupsig_unblind(identity_t *nym, groupsig_signature_t *sig,
groupsig_blindsig_t *bsig,
groupsig_key_t *grpkey, groupsig_key_t *bldkey,
message_t *msg);

int groupsig_get_code_from_str(uint8_t *code, char *name);
"""

ffibuilder.cdef("""
void free(void *);
""")

ffibuilder.cdef(groupsigcdef)

c_header_file = path.Path("../../../src/include/groupsig.h").abspath()
c_include_path = path.Path("../../../src/include").abspath()
c_lib_path = path.Path("../../../build/lib/libgroupsig-static.a").abspath()
c_gl19_path = path.Path("../../../build/lib/libgl19.a").abspath()
c_bbs04_path = path.Path("../../../build/lib/libbbs04.a").abspath()
c_ps16_path = path.Path("../../../build/lib/libps16.a").abspath()
c_klap20_path = path.Path("../../../build/lib/libklap20.a").abspath()
c_dl21_path = path.Path("../../../build/lib/libdl21.a").abspath()
c_dl21seq_path = path.Path("../../../build/lib/libdl21seq.a").abspath()
c_logger_path = path.Path("../../../build/lib/liblogger.a").abspath()
c_msg_path = path.Path("../../../build/lib/libmsg.a").abspath()
예제 #4
0
# file "grp_key_build.py"

from pygroupsig.common_build import ffibuilder
import pygroupsig.key_build

# Define data types

ffibuilder.cdef("""
typedef groupsig_key_init_f grp_key_init_f;
""")

ffibuilder.cdef("""
typedef groupsig_key_free_f grp_key_free_f;
""")

ffibuilder.cdef("""
typedef groupsig_key_copy_f grp_key_copy_f;
""")

ffibuilder.cdef("""
typedef groupsig_key_get_size_f grp_key_get_size_f;
""")

ffibuilder.cdef("""
typedef groupsig_key_prv_get_f grp_key_prv_get_f;
""")

ffibuilder.cdef("""
typedef groupsig_key_pub_get_f grp_key_pub_get_f;
""")
예제 #5
0
# file "signature_build.py"

from pygroupsig.common_build import ffibuilder

ffibuilder.cdef("""
typedef struct {
uint8_t scheme;
void *sig;
} groupsig_signature_t;
""")

ffibuilder.cdef("""
typedef groupsig_signature_t* (*groupsig_signature_init_f)(void);
""")

ffibuilder.cdef("""
typedef int (*groupsig_signature_free_f)(groupsig_signature_t *signature);
""")

ffibuilder.cdef("""
typedef int (*groupsig_signature_copy_f)(
groupsig_signature_t *dst, 
groupsig_signature_t *src);
""")

ffibuilder.cdef("""
typedef int (*groupsig_signature_get_size_f)(
groupsig_signature_t *sig);
""")

ffibuilder.cdef("""
예제 #6
0
# file "gml_build.py"

from pygroupsig.common_build import ffibuilder

ffibuilder.cdef("""
typedef struct {
uint8_t scheme;
uint64_t id; 
void *data; 
} gml_entry_t;
""")

ffibuilder.cdef("""
typedef struct {
uint8_t scheme;
gml_entry_t **entries; 
uint64_t n; 
} gml_t;
""")

ffibuilder.cdef("""
typedef gml_t* (*gml_init_f)(void);
""")

ffibuilder.cdef("""
typedef int (*gml_free_f)(gml_t *gml);
""")

ffibuilder.cdef("""
typedef int (*gml_insert_f)(gml_t *gml, gml_entry_t *entry);
""")
예제 #7
0
# file "gl19_build"

from pygroupsig.common_build import ffibuilder

ffibuilder.cdef("#define GROUPSIG_GL19_CODE 3")
#ffibuilder.cdef('#define GROUPSIG_GL19_NAME "GL19"')
ffibuilder.cdef("#define GL19_JOIN_START 0")
ffibuilder.cdef("#define GL19_JOIN_SEQ 3")

ffibuilder.cdef("""
int gl19_init();
""")

ffibuilder.cdef("""
int gl19_clear();
""")

ffibuilder.cdef("""                
int gl19_setup(groupsig_key_t *grpkey, groupsig_key_t *mgrkey, gml_t *gml);
""")

ffibuilder.cdef("""
int gl19_get_joinseq(uint8_t *seq);
""")

ffibuilder.cdef("""                
int gl19_get_joinstart(uint8_t *start);
""")

ffibuilder.cdef("""
int gl19_join_mem(message_t **mout, groupsig_key_t *memkey,
예제 #8
0
# file "message_build.py"

from pygroupsig.common_build import ffibuilder
import pygroupsig.types_build

ffibuilder.cdef("""                
typedef struct _message_t {
byte_t *bytes;
uint64_t length;
} message_t;
""")

ffibuilder.cdef("""
message_t* message_init(void);
""")

ffibuilder.cdef("""
message_t* message_from_string(char *str);
""")

ffibuilder.cdef("""
message_t* message_from_bytes(byte_t *bytes, uint64_t length);
""")

ffibuilder.cdef("""
int message_free(message_t *msg);
""")

ffibuilder.cdef("""                
int message_set_bytes(message_t *msg, byte_t *bytes, uint64_t length);
""")
예제 #9
0
# file "key_build.py"

from pygroupsig.common_build import ffibuilder

# Define data types
ffibuilder.cdef("""
typedef enum {
GROUPSIG_KEY_GRPKEY, 
GROUPSIG_KEY_MGRKEY,
GROUPSIG_KEY_MEMKEY,
GROUPSIG_KEY_BLDKEY,
} groupsig_key_types;
""")

ffibuilder.cdef("""
typedef struct {
uint8_t scheme;
void *key;
} groupsig_key_t;
""")

ffibuilder.cdef("""
typedef groupsig_key_t* (*groupsig_key_init_f)(void);
""")

ffibuilder.cdef("""
typedef int (*groupsig_key_free_f)(groupsig_key_t *key);
""")

ffibuilder.cdef("""
typedef int (*groupsig_key_copy_f)(
예제 #10
0
# file "bbs04_build"

from pygroupsig.common_build import ffibuilder

ffibuilder.cdef("#define GROUPSIG_BBS04_CODE 1")
#ffibuilder.cdef('#define GROUPSIG_BBS04_NAME "BBS04"')
ffibuilder.cdef("#define BBS04_JOIN_START 0")
ffibuilder.cdef("#define BBS04_JOIN_SEQ 1")

ffibuilder.cdef("""
int bbs04_init();
""")

ffibuilder.cdef("""
int bbs04_clear();
""")

ffibuilder.cdef("""                
int bbs04_setup(
groupsig_key_t *grpkey, 
groupsig_key_t *mgrkey, 
gml_t *gml);
""")

ffibuilder.cdef("""
int bbs04_get_joinseq(uint8_t *seq);
""")

ffibuilder.cdef("""                
int bbs04_get_joinstart(uint8_t *start);
""")
예제 #11
0
# file "klap20_build"

from pygroupsig.common_build import ffibuilder

ffibuilder.cdef("#define GROUPSIG_KLAP20_CODE 5")
#ffibuilder.cdef('#define GROUPSIG_KLAP20_NAME "KLAP20"')
ffibuilder.cdef("#define KLAP20_JOIN_START 0")
ffibuilder.cdef("#define KLAP20_JOIN_SEQ 3")

ffibuilder.cdef("""
int klap20_init();
""")

ffibuilder.cdef("""
int klap20_clear();
""")

ffibuilder.cdef("""                
int klap20_setup(
groupsig_key_t *grpkey, 
groupsig_key_t *mgrkey, 
gml_t *gml);
""")
                
ffibuilder.cdef("""
int klap20_get_joinseq(uint8_t *seq);
""")                

ffibuilder.cdef("""                
int klap20_get_joinstart(uint8_t *start);
""")
예제 #12
0
# file "types_build.py"

from pygroupsig.common_build import ffibuilder

# Define data types
#extern log_t logger;

ffibuilder.cdef("""
#define IOK 0
""")

ffibuilder.cdef("""
#define IERROR 1
""")

ffibuilder.cdef("""
#define IFAIL 2
""")

ffibuilder.cdef("""
#define IEXISTS 3
""")

ffibuilder.cdef("""
typedef unsigned char byte_t;
""")
예제 #13
0
# file "proof_build.py"

from pygroupsig.common_build import ffibuilder

ffibuilder.cdef("""
typedef struct {
uint8_t scheme;
void *proof;
} groupsig_proof_t;
""")

ffibuilder.cdef("""
typedef groupsig_proof_t* (*groupsig_proof_init_f)(void);
""")

ffibuilder.cdef("""
typedef int (*groupsig_proof_free_f)(groupsig_proof_t *proof);
""")

ffibuilder.cdef("""
typedef int (*groupsig_proof_get_size_f)(groupsig_proof_t *proof);
""")

ffibuilder.cdef("""
typedef int (*groupsig_proof_export_f)(
byte_t **bytes,
uint32_t *size,
groupsig_proof_t *proof);
""")

ffibuilder.cdef("""
예제 #14
0
# file "groupsig_build.py"

from pygroupsig.common_build import ffibuilder

#import pygroupsig.grp_key_build
#import pygroupsig.message_build
#import pygroupsig.signature_build
#import pygroupsig.blindsig_build
#import pygroupsig.identity_build

ffibuilder.cdef("""
typedef struct {
uint8_t code; 
char name[10];
uint8_t has_gml;
uint8_t has_crl;
uint8_t has_pbc;
} groupsig_description_t;
""")

ffibuilder.cdef("""
typedef int (*init_f)(void);
""")

ffibuilder.cdef("""
typedef int (*clear_f)(void);  
""")

ffibuilder.cdef("""
typedef int (*setup_f)(groupsig_key_t *grpkey, groupsig_key_t *mgrkey, gml_t *gml);
""")
예제 #15
0
# file "crl_build.py"

from pygroupsig.common_build import ffibuilder

ffibuilder.cdef("""
typedef enum {
CRL_FILE,
CRL_DATABASE,
} crl_format_t;
""")

ffibuilder.cdef("""
typedef struct {
uint8_t scheme;
void **entries;
uint64_t n;
} crl_t;
""")

ffibuilder.cdef("""
typedef crl_t* (*crl_init_f)(void);
""")

ffibuilder.cdef("""
typedef int (*crl_free_f)(crl_t *crl);
""")

ffibuilder.cdef("""
typedef int (*crl_insert_f)(crl_t *crl, void *entry);
""")
예제 #16
0
# file "bld_key_build.py"

from pygroupsig.common_build import ffibuilder

ffibuilder.cdef("""
typedef groupsig_key_init_f bld_key_init_f;
""")

ffibuilder.cdef("""typedef groupsig_key_free_f bld_key_free_f;""")

ffibuilder.cdef("""typedef groupsig_key_copy_f bld_key_copy_f;""")

ffibuilder.cdef("""
typedef groupsig_key_get_size_f bld_key_get_size_f;
""")

ffibuilder.cdef("""typedef groupsig_key_prv_get_f bld_key_prv_get_f;""")

ffibuilder.cdef("""typedef groupsig_key_pub_get_f bld_key_pub_get_f;""")

ffibuilder.cdef("""typedef groupsig_key_prv_set_f bld_key_prv_set_f;""")

ffibuilder.cdef("""typedef groupsig_key_pub_set_f bld_key_pub_set_f;""")

ffibuilder.cdef("""typedef groupsig_key_export_f bld_key_export_f;""")

ffibuilder.cdef("""typedef groupsig_key_pub_export_f bld_key_pub_export_f;""")

ffibuilder.cdef("""typedef groupsig_key_prv_export_f bld_key_prv_export_f;""")

ffibuilder.cdef("""typedef groupsig_key_import_f bld_key_import_f;""")