summaryrefslogtreecommitdiffstats
path: root/regress/usr.bin/ssh/unittests/sshkey/common.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2018-09-13 09:03:20 +0000
committerdjm <djm@openbsd.org>2018-09-13 09:03:20 +0000
commitfdf0c4e1ea80aaab1bf1f47110f87d3dd9900597 (patch)
tree7daba230e4b20bc6bcd976d7b200483717f63fd0 /regress/usr.bin/ssh/unittests/sshkey/common.c
parentWhen unveil(2) was introduced one break from SYS_access case was removed (diff)
downloadwireguard-openbsd-fdf0c4e1ea80aaab1bf1f47110f87d3dd9900597.tar.xz
wireguard-openbsd-fdf0c4e1ea80aaab1bf1f47110f87d3dd9900597.zip
missed a bit of openssl-1.0.x API in this unittest
Diffstat (limited to 'regress/usr.bin/ssh/unittests/sshkey/common.c')
-rw-r--r--regress/usr.bin/ssh/unittests/sshkey/common.c79
1 files changed, 78 insertions, 1 deletions
diff --git a/regress/usr.bin/ssh/unittests/sshkey/common.c b/regress/usr.bin/ssh/unittests/sshkey/common.c
index 4543439d1cd..2c579b127ee 100644
--- a/regress/usr.bin/ssh/unittests/sshkey/common.c
+++ b/regress/usr.bin/ssh/unittests/sshkey/common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.c,v 1.2 2015/01/08 13:10:58 djm Exp $ */
+/* $OpenBSD: common.c,v 1.3 2018/09/13 09:03:20 djm Exp $ */
/*
* Helpers for key API tests
*
@@ -76,3 +76,80 @@ load_bignum(const char *name)
return ret;
}
+const BIGNUM *
+rsa_n(struct sshkey *k)
+{
+ const BIGNUM *n = NULL;
+
+ ASSERT_PTR_NE(k, NULL);
+ ASSERT_PTR_NE(k->rsa, NULL);
+ RSA_get0_key(k->rsa, &n, NULL, NULL);
+ return n;
+}
+
+const BIGNUM *
+rsa_e(struct sshkey *k)
+{
+ const BIGNUM *e = NULL;
+
+ ASSERT_PTR_NE(k, NULL);
+ ASSERT_PTR_NE(k->rsa, NULL);
+ RSA_get0_key(k->rsa, NULL, &e, NULL);
+ return e;
+}
+
+const BIGNUM *
+rsa_p(struct sshkey *k)
+{
+ const BIGNUM *p = NULL;
+
+ ASSERT_PTR_NE(k, NULL);
+ ASSERT_PTR_NE(k->rsa, NULL);
+ RSA_get0_factors(k->rsa, &p, NULL);
+ return p;
+}
+
+const BIGNUM *
+rsa_q(struct sshkey *k)
+{
+ const BIGNUM *q = NULL;
+
+ ASSERT_PTR_NE(k, NULL);
+ ASSERT_PTR_NE(k->rsa, NULL);
+ RSA_get0_factors(k->rsa, NULL, &q);
+ return q;
+}
+
+const BIGNUM *
+dsa_g(struct sshkey *k)
+{
+ const BIGNUM *g = NULL;
+
+ ASSERT_PTR_NE(k, NULL);
+ ASSERT_PTR_NE(k->dsa, NULL);
+ DSA_get0_pqg(k->dsa, NULL, NULL, &g);
+ return g;
+}
+
+const BIGNUM *
+dsa_pub_key(struct sshkey *k)
+{
+ const BIGNUM *pub_key = NULL;
+
+ ASSERT_PTR_NE(k, NULL);
+ ASSERT_PTR_NE(k->dsa, NULL);
+ DSA_get0_key(k->dsa, &pub_key, NULL);
+ return pub_key;
+}
+
+const BIGNUM *
+dsa_priv_key(struct sshkey *k)
+{
+ const BIGNUM *priv_key = NULL;
+
+ ASSERT_PTR_NE(k, NULL);
+ ASSERT_PTR_NE(k->dsa, NULL);
+ DSA_get0_key(k->dsa, NULL, &priv_key);
+ return priv_key;
+}
+