Lines Matching refs:md
433 int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) in EVP_DigestFinal() argument
436 ret = EVP_DigestFinal_ex(ctx, md, size); in EVP_DigestFinal()
442 int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *isize) in EVP_DigestFinal_ex() argument
468 ret = ctx->digest->dfinal(ctx->algctx, md, &size, mdsize); in EVP_DigestFinal_ex()
486 ret = ctx->digest->final(ctx, md); in EVP_DigestFinal_ex()
498 int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *md, size_t size) in EVP_DigestFinalXOF() argument
531 ret = ctx->digest->dfinal(ctx->algctx, md, &size, size); in EVP_DigestFinalXOF()
541 ret = ctx->digest->final(ctx, md); in EVP_DigestFinalXOF()
555 int EVP_DigestSqueeze(EVP_MD_CTX *ctx, unsigned char *md, size_t size) in EVP_DigestSqueeze() argument
572 return ctx->digest->dsqueeze(ctx->algctx, md, &size, size); in EVP_DigestSqueeze()
726 unsigned char *md, unsigned int *size, const EVP_MD *type, in EVP_Digest() argument
737 && EVP_DigestFinal_ex(ctx, md, size); in EVP_Digest()
745 unsigned char *md, size_t *mdlen) in EVP_Q_digest() argument
752 ret = EVP_Digest(data, datalen, md, &temp, digest, NULL); in EVP_Q_digest()
794 const OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md) in EVP_MD_settable_ctx_params() argument
798 if (md != NULL && md->settable_ctx_params != NULL) { in EVP_MD_settable_ctx_params()
799 provctx = ossl_provider_ctx(EVP_MD_get0_provider(md)); in EVP_MD_settable_ctx_params()
800 return md->settable_ctx_params(NULL, provctx); in EVP_MD_settable_ctx_params()
850 const OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md) in EVP_MD_gettable_ctx_params() argument
854 if (md != NULL && md->gettable_ctx_params != NULL) { in EVP_MD_gettable_ctx_params()
855 provctx = ossl_provider_ctx(EVP_MD_get0_provider(md)); in EVP_MD_gettable_ctx_params()
856 return md->gettable_ctx_params(NULL, provctx); in EVP_MD_gettable_ctx_params()
942 EVP_MD *md = OPENSSL_zalloc(sizeof(*md)); in evp_md_new() local
944 if (md != NULL && !CRYPTO_NEW_REF(&md->refcnt, 1)) { in evp_md_new()
945 OPENSSL_free(md); in evp_md_new()
948 return md; in evp_md_new()
982 static int evp_md_cache_constants(EVP_MD *md) in evp_md_cache_constants() argument
1000 ok = evp_do_md_getparams(md, params) > 0; in evp_md_cache_constants()
1004 md->block_size = (int)blksz; in evp_md_cache_constants()
1005 md->md_size = (int)mdsize; in evp_md_cache_constants()
1007 md->flags |= EVP_MD_FLAG_XOF; in evp_md_cache_constants()
1009 md->flags |= EVP_MD_FLAG_DIGALGID_ABSENT; in evp_md_cache_constants()
1019 EVP_MD *md = NULL; in evp_md_from_algorithm() local
1023 if ((md = evp_md_new()) == NULL) { in evp_md_from_algorithm()
1029 md->type = NID_undef; in evp_md_from_algorithm()
1030 if (!evp_names_do_all(prov, name_id, set_legacy_nid, &md->type) in evp_md_from_algorithm()
1031 || md->type == -1) { in evp_md_from_algorithm()
1033 EVP_MD_free(md); in evp_md_from_algorithm()
1038 md->name_id = name_id; in evp_md_from_algorithm()
1039 if ((md->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL) { in evp_md_from_algorithm()
1040 EVP_MD_free(md); in evp_md_from_algorithm()
1043 md->description = algodef->algorithm_description; in evp_md_from_algorithm()
1048 if (md->newctx == NULL) { in evp_md_from_algorithm()
1049 md->newctx = OSSL_FUNC_digest_newctx(fns); in evp_md_from_algorithm()
1054 if (md->dinit == NULL) { in evp_md_from_algorithm()
1055 md->dinit = OSSL_FUNC_digest_init(fns); in evp_md_from_algorithm()
1060 if (md->dupdate == NULL) { in evp_md_from_algorithm()
1061 md->dupdate = OSSL_FUNC_digest_update(fns); in evp_md_from_algorithm()
1066 if (md->dfinal == NULL) { in evp_md_from_algorithm()
1067 md->dfinal = OSSL_FUNC_digest_final(fns); in evp_md_from_algorithm()
1072 if (md->dsqueeze == NULL) { in evp_md_from_algorithm()
1073 md->dsqueeze = OSSL_FUNC_digest_squeeze(fns); in evp_md_from_algorithm()
1078 if (md->digest == NULL) in evp_md_from_algorithm()
1079 md->digest = OSSL_FUNC_digest_digest(fns); in evp_md_from_algorithm()
1083 if (md->freectx == NULL) { in evp_md_from_algorithm()
1084 md->freectx = OSSL_FUNC_digest_freectx(fns); in evp_md_from_algorithm()
1089 if (md->dupctx == NULL) in evp_md_from_algorithm()
1090 md->dupctx = OSSL_FUNC_digest_dupctx(fns); in evp_md_from_algorithm()
1093 if (md->get_params == NULL) in evp_md_from_algorithm()
1094 md->get_params = OSSL_FUNC_digest_get_params(fns); in evp_md_from_algorithm()
1097 if (md->set_ctx_params == NULL) in evp_md_from_algorithm()
1098 md->set_ctx_params = OSSL_FUNC_digest_set_ctx_params(fns); in evp_md_from_algorithm()
1101 if (md->get_ctx_params == NULL) in evp_md_from_algorithm()
1102 md->get_ctx_params = OSSL_FUNC_digest_get_ctx_params(fns); in evp_md_from_algorithm()
1105 if (md->gettable_params == NULL) in evp_md_from_algorithm()
1106 md->gettable_params = OSSL_FUNC_digest_gettable_params(fns); in evp_md_from_algorithm()
1109 if (md->settable_ctx_params == NULL) in evp_md_from_algorithm()
1110 md->settable_ctx_params = in evp_md_from_algorithm()
1114 if (md->gettable_ctx_params == NULL) in evp_md_from_algorithm()
1115 md->gettable_ctx_params = in evp_md_from_algorithm()
1119 if (md->copyctx == NULL) in evp_md_from_algorithm()
1120 md->copyctx = in evp_md_from_algorithm()
1126 || (fncnt == 0 && md->digest == NULL)) { in evp_md_from_algorithm()
1133 EVP_MD_free(md); in evp_md_from_algorithm()
1137 md->prov = prov; in evp_md_from_algorithm()
1141 if (!evp_md_cache_constants(md)) { in evp_md_from_algorithm()
1142 EVP_MD_free(md); in evp_md_from_algorithm()
1144 md = NULL; in evp_md_from_algorithm()
1147 return md; in evp_md_from_algorithm()
1150 static int evp_md_up_ref(void *md) in evp_md_up_ref() argument
1152 return EVP_MD_up_ref(md); in evp_md_up_ref()
1155 static void evp_md_free(void *md) in evp_md_free() argument
1157 EVP_MD_free(md); in evp_md_free()
1163 EVP_MD *md = in EVP_MD_fetch() local
1167 return md; in EVP_MD_fetch()
1170 int EVP_MD_up_ref(EVP_MD *md) in EVP_MD_up_ref() argument
1174 if (md->origin == EVP_ORIG_DYNAMIC) in EVP_MD_up_ref()
1175 CRYPTO_UP_REF(&md->refcnt, &ref); in EVP_MD_up_ref()
1179 void EVP_MD_free(EVP_MD *md) in EVP_MD_free() argument
1183 if (md == NULL || md->origin != EVP_ORIG_DYNAMIC) in EVP_MD_free()
1186 CRYPTO_DOWN_REF(&md->refcnt, &i); in EVP_MD_free()
1189 evp_md_free_int(md); in EVP_MD_free()