JosiahWI commented on code in PR #13350:
URL: https://github.com/apache/trafficserver/pull/13350#discussion_r3673975646
##########
src/iocore/net/unit_tests/test_SSLDHParams.cc:
##########
@@ -140,6 +198,55 @@ init_with_dhparams(char const *dhparams_file)
return ok;
}
+// A fixed-passphrase callback, matching how SSLPrivateKeyHandler consults the
+// SSL_CTX default password callback to decrypt an encrypted private key.
+char test_passphrase[]{"ats-secret-pass"};
+
+int
+fixed_passphrase_cb(char *buf, int size, int /* rwflag */, void * /* u */)
+{
+ int len{static_cast<int>(std::strlen(test_passphrase))};
+ if (len > size) {
+ len = size;
+ }
+ std::memcpy(buf, test_passphrase, len);
+ return len;
Review Comment:
This is a unit test, so I'm not worried about being defensive for the sake
of security. The code is correct as written; the example in the OpenSSL docs
happens to return a null-terminated password, but my understanding is that it
is not required.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]