]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dcrypt: Add ECDSA_SIG_set0 and ECDSA_SIG_get0 when missing
authorAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 3 Sep 2019 06:10:13 +0000 (09:10 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Mon, 23 Sep 2019 05:47:58 +0000 (08:47 +0300)
These are needed for low-level operations

src/lib-dcrypt/dcrypt-openssl.c

index a4b1c73bd56c40b7d8e2fc5c11ee565f26ac89cc..ba29ff505c5dd02fd8396d94f0f1c39b18795ea9 100644 (file)
@@ -3164,6 +3164,29 @@ dcrypt_openssl_digest(const char *algorithm, const void *data, size_t data_len,
        return ret;
 }
 
+#ifndef HAVE_ECDSA_SIG_GET0
+void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps)
+{
+       i_assert(sig != NULL);
+       *pr = sig->r;
+       *ps = sig->s;
+}
+#endif
+#ifndef HAVE_ECDSA_SIG_SET0
+static int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s)
+{
+       if (sig == NULL || r == NULL || s == NULL) {
+               ECDSAerr(0, ERR_R_PASSED_NULL_PARAMETER);
+               return 0;
+       }
+
+       sig->r = r;
+       sig->s = s;
+
+       return 1;
+}
+#endif
+
 static bool
 dcrypt_openssl_sign_ecdsa(struct dcrypt_private_key *key, const char *algorithm,
                          const void *data, size_t data_len, buffer_t *signature_r,