|
|
|
@ -74,6 +74,10 @@ typedef struct { |
|
|
|
|
typedef struct { |
|
|
|
|
mclBnFr d[7]; |
|
|
|
|
} sheZkpBinEq; |
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
|
mclBnFr d[7]; |
|
|
|
|
} sheZkpDec; |
|
|
|
|
/*
|
|
|
|
|
initialize this library |
|
|
|
|
call this once before using the other functions |
|
|
|
@ -96,6 +100,7 @@ MCLSHE_DLL_API mclSize sheCipherTextGTSerialize(void *buf, mclSize maxBufSize, c |
|
|
|
|
MCLSHE_DLL_API mclSize sheZkpBinSerialize(void *buf, mclSize maxBufSize, const sheZkpBin *zkp); |
|
|
|
|
MCLSHE_DLL_API mclSize sheZkpEqSerialize(void *buf, mclSize maxBufSize, const sheZkpEq *zkp); |
|
|
|
|
MCLSHE_DLL_API mclSize sheZkpBinEqSerialize(void *buf, mclSize maxBufSize, const sheZkpBinEq *zkp); |
|
|
|
|
MCLSHE_DLL_API mclSize sheZkpDecSerialize(void *buf, mclSize maxBufSize, const sheZkpDec *zkp); |
|
|
|
|
|
|
|
|
|
// return read byte size if sucess else 0
|
|
|
|
|
MCLSHE_DLL_API mclSize sheSecretKeyDeserialize(sheSecretKey* sec, const void *buf, mclSize bufSize); |
|
|
|
@ -106,6 +111,7 @@ MCLSHE_DLL_API mclSize sheCipherTextGTDeserialize(sheCipherTextGT* c, const void |
|
|
|
|
MCLSHE_DLL_API mclSize sheZkpBinDeserialize(sheZkpBin* zkp, const void *buf, mclSize bufSize); |
|
|
|
|
MCLSHE_DLL_API mclSize sheZkpEqDeserialize(sheZkpEq* zkp, const void *buf, mclSize bufSize); |
|
|
|
|
MCLSHE_DLL_API mclSize sheZkpBinEqDeserialize(sheZkpBinEq* zkp, const void *buf, mclSize bufSize); |
|
|
|
|
MCLSHE_DLL_API mclSize sheZkpDecDeserialize(sheZkpDec* zkp, const void *buf, mclSize bufSize); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
set secretKey if system has /dev/urandom or CryptGenRandom |
|
|
|
@ -192,6 +198,12 @@ MCLSHE_DLL_API int shePrecomputedPublicKeyEncWithZkpBinEq(sheCipherTextG1 *c1, s |
|
|
|
|
MCLSHE_DLL_API int sheEncWithZkpEq(sheCipherTextG1 *c1, sheCipherTextG2 *c2, sheZkpEq *zkp, const shePublicKey *pub, mclInt m); |
|
|
|
|
MCLSHE_DLL_API int shePrecomputedPublicKeyEncWithZkpEq(sheCipherTextG1 *c1, sheCipherTextG2 *c2, sheZkpEq *zkp, const shePrecomputedPublicKey *ppub, mclInt m); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Zkp s.t. Dec(c) = m |
|
|
|
|
return 0 if success |
|
|
|
|
*/ |
|
|
|
|
MCLSHE_DLL_API int sheDecWithZkpDecG1(mclInt *m, sheZkpDec *zkp, const sheSecretKey *sec, const sheCipherTextG1 *c, const shePublicKey *pub); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
decode c and set m |
|
|
|
|
return 0 if success |
|
|
|
@ -211,6 +223,7 @@ MCLSHE_DLL_API int shePrecomputedPublicKeyVerifyZkpBinG1(const shePrecomputedPub |
|
|
|
|
MCLSHE_DLL_API int shePrecomputedPublicKeyVerifyZkpBinG2(const shePrecomputedPublicKey *ppub, const sheCipherTextG2 *c, const sheZkpBin *zkp); |
|
|
|
|
MCLSHE_DLL_API int shePrecomputedPublicKeyVerifyZkpEq(const shePrecomputedPublicKey *ppub, const sheCipherTextG1 *c1, const sheCipherTextG2 *c2, const sheZkpEq *zkp); |
|
|
|
|
MCLSHE_DLL_API int shePrecomputedPublicKeyVerifyZkpBinEq(const shePrecomputedPublicKey *ppub, const sheCipherTextG1 *c1, const sheCipherTextG2 *c2, const sheZkpBinEq *zkp); |
|
|
|
|
MCLSHE_DLL_API int sheVerifyZkpDecG1(const shePublicKey *pub, const sheCipherTextG1 *c1, mclInt m, const sheZkpDec *zkp); |
|
|
|
|
/*
|
|
|
|
|
decode c via GT and set m |
|
|
|
|
return 0 if success |
|
|
|
|