diff options
Diffstat (limited to 'lib/vtls/nss.c')
-rw-r--r-- | lib/vtls/nss.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c index 5434ce382..91727c7c3 100644 --- a/lib/vtls/nss.c +++ b/lib/vtls/nss.c @@ -2041,6 +2041,19 @@ void Curl_nss_md5sum(unsigned char *tmp, /* input */ PK11_DestroyContext(MD5pw, PR_TRUE); } +void Curl_nss_sha256sum(const unsigned char *tmp, /* input */ + size_t tmplen, + unsigned char *sha256sum, /* output */ + size_t sha256len) +{ + PK11Context *SHA256pw = PK11_CreateDigestContext(SEC_OID_SHA256); + unsigned int SHA256out; + + PK11_DigestOp(SHA256pw, tmp, curlx_uztoui(tmplen)); + PK11_DigestFinal(SHA256pw, sha256sum, &SHA256out, curlx_uztoui(sha256len)); + PK11_DestroyContext(SHA256pw, PR_TRUE); +} + bool Curl_nss_cert_status_request(void) { #ifdef SSL_ENABLE_OCSP_STAPLING |