summaryrefslogtreecommitdiff
path: root/lib/libkeynote
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2022-01-14 09:08:04 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2022-01-14 09:08:04 +0000
commit8fa8f652be902adfa18b0da6fdf6814a98c1030c (patch)
treeef2a3f4bc2a5096ccce819517af4e6b4de3a58fb /lib/libkeynote
parent4d6ca442339b72c640582577ce9072c09a2af2e6 (diff)
libkeynote: fix build with opaque RSA and DSA
This is a completely mechanical conversion to use accessors instead of reaching inside the structs by hand. ok millert
Diffstat (limited to 'lib/libkeynote')
-rw-r--r--lib/libkeynote/auxil.c18
-rw-r--r--lib/libkeynote/signature.c18
2 files changed, 18 insertions, 18 deletions
diff --git a/lib/libkeynote/auxil.c b/lib/libkeynote/auxil.c
index 3e8e4b4d1aa..64071c2493f 100644
--- a/lib/libkeynote/auxil.c
+++ b/lib/libkeynote/auxil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auxil.c,v 1.11 2015/12/14 03:35:40 mmcc Exp $ */
+/* $OpenBSD: auxil.c,v 1.12 2022/01/14 09:08:03 tb Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -53,22 +53,22 @@ keynote_keyhash(void *key, int alg)
{
case KEYNOTE_ALGORITHM_DSA:
dsa = (DSA *) key;
- res += BN_mod_word(dsa->p, HASHTABLESIZE);
- res += BN_mod_word(dsa->q, HASHTABLESIZE);
- res += BN_mod_word(dsa->g, HASHTABLESIZE);
- res += BN_mod_word(dsa->pub_key, HASHTABLESIZE);
+ res += BN_mod_word(DSA_get0_p(dsa), HASHTABLESIZE);
+ res += BN_mod_word(DSA_get0_q(dsa), HASHTABLESIZE);
+ res += BN_mod_word(DSA_get0_g(dsa), HASHTABLESIZE);
+ res += BN_mod_word(DSA_get0_pub_key(dsa), HASHTABLESIZE);
return res % HASHTABLESIZE;
case KEYNOTE_ALGORITHM_RSA:
rsa = (RSA *) key;
- res += BN_mod_word(rsa->n, HASHTABLESIZE);
- res += BN_mod_word(rsa->e, HASHTABLESIZE);
+ res += BN_mod_word(RSA_get0_n(rsa), HASHTABLESIZE);
+ res += BN_mod_word(RSA_get0_e(rsa), HASHTABLESIZE);
return res % HASHTABLESIZE;
case KEYNOTE_ALGORITHM_X509: /* RSA-specific */
rsa = (RSA *) key;
- res += BN_mod_word(rsa->n, HASHTABLESIZE);
- res += BN_mod_word(rsa->e, HASHTABLESIZE);
+ res += BN_mod_word(RSA_get0_n(rsa), HASHTABLESIZE);
+ res += BN_mod_word(RSA_get0_e(rsa), HASHTABLESIZE);
return res % HASHTABLESIZE;
case KEYNOTE_ALGORITHM_BINARY:
diff --git a/lib/libkeynote/signature.c b/lib/libkeynote/signature.c
index 0f428827776..213b4e5dcbd 100644
--- a/lib/libkeynote/signature.c
+++ b/lib/libkeynote/signature.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: signature.c,v 1.28 2022/01/11 12:14:07 tb Exp $ */
+/* $OpenBSD: signature.c,v 1.29 2022/01/14 09:08:03 tb Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
*
@@ -588,10 +588,10 @@ kn_keycompare(void *key1, void *key2, int algorithm)
case KEYNOTE_ALGORITHM_DSA:
p1 = (DSA *) key1;
p2 = (DSA *) key2;
- if (!BN_cmp(p1->p, p2->p) &&
- !BN_cmp(p1->q, p2->q) &&
- !BN_cmp(p1->g, p2->g) &&
- !BN_cmp(p1->pub_key, p2->pub_key))
+ if (!BN_cmp(DSA_get0_p(p1), DSA_get0_p(p2)) &&
+ !BN_cmp(DSA_get0_q(p1), DSA_get0_q(p2)) &&
+ !BN_cmp(DSA_get0_g(p1), DSA_get0_g(p2)) &&
+ !BN_cmp(DSA_get0_pub_key(p1), DSA_get0_pub_key(p2)))
return RESULT_TRUE;
else
return RESULT_FALSE;
@@ -599,8 +599,8 @@ kn_keycompare(void *key1, void *key2, int algorithm)
case KEYNOTE_ALGORITHM_X509:
p3 = (RSA *) key1;
p4 = (RSA *) key2;
- if (!BN_cmp(p3->n, p4->n) &&
- !BN_cmp(p3->e, p4->e))
+ if (!BN_cmp(RSA_get0_n(p3), RSA_get0_n(p4)) &&
+ !BN_cmp(RSA_get0_e(p3), RSA_get0_e(p4)))
return RESULT_TRUE;
else
return RESULT_FALSE;
@@ -608,8 +608,8 @@ kn_keycompare(void *key1, void *key2, int algorithm)
case KEYNOTE_ALGORITHM_RSA:
p3 = (RSA *) key1;
p4 = (RSA *) key2;
- if (!BN_cmp(p3->n, p4->n) &&
- !BN_cmp(p3->e, p4->e))
+ if (!BN_cmp(RSA_get0_n(p3), RSA_get0_n(p4)) &&
+ !BN_cmp(RSA_get0_e(p3), RSA_get0_e(p4)))
return RESULT_TRUE;
else
return RESULT_FALSE;