34 static void JPAKE_ZKP_init(
JPAKE_ZKP *zkp)
40 static void JPAKE_ZKP_release(
JPAKE_ZKP *zkp)
47 #define JPAKE_STEP_PART_init JPAKE_STEP2_init
48 #define JPAKE_STEP_PART_release JPAKE_STEP2_release
53 JPAKE_ZKP_init(&p->
zkpx);
58 JPAKE_ZKP_release(&p->
zkpx);
74 static void JPAKE_CTX_init(
JPAKE_CTX *ctx,
const char *name,
75 const char *peer_name,
const BIGNUM *
p,
95 static void JPAKE_CTX_release(
JPAKE_CTX *ctx)
112 memset(ctx,
'\0',
sizeof *ctx);
121 JPAKE_CTX_init(ctx, name, peer_name, p, g, q, secret);
128 JPAKE_CTX_release(ctx);
132 static void hashlength(
SHA_CTX *sha,
size_t l)
142 static void hashstring(
SHA_CTX *sha,
const char *
string)
144 size_t l = strlen(
string);
163 const char *proof_name)
177 hashstring(&sha, proof_name);
202 zkp_hash(h, zkpg, p, ctx->
p.
name);
251 generate_zkp(p, x, g, ctx);
279 generate_step_part(&send->
p1, ctx->
xa, ctx->
p.
g, ctx);
280 generate_step_part(&send->
p2, ctx->
xb, ctx->
p.
g, ctx);
304 if(!is_legal(received->
p1.
gx, ctx))
310 if(!is_legal(received->
p2.
gx, ctx))
317 if(!verify_zkp(&received->
p1, ctx->
p.
g, ctx))
324 if(!verify_zkp(&received->
p2, ctx->
p.
g, ctx))
371 generate_step_part(send, t2, t1, ctx);
430 if(verify_zkp(received, t1, ctx))
435 compute_key(ctx, received->
gx);
444 static void quickhashbn(
unsigned char *md,
const BIGNUM *bn)
458 quickhashbn(send->
hhk, ctx->
key);
468 quickhashbn(hhk, ctx->
key);
469 SHA1(hhk,
sizeof hhk, hhk);
470 if(memcmp(hhk, received->
hhk,
sizeof hhk))
486 quickhashbn(send->
hk, ctx->
key);
495 quickhashbn(hk, ctx->
key);
496 if(memcmp(hk, received->
hk,
sizeof hk))