mirror of
https://github.com/openbsd/ports.git
synced 2026-06-17 23:13:55 +02:00
2c9c33d37e
Curve Secure Remote Protocol) key sharing and authentication, fixing auth against non-ancient RouterOS versions (previously this was stuck at the versions using the old MD5 protocol, routeros changed in 6.43). works fine against 7.21.3. after a first cut using openssl/3.5, this now uses base libcrypto and patches around OPENSSL_VERSION_NUMBER; they condition on before/after 3.0.0, wanting EC_GROUP_new for older (which we removed but OpenSSL didn't) and EVP_Digest for newer (which we don't yet have), so I'm overriding to 0x030000000 and adding !libressl to the condition for EVP_Digest.
49 lines
2.0 KiB
Plaintext
49 lines
2.0 KiB
Plaintext
Index: src/mtwei.c
|
|
--- src/mtwei.c.orig
|
|
+++ src/mtwei.c
|
|
@@ -245,7 +245,7 @@ abort:
|
|
}
|
|
|
|
void mtwei_id(const char *username, const char *password, const unsigned char *salt, uint8_t *validator_out) {
|
|
-#if OPENSSL_VERSION_NUMBER >= 0x030000000 // 3.0.0
|
|
+#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x030000000 // 3.0.0
|
|
EVP_MD_CTX *mdctx;
|
|
mdctx = EVP_MD_CTX_new();
|
|
EVP_DigestInit_ex2(mdctx, EVP_sha256(), NULL);
|
|
@@ -295,7 +295,7 @@ void mtwei_docrypto(mtwei_state_t *state, BIGNUM *priv
|
|
SHA256_CTX keys;
|
|
CHECKNULL(v = tangle(state, server_pubkey, validator, 1));
|
|
|
|
-#if OPENSSL_VERSION_NUMBER >= 0x030000000 // 3.0.0
|
|
+#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x030000000 // 3.0.0
|
|
EVP_MD_CTX *mdctx;
|
|
mdctx = EVP_MD_CTX_new();
|
|
EVP_DigestInit_ex2(mdctx, EVP_sha256(), NULL);
|
|
@@ -328,7 +328,7 @@ void mtwei_docrypto(mtwei_state_t *state, BIGNUM *priv
|
|
CHECKNULL(z_input = BN_new());
|
|
BN_mod_add(z_input, pt_x, state->w2m, state->mod, state->ctx);
|
|
|
|
-#if OPENSSL_VERSION_NUMBER >= 0x030000000 // 3.0.0
|
|
+#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x030000000 // 3.0.0
|
|
mdctx = EVP_MD_CTX_new();
|
|
EVP_DigestInit_ex2(mdctx, EVP_sha256(), NULL);
|
|
EVP_DigestUpdate(mdctx, buf_out, 32);
|
|
@@ -387,7 +387,7 @@ void mtwei_docryptos(mtwei_state_t *state, BIGNUM *pri
|
|
SHA256_CTX keys;
|
|
CHECKNULL(v = BN_bin2bn(validator, 32, NULL));
|
|
|
|
-#if OPENSSL_VERSION_NUMBER >= 0x030000000 // 3.0.0
|
|
+#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x030000000 // 3.0.0
|
|
EVP_MD_CTX *mdctx;
|
|
mdctx = EVP_MD_CTX_new();
|
|
EVP_DigestInit_ex2(mdctx, EVP_sha256(), NULL);
|
|
@@ -423,7 +423,7 @@ void mtwei_docryptos(mtwei_state_t *state, BIGNUM *pri
|
|
CHECKNULL(z_input = BN_new());
|
|
BN_mod_add(z_input, pt_x, state->w2m, state->mod, state->ctx);
|
|
|
|
-#if OPENSSL_VERSION_NUMBER >= 0x030000000 // 3.0.0
|
|
+#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x030000000 // 3.0.0
|
|
mdctx = EVP_MD_CTX_new();
|
|
EVP_DigestInit_ex2(mdctx, EVP_sha256(), NULL);
|
|
EVP_DigestUpdate(mdctx, buf_out, 32);
|