Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / nettle / testsuite / rsa2sexp-test.c
blobb4f38a90346c532f1dfe456a63a6ad280b437376
1 #include "testutils.h"
3 #include "buffer.h"
5 void
6 test_main(void)
8 struct rsa_public_key pub;
9 struct rsa_private_key priv;
11 struct nettle_buffer buffer;
13 rsa_public_key_init(&pub);
14 rsa_private_key_init(&priv);
16 mpz_set_str(pub.n,
17 "085c3408989acae4faec3cbbad91c90d34c1d259cd74121a"
18 "36f38b0b51424a9b2be514a04377113a6cdafe79dd7d5f2e"
19 "cc8b5e9661189b86a7b22239907c25", 16);
20 mpz_set_str(pub.e, "36ad4b1d", 16);
22 ASSERT(rsa_public_key_prepare(&pub));
24 mpz_set_str(priv.d,
25 "06ee6d4ff3c239e408150daf8117abfa36a40ad4455d9059"
26 "a86d52f33a2de07418a0a699594588c64810248c9412d554"
27 "f74af947c73c32007e87c92f0937ed", 16);
29 mpz_set_str(priv.p,
30 "03259879b24315e9cf14254824c7935d807cdb6990f414a0"
31 "f65e6065130a611f", 16);
33 mpz_set_str(priv.q,
34 "02a81ba73bad45fc73b36deffce52d1b73e0747f4d8a8264"
35 "8cecd310448ea63b", 16);
37 mpz_set_str(priv.a,
38 "026cbdad5dd0046e093f060ecd5b4ac918e098b0278bb752"
39 "b7cadd6a8944f0b9", 16);
41 mpz_set_str(priv.b,
42 "0148751e622d6d58e3bb094afd6edacf7370351d068e2ce9"
43 "f565c5528c4a7473", 16);
45 mpz_set_str(priv.c,
46 "f8a458ea73a018dc6fa56863e3bc6de405f364f77dee6f09"
47 "62679ea1a8282e", 16);
49 ASSERT(rsa_private_key_prepare(&priv));
51 nettle_buffer_init(&buffer);
52 ASSERT(rsa_keypair_to_sexp(&buffer, "rsa", &pub, &priv));
54 if (verbose)
56 printf("private:");
57 print_hex(buffer.size, buffer.contents);
60 ASSERT(MEMEQ(buffer.size, buffer.contents,
61 H("2831313a707269766174652d6b657928"
62 "333a72736128313a6e36333a085c3408"
63 "989acae4faec3cbbad91c90d34c1d259"
64 "cd74121a36f38b0b51424a9b2be514a0"
65 "4377113a6cdafe79dd7d5f2ecc8b5e96"
66 "61189b86a7b22239907c252928313a65"
67 "343a36ad4b1d2928313a6436333a06ee"
68 "6d4ff3c239e408150daf8117abfa36a4"
69 "0ad4455d9059a86d52f33a2de07418a0"
70 "a699594588c64810248c9412d554f74a"
71 "f947c73c32007e87c92f0937ed292831"
72 "3a7033323a03259879b24315e9cf1425"
73 "4824c7935d807cdb6990f414a0f65e60"
74 "65130a611f2928313a7133323a02a81b"
75 "a73bad45fc73b36deffce52d1b73e074"
76 "7f4d8a82648cecd310448ea63b292831"
77 "3a6133323a026cbdad5dd0046e093f06"
78 "0ecd5b4ac918e098b0278bb752b7cadd"
79 "6a8944f0b92928313a6233323a014875"
80 "1e622d6d58e3bb094afd6edacf737035"
81 "1d068e2ce9f565c5528c4a7473292831"
82 "3a6333323a00f8a458ea73a018dc6fa5"
83 "6863e3bc6de405f364f77dee6f096267"
84 "9ea1a8282e292929")));
86 nettle_buffer_clear(&buffer);
87 ASSERT(rsa_keypair_to_sexp(&buffer, NULL, &pub, NULL));
89 if (verbose)
91 printf("public:");
92 print_hex(buffer.size, buffer.contents);
94 ASSERT(MEMEQ(buffer.size, buffer.contents,
95 H("2831303a7075626c69632d6b65792839"
96 "3a7273612d706b63733128313a6e3633"
97 "3a085c3408989acae4faec3cbbad91c9"
98 "0d34c1d259cd74121a36f38b0b51424a"
99 "9b2be514a04377113a6cdafe79dd7d5f"
100 "2ecc8b5e9661189b86a7b22239907c25"
101 "2928313a65343a36ad4b1d292929")));
103 nettle_buffer_clear(&buffer);
104 rsa_public_key_clear(&pub);
105 rsa_private_key_clear(&priv);