digest: support SHA-512/256

Also fix the tests. New implementation tested with GNU libmicrohttpd.
The new numbers in tests are real SHA-512/256 numbers (not just some
random ;) numbers ).
This commit is contained in:
Evgeny Grin 2024-02-08 10:31:12 +01:00 committed by Daniel Stenberg
parent 6d6113e122
commit e3461bbd05
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 40 additions and 13 deletions

View file

@ -67,6 +67,7 @@ http
!SSPI
crypto
proxy
sha512-256
</features>
<name>
HTTP POST --digest with PUT, resumed upload, modified method, SHA-512-256 and userhash=false
@ -92,7 +93,7 @@ Content-Length: 0
GET http://%HOSTIP:%HTTPPORT/%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/%TESTNUMBER", response="3ce1e25ffa611bdbe90e2ab367b9602fa223db9f6de76ac667f0d6157e2178a6", algorithm=SHA-512-256
Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/%TESTNUMBER", response="691867f4a06c79fd0a175c1857e3df7015f6fff3ce8676497d2f1f805b5a8eca", algorithm=SHA-512-256
Content-Range: bytes 2-4/5
User-Agent: curl/%VERSION
Accept: */*

View file

@ -54,6 +54,7 @@ http
<features>
!SSPI
crypto
sha512-256
</features>
<name>
HTTP with RFC7616 SHA-512-256 Digest authorization and userhash=false
@ -73,7 +74,7 @@ Accept: */*
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Authorization: Digest username="testuser", realm="testrealm", nonce="1053604145", uri="/%TESTNUMBER", response="2af735ec3508f4dff99248ffbbe9de9002bfd7cc770cfa2b026cb334042a54e3", algorithm=SHA-512-256
Authorization: Digest username="testuser", realm="testrealm", nonce="1053604145", uri="/%TESTNUMBER", response="9d3256ee6526ec40dd48743bb48e51ee9baba587c78f15c3a86166242150af98", algorithm=SHA-512-256
User-Agent: curl/%VERSION
Accept: */*

View file

@ -54,6 +54,7 @@ http
<features>
!SSPI
crypto
sha512-256
</features>
<name>
HTTP with RFC7616 Digest authorization with bad password, SHA-512-256 and userhash=false
@ -73,7 +74,7 @@ Accept: */*
GET /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Authorization: Digest username="testuser", realm="testrealm", nonce="2053604145", uri="/%TESTNUMBER", response="5a5f20b0e601aeddc6f96422c2332d49ff431c49ab143b5f836ef76e9ac78f5e", algorithm=SHA-512-256
Authorization: Digest username="testuser", realm="testrealm", nonce="2053604145", uri="/%TESTNUMBER", response="0373a49d7d352ff54884faaf762fc6c89281b4112ad8fcbbe1d1ee52dcf7a802", algorithm=SHA-512-256
User-Agent: curl/%VERSION
Accept: */*

View file

@ -52,6 +52,7 @@ http
<features>
!SSPI
crypto
sha512-256
</features>
<name>
HTTP POST --digest with SHA-512-256, userhash=false and user-specified Content-Length header
@ -76,7 +77,7 @@ Content-Type: application/x-www-form-urlencoded
POST /%TESTNUMBER HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/%TESTNUMBER", response="4bc9c97a72f1856bcec9b0e1518c6b7ee28773f91357d56840bdc30bd89ca68f", algorithm=SHA-512-256
Authorization: Digest username="auser", realm="testrealm", nonce="1053604144", uri="/%TESTNUMBER", response="0ba2f7ec8045446588eea82bb0c3812aedb05f4eac8883ea65040a52e9c5629e", algorithm=SHA-512-256
User-Agent: curl/%VERSION
Accept: */*
Content-Length: 11