MCPcopy Create free account
hub / github.com/apache/httpd / sha256_digest

Function sha256_digest

modules/md/md_crypt.c:1116–1142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1114}
1115
1116static apr_status_t sha256_digest(md_data_t **pdigest, apr_pool_t *p, const md_data_t *buf)
1117{
1118 EVP_MD_CTX *ctx = NULL;
1119 md_data_t *digest;
1120 apr_status_t rv = APR_ENOMEM;
1121 unsigned int dlen;
1122
1123 digest = md_data_pmake(EVP_MAX_MD_SIZE, p);
1124 ctx = EVP_MD_CTX_create();
1125 if (ctx) {
1126 rv = APR_ENOTIMPL;
1127 if (EVP_DigestInit_ex(ctx, EVP_sha256(), NULL)) {
1128 rv = APR_EGENERAL;
1129 if (EVP_DigestUpdate(ctx, (unsigned char*)buf->data, buf->len)) {
1130 if (EVP_DigestFinal(ctx, (unsigned char*)digest->data, &dlen)) {
1131 digest->len = dlen;
1132 rv = APR_SUCCESS;
1133 }
1134 }
1135 }
1136 }
1137 if (ctx) {
1138 EVP_MD_CTX_destroy(ctx);
1139 }
1140 *pdigest = (APR_SUCCESS == rv)? digest : NULL;
1141 return rv;
1142}
1143
1144apr_status_t md_crypt_sha256_digest64(const char **pdigest64, apr_pool_t *p, const md_data_t *d)
1145{

Callers 2

md_crypt_sha256_digest64Function · 0.85

Calls 1

md_data_pmakeFunction · 0.85

Tested by

no test coverage detected