diff options
author | Richard Levitte <levitte@openssl.org> | 2016-04-02 15:12:58 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2016-04-06 16:19:17 +0200 |
commit | 9862e9aa98ee1e38fbcef8d1dd5db0e750eb5e8d (patch) | |
tree | d7ddbd0b7d4c97875479e3b9cd52fdf579ca2434 /test | |
parent | 3e41ac35281827b59e55d51058cf6bb086c1f2b5 (diff) |
Make the RSA structure opaque
Move rsa_st away from public headers.
Add accessor/writer functions for the public RSA data.
Adapt all other source to use the accessors and writers.
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/rsa_test.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/test/rsa_test.c b/test/rsa_test.c index d5d73e02aa..2bc21b045a 100644 --- a/test/rsa_test.c +++ b/test/rsa_test.c @@ -19,16 +19,19 @@ int main(int argc, char *argv[]) # include <openssl/rsa.h> # define SetKey \ - key->n = BN_bin2bn(n, sizeof(n)-1, key->n); \ - key->e = BN_bin2bn(e, sizeof(e)-1, key->e); \ - key->d = BN_bin2bn(d, sizeof(d)-1, key->d); \ - key->p = BN_bin2bn(p, sizeof(p)-1, key->p); \ - key->q = BN_bin2bn(q, sizeof(q)-1, key->q); \ - key->dmp1 = BN_bin2bn(dmp1, sizeof(dmp1)-1, key->dmp1); \ - key->dmq1 = BN_bin2bn(dmq1, sizeof(dmq1)-1, key->dmq1); \ - key->iqmp = BN_bin2bn(iqmp, sizeof(iqmp)-1, key->iqmp); \ - memcpy(c, ctext_ex, sizeof(ctext_ex) - 1); \ - return (sizeof(ctext_ex) - 1); + RSA_set0_key(key, \ + BN_bin2bn(n, sizeof(n)-1, NULL), \ + BN_bin2bn(e, sizeof(e)-1, NULL), \ + BN_bin2bn(d, sizeof(d)-1, NULL)); \ + RSA_set0_factors(key, \ + BN_bin2bn(p, sizeof(p)-1, NULL), \ + BN_bin2bn(q, sizeof(q)-1, NULL)); \ + RSA_set0_crt_params(key, \ + BN_bin2bn(dmp1, sizeof(dmp1)-1, NULL), \ + BN_bin2bn(dmq1, sizeof(dmq1)-1, NULL), \ + BN_bin2bn(iqmp, sizeof(iqmp)-1, NULL)); \ + memcpy(c, ctext_ex, sizeof(ctext_ex) - 1); \ + return (sizeof(ctext_ex) - 1); static int key1(RSA *key, unsigned char *c) { @@ -243,7 +246,7 @@ int main(int argc, char *argv[]) break; } if (v / 3 >= 1) - key->flags |= RSA_FLAG_NO_CONSTTIME; + RSA_set_flags(key, RSA_FLAG_NO_CONSTTIME); num = RSA_public_encrypt(plen, ptext_ex, ctext, key, RSA_PKCS1_PADDING); |