int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, unsigned int count) { return ctx->digest->update(ctx,data,(unsigned long)count); }   int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) { int ret; ret=ctx->digest->final(ctx,md); if (size != NULL) *size=ctx->digest->md_size;  memset(ctx->md_data,0,ctx->digest->ctx_size); return ret; }  int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in) { if ((in == NULL) || (in->digest == NULL)) { EVPerr(EVP_F_EVP_MD_CTX_COPY,EVP_R_INPUT_NOT_INITIALIZED); return 0; }  EVP_MD_CTX_cleanup(out); memcpy(out,in,sizeof *out);  if (out->digest->ctx_size) { out->md_data=OPENSSL_malloc(out->digest->ctx_size); memcpy(out->md_data,in->md_data,out->digest->ctx_size); }  if (out->digest->copy) return out->digest->copy(out,in);  return 1; }  int EVP_Digest(void *data, unsigned int count, unsigned char *md, unsigned int *size, const EVP_MD *type) { EVP_MD_CTX ctx; int ret;  EVP_MD_CTX_init(&ctx); EVP_MD_CTX_set_flags(&ctx,EVP_MD_CTX_FLAG_ONESHOT); ret=EVP_DigestInit(&ctx, type) && EVP_DigestUpdate(&ctx, data, count) && EVP_DigestFinal(&ctx, md, size); EVP_MD_CTX_cleanup(&ctx);  return ret; }  void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) { EVP_MD_CTX_cleanup(ctx); OPENSSL_free(ctx); }   int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx) {  if (ctx->digest && ctx->digest->cleanup) ctx->digest->cleanup(ctx); if (ctx->digest && ctx->digest->ctx_size && ctx->md_data) { memset(ctx->md_data,0,ctx->digest->ctx_size); OPENSSL_free(ctx->md_data); } memset(ctx,'\0',sizeof *ctx);  return 1; }
int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)#endif	{	if(ctx->digest != type)		{		if(ctx->digest && ctx->digest->ctx_size)			OPENSSL_free(ctx->md_data);		ctx->digest=type;		if(type->ctx_size)#ifdef CRYPTO_MDEBUG			ctx->md_data=CRYPTO_malloc(type->ctx_size,file,line);#else			ctx->md_data=OPENSSL_malloc(type->ctx_size);#endif		}	return type->init(ctx);	}