Merge branch 'master' of github.com:ZoneMinder/ZoneMinder

This commit is contained in:
Isaac Connor 2021-04-11 12:45:07 -04:00
commit d05f03eacd
2 changed files with 22 additions and 20 deletions

View File

@ -1049,9 +1049,10 @@ namespace jwt {
/** /**
* \brief Base class for EdDSA family of algorithms * \brief Base class for EdDSA family of algorithms
* *
* The EdDSA algorithms were introduced in [OpenSSL * https://tools.ietf.org/html/rfc8032
* v1.1.1](https://www.openssl.org/news/openssl-1.1.1-notes.html), so these algorithms are only available when *
* building against this version or higher. * The EdDSA algorithms were introduced in [OpenSSL v1.1.1](https://www.openssl.org/news/openssl-1.1.1-notes.html),
* so these algorithms are only available when building against this version or higher.
*/ */
struct eddsa { struct eddsa {
/** /**
@ -1062,12 +1063,11 @@ namespace jwt {
* \param public_key_password Password to decrypt public key pem. * \param public_key_password Password to decrypt public key pem.
* \param private_key_password Password * \param private_key_password Password
* to decrypt private key pem. * to decrypt private key pem.
* \param md Pointer to hash function
* \param name Name of the algorithm * \param name Name of the algorithm
*/ */
eddsa(const std::string& public_key, const std::string& private_key, const std::string& public_key_password, eddsa(const std::string& public_key, const std::string& private_key, const std::string& public_key_password,
const std::string& private_key_password, const EVP_MD* (*md)(), std::string name) const std::string& private_key_password, std::string name)
: md(md), alg_name(std::move(name)) { : alg_name(std::move(name)) {
if (!private_key.empty()) { if (!private_key.empty()) {
pkey = helper::load_private_key_from_string(private_key, private_key_password); pkey = helper::load_private_key_from_string(private_key, private_key_password);
} else if (!public_key.empty()) { } else if (!public_key.empty()) {
@ -1173,8 +1173,6 @@ namespace jwt {
private: private:
/// OpenSSL struct containing keys /// OpenSSL struct containing keys
std::shared_ptr<EVP_PKEY> pkey; std::shared_ptr<EVP_PKEY> pkey;
/// Hash generator
const EVP_MD* (*md)();
/// algorithm's name /// algorithm's name
const std::string alg_name; const std::string alg_name;
}; };
@ -1453,6 +1451,8 @@ namespace jwt {
/** /**
* Ed25519 algorithm * Ed25519 algorithm
* *
* https://en.wikipedia.org/wiki/EdDSA#Ed25519
*
* Requires at least OpenSSL 1.1.1. * Requires at least OpenSSL 1.1.1.
*/ */
struct ed25519 : public eddsa { struct ed25519 : public eddsa {
@ -1467,12 +1467,14 @@ namespace jwt {
*/ */
explicit ed25519(const std::string& public_key, const std::string& private_key = "", explicit ed25519(const std::string& public_key, const std::string& private_key = "",
const std::string& public_key_password = "", const std::string& private_key_password = "") const std::string& public_key_password = "", const std::string& private_key_password = "")
: eddsa(public_key, private_key, public_key_password, private_key_password, EVP_sha512, "EdDSA") {} : eddsa(public_key, private_key, public_key_password, private_key_password, "EdDSA") {}
}; };
/** /**
* Ed448 algorithm * Ed448 algorithm
* *
* https://en.wikipedia.org/wiki/EdDSA#Ed448
*
* Requires at least OpenSSL 1.1.1. * Requires at least OpenSSL 1.1.1.
*/ */
struct ed448 : public eddsa { struct ed448 : public eddsa {
@ -1487,7 +1489,7 @@ namespace jwt {
*/ */
explicit ed448(const std::string& public_key, const std::string& private_key = "", explicit ed448(const std::string& public_key, const std::string& private_key = "",
const std::string& public_key_password = "", const std::string& private_key_password = "") const std::string& public_key_password = "", const std::string& private_key_password = "")
: eddsa(public_key, private_key, public_key_password, private_key_password, EVP_sha256, "EdDSA") {} : eddsa(public_key, private_key, public_key_password, private_key_password, "EdDSA") {}
}; };
#endif #endif

View File

@ -1414,20 +1414,20 @@ bool LocalCamera::GetCurrentSettings(
if ( verbose ) if ( verbose )
output_ptr += sprintf( output_ptr += sprintf(
output_ptr, output_ptr,
" %s (0x%02hhx%02hhx%02hhx%02hhx)\n", " %s (0x%02x%02x%02x%02x)\n",
format.description, format.description,
(format.pixelformat>>24)&0xff, (format.pixelformat >> 24) & 0xff,
(format.pixelformat>>16)&0xff, (format.pixelformat >> 16) & 0xff,
(format.pixelformat>>8)&0xff, (format.pixelformat >> 8) & 0xff,
format.pixelformat&0xff); format.pixelformat & 0xff);
else else
output_ptr += sprintf( output_ptr += sprintf(
output_ptr, output_ptr,
"0x%02hhx%02hhx%02hhx%02hhx/", "0x%02x%02x%02x%02x/",
(format.pixelformat>>24)&0xff, (format.pixelformat >> 24) & 0xff,
(format.pixelformat>>16)&0xff, (format.pixelformat >> 16) & 0xff,
(format.pixelformat>>8)&0xff, (format.pixelformat >> 8) & 0xff,
(format.pixelformat)&0xff); format.pixelformat & 0xff);
} while ( formatIndex++ >= 0 ); } while ( formatIndex++ >= 0 );
if ( !verbose ) if ( !verbose )