aboutsummaryrefslogtreecommitdiff
path: root/mod/hmac.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-03-01 12:30:12 +0200
committerFrancois Kritzinger <francois@codesynthesis.com>2024-10-15 09:05:27 +0200
commit8d1100fee624c0ba19bc3c06674b80d68dad9596 (patch)
treeec4314047947013508f61fad57af5ef090f78d9d /mod/hmac.cxx
parentbf260eb306aa90485c74217ef9c86c728d11c6da (diff)
Review
Diffstat (limited to 'mod/hmac.cxx')
-rw-r--r--mod/hmac.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/mod/hmac.cxx b/mod/hmac.cxx
index dc9eca0..83a78bd 100644
--- a/mod/hmac.cxx
+++ b/mod/hmac.cxx
@@ -14,9 +14,12 @@ compute_hmac (const options::openssl_options& o,
{
fdpipe errp (fdopen_pipe ()); // stderr pipe.
- // To compute an HMAC over stdin with the key "secret":
+ // To compute an HMAC over stdin with the key <secret>:
//
- // openssl mac -digest SHA256 -macopt "key:secret" HMAC
+ // openssl mac -digest SHA256 -macopt "key:<secret>" HMAC
+ //
+ // Note that here we assume both output and diagnostics will fit into pipe
+ // buffers and don't poll both with fdselect().
//
openssl os (path ("-"), // Read message from openssl::out.
path ("-"), // Write output to openssl::in.
@@ -29,13 +32,13 @@ compute_hmac (const options::openssl_options& o,
ifdstream err (move (errp.in));
- string h; // The HMAC.
+ string h; // The HMAC value.
try
{
- // In case of exception, skip and close input after output.
+ // In case of an exception, skip and close input after output.
//
// Note: re-open in/out so that they get automatically closed on
- // exception.
+ // an exception.
//
ifdstream in (os.in.release (), fdstream_mode::skip);
ofdstream out (os.out.release ());
@@ -45,7 +48,7 @@ compute_hmac (const options::openssl_options& o,
out.write (m.data (), m.size ());
out.close ();
- // Read the HMAC from openssl's output.
+ // Read the HMAC value from openssl's output.
//
h = in.read_text ();
in.close ();