OPENSSL_free(ctx->p.peer_name);
OPENSSL_free(ctx->p.name);
- memset(ctx, '\0', sizeof *ctx);
+ memset(ctx, 0, sizeof(*ctx));
}
JPAKE_CTX *JPAKE_CTX_new(const char *name, const char *peer_name,
const BIGNUM *p, const BIGNUM *g, const BIGNUM *q,
const BIGNUM *secret)
{
- JPAKE_CTX *ctx = OPENSSL_malloc(sizeof *ctx);
+ JPAKE_CTX *ctx = OPENSSL_malloc(sizeof(*ctx));
if (ctx == NULL)
return NULL;
void JPAKE_CTX_free(JPAKE_CTX *ctx)
{
+ if (!ctx)
+ return;
JPAKE_CTX_release(ctx);
OPENSSL_free(ctx);
}
BIGNUM *h = BN_new();
BIGNUM *t = BN_new();
+ if (r == NULL || h == NULL || t == NULL)
+ goto end;
+
/*-
* r in [0,q)
* XXX: Java chooses r in [0, 2^160) - i.e. distribution not uniform
BIGNUM *t3 = BN_new();
int ret = 0;
+ if (h == NULL || t1 == NULL || t2 == NULL || t3 == NULL)
+ goto end;
+
if (!zkp_hash(h, zkpg, p, ctx->p.peer_name))
goto end;