Lines Matching refs:ctx
301 DIGEST_CONTEXT *ctx, in digest_mgr_init() argument
304 if (! sess || ! ctx) { in digest_mgr_init()
307 if (ctx->active != FALSE) { in digest_mgr_init()
314 ctx->context_len = sizeof (SHA1_CTX); in digest_mgr_init()
315 ctx->context.sha1ctx = (SHA1_CTX *) in digest_mgr_init()
316 malloc(ctx->context_len); in digest_mgr_init()
317 if (!ctx->context.sha1ctx) in digest_mgr_init()
319 SHA1Init(ctx->context.sha1ctx); in digest_mgr_init()
325 ctx->context_len = sizeof (MD5_CTX); in digest_mgr_init()
326 ctx->context.md5ctx = (MD5_CTX *) in digest_mgr_init()
327 malloc(ctx->context_len); in digest_mgr_init()
328 if (! ctx->context.md5ctx) { in digest_mgr_init()
331 MD5Init(ctx->context.md5ctx); in digest_mgr_init()
339 ctx->mech.ulParameterLen = mech->ulParameterLen; in digest_mgr_init()
340 ctx->mech.mechanism = mech->mechanism; in digest_mgr_init()
341 ctx->mech.pParameter = mech->pParameter; in digest_mgr_init()
342 ctx->multi = FALSE; in digest_mgr_init()
343 ctx->active = TRUE; in digest_mgr_init()
349 digest_mgr_cleanup(DIGEST_CONTEXT *ctx) in digest_mgr_cleanup() argument
351 if (!ctx) { in digest_mgr_cleanup()
354 if (ctx->mech.mechanism == CKM_MD5) { in digest_mgr_cleanup()
355 free(ctx->context.md5ctx); in digest_mgr_cleanup()
356 ctx->context.md5ctx = NULL; in digest_mgr_cleanup()
357 } else if (ctx->mech.mechanism == CKM_SHA_1) { in digest_mgr_cleanup()
358 free(ctx->context.sha1ctx); in digest_mgr_cleanup()
359 ctx->context.sha1ctx = NULL; in digest_mgr_cleanup()
361 ctx->mech.ulParameterLen = 0; in digest_mgr_cleanup()
362 ctx->mech.pParameter = NULL; in digest_mgr_cleanup()
363 ctx->mech.mechanism = 0; in digest_mgr_cleanup()
364 ctx->multi = FALSE; in digest_mgr_cleanup()
365 ctx->active = FALSE; in digest_mgr_cleanup()
366 ctx->context_len = 0; in digest_mgr_cleanup()
374 DIGEST_CONTEXT *ctx, in digest_mgr_digest() argument
381 if (! sess || ! ctx) { in digest_mgr_digest()
384 if (ctx->active == FALSE) { in digest_mgr_digest()
392 if (ctx->multi == TRUE) { in digest_mgr_digest()
395 switch (ctx->mech.mechanism) { in digest_mgr_digest()
399 return (sha1_hash(sess, length_only, ctx, in digest_mgr_digest()
405 return (md5_hash(sess, length_only, ctx, in digest_mgr_digest()
415 DIGEST_CONTEXT *ctx, in digest_mgr_digest_update() argument
419 if (! sess || ! ctx) { in digest_mgr_digest_update()
422 if (ctx->active == FALSE) { in digest_mgr_digest_update()
426 ctx->multi = TRUE; in digest_mgr_digest_update()
428 switch (ctx->mech.mechanism) { in digest_mgr_digest_update()
430 SHA1Update(ctx->context.sha1ctx, data, data_len); in digest_mgr_digest_update()
434 MD5Update(ctx->context.md5ctx, data, data_len); in digest_mgr_digest_update()
443 DIGEST_CONTEXT *ctx, in digest_mgr_digest_key() argument
451 if (!sess || !ctx) { in digest_mgr_digest_key()
473 ctx, attr->pValue, attr->ulValueLen); in digest_mgr_digest_key()
479 DIGEST_CONTEXT *ctx, in digest_mgr_digest_final() argument
483 if (! sess || ! ctx) { in digest_mgr_digest_final()
486 if (ctx->active == FALSE) { in digest_mgr_digest_final()
490 ctx->multi = FALSE; in digest_mgr_digest_final()
494 switch (ctx->mech.mechanism) { in digest_mgr_digest_final()
502 SHA1Final(hash, ctx->context.sha1ctx); in digest_mgr_digest_final()
514 MD5Final(hash, ctx->context.md5ctx); in digest_mgr_digest_final()