diff options
author | Salvatore Benedetto <salvatore.benedetto@intel.com> | 2016-06-22 12:49:14 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2016-06-23 06:29:56 -0400 |
commit | 802c7f1c84e4b5a6ac78635878041023fc5831b1 (patch) | |
tree | 2dee2afffbbbb2761fd15fe94af28b93974ff0cf /crypto | |
parent | 4e5f2c400765e3a3ce512dc1ae890bac53401798 (diff) |
crypto: dh - Add DH software implementation
* Implement MPI based Diffie-Hellman under kpp API
* Test provided uses data generad by OpenSSL
Signed-off-by: Salvatore Benedetto <salvatore.benedetto@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/Kconfig | 8 | ||||
-rw-r--r-- | crypto/Makefile | 4 | ||||
-rw-r--r-- | crypto/dh.c | 189 | ||||
-rw-r--r-- | crypto/dh_helper.c | 95 | ||||
-rw-r--r-- | crypto/testmgr.c | 144 | ||||
-rw-r--r-- | crypto/testmgr.h | 230 |
6 files changed, 670 insertions, 0 deletions
diff --git a/crypto/Kconfig b/crypto/Kconfig index e72c4270173d..162d2f9aa242 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig | |||
@@ -111,6 +111,14 @@ config CRYPTO_RSA | |||
111 | help | 111 | help |
112 | Generic implementation of the RSA public key algorithm. | 112 | Generic implementation of the RSA public key algorithm. |
113 | 113 | ||
114 | config CRYPTO_DH | ||
115 | tristate "Diffie-Hellman algorithm" | ||
116 | select CRYPTO_KPP | ||
117 | select MPILIB | ||
118 | help | ||
119 | Generic implementation of the Diffie-Hellman algorithm. | ||
120 | |||
121 | |||
114 | config CRYPTO_MANAGER | 122 | config CRYPTO_MANAGER |
115 | tristate "Cryptographic algorithm manager" | 123 | tristate "Cryptographic algorithm manager" |
116 | select CRYPTO_MANAGER2 | 124 | select CRYPTO_MANAGER2 |
diff --git a/crypto/Makefile b/crypto/Makefile index 07b0f51bd645..82897208e8e0 100644 --- a/crypto/Makefile +++ b/crypto/Makefile | |||
@@ -32,6 +32,10 @@ obj-$(CONFIG_CRYPTO_HASH2) += crypto_hash.o | |||
32 | obj-$(CONFIG_CRYPTO_AKCIPHER2) += akcipher.o | 32 | obj-$(CONFIG_CRYPTO_AKCIPHER2) += akcipher.o |
33 | obj-$(CONFIG_CRYPTO_KPP2) += kpp.o | 33 | obj-$(CONFIG_CRYPTO_KPP2) += kpp.o |
34 | 34 | ||
35 | dh_generic-y := dh.o | ||
36 | dh_generic-y += dh_helper.o | ||
37 | obj-$(CONFIG_CRYPTO_DH) += dh_generic.o | ||
38 | |||
35 | $(obj)/rsapubkey-asn1.o: $(obj)/rsapubkey-asn1.c $(obj)/rsapubkey-asn1.h | 39 | $(obj)/rsapubkey-asn1.o: $(obj)/rsapubkey-asn1.c $(obj)/rsapubkey-asn1.h |
36 | $(obj)/rsaprivkey-asn1.o: $(obj)/rsaprivkey-asn1.c $(obj)/rsaprivkey-asn1.h | 40 | $(obj)/rsaprivkey-asn1.o: $(obj)/rsaprivkey-asn1.c $(obj)/rsaprivkey-asn1.h |
37 | clean-files += rsapubkey-asn1.c rsapubkey-asn1.h | 41 | clean-files += rsapubkey-asn1.c rsapubkey-asn1.h |
diff --git a/crypto/dh.c b/crypto/dh.c new file mode 100644 index 000000000000..5e960fe28681 --- /dev/null +++ b/crypto/dh.c | |||
@@ -0,0 +1,189 @@ | |||
1 | /* Diffie-Hellman Key Agreement Method [RFC2631] | ||
2 | * | ||
3 | * Copyright (c) 2016, Intel Corporation | ||
4 | * Authors: Salvatore Benedetto <salvatore.benedetto@intel.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <crypto/internal/kpp.h> | ||
14 | #include <crypto/kpp.h> | ||
15 | #include <crypto/dh.h> | ||
16 | #include <linux/mpi.h> | ||
17 | |||
18 | struct dh_ctx { | ||
19 | MPI p; | ||
20 | MPI g; | ||
21 | MPI xa; | ||
22 | }; | ||
23 | |||
24 | static inline void dh_clear_params(struct dh_ctx *ctx) | ||
25 | { | ||
26 | mpi_free(ctx->p); | ||
27 | mpi_free(ctx->g); | ||
28 | ctx->p = NULL; | ||
29 | ctx->g = NULL; | ||
30 | } | ||
31 | |||
32 | static void dh_free_ctx(struct dh_ctx *ctx) | ||
33 | { | ||
34 | dh_clear_params(ctx); | ||
35 | mpi_free(ctx->xa); | ||
36 | ctx->xa = NULL; | ||
37 | } | ||
38 | |||
39 | /* | ||
40 | * If base is g we compute the public key | ||
41 | * ya = g^xa mod p; [RFC2631 sec 2.1.1] | ||
42 | * else if base if the counterpart public key we compute the shared secret | ||
43 | * ZZ = yb^xa mod p; [RFC2631 sec 2.1.1] | ||
44 | */ | ||
45 | static int _compute_val(const struct dh_ctx *ctx, MPI base, MPI val) | ||
46 | { | ||
47 | /* val = base^xa mod p */ | ||
48 | return mpi_powm(val, base, ctx->xa, ctx->p); | ||
49 | } | ||
50 | |||
51 | static inline struct dh_ctx *dh_get_ctx(struct crypto_kpp *tfm) | ||
52 | { | ||
53 | return kpp_tfm_ctx(tfm); | ||
54 | } | ||
55 | |||
56 | static int dh_check_params_length(unsigned int p_len) | ||
57 | { | ||
58 | return (p_len < 1536) ? -EINVAL : 0; | ||
59 | } | ||
60 | |||
61 | static int dh_set_params(struct dh_ctx *ctx, struct dh *params) | ||
62 | { | ||
63 | if (unlikely(!params->p || !params->g)) | ||
64 | return -EINVAL; | ||
65 | |||
66 | if (dh_check_params_length(params->p_size << 3)) | ||
67 | return -EINVAL; | ||
68 | |||
69 | ctx->p = mpi_read_raw_data(params->p, params->p_size); | ||
70 | if (!ctx->p) | ||
71 | return -EINVAL; | ||
72 | |||
73 | ctx->g = mpi_read_raw_data(params->g, params->g_size); | ||
74 | if (!ctx->g) { | ||
75 | mpi_free(ctx->p); | ||
76 | return -EINVAL; | ||
77 | } | ||
78 | |||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | static int dh_set_secret(struct crypto_kpp *tfm, void *buf, unsigned int len) | ||
83 | { | ||
84 | struct dh_ctx *ctx = dh_get_ctx(tfm); | ||
85 | struct dh params; | ||
86 | |||
87 | if (crypto_dh_decode_key(buf, len, ¶ms) < 0) | ||
88 | return -EINVAL; | ||
89 | |||
90 | if (dh_set_params(ctx, ¶ms) < 0) | ||
91 | return -EINVAL; | ||
92 | |||
93 | ctx->xa = mpi_read_raw_data(params.key, params.key_size); | ||
94 | if (!ctx->xa) { | ||
95 | dh_clear_params(ctx); | ||
96 | return -EINVAL; | ||
97 | } | ||
98 | |||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | static int dh_compute_value(struct kpp_request *req) | ||
103 | { | ||
104 | struct crypto_kpp *tfm = crypto_kpp_reqtfm(req); | ||
105 | struct dh_ctx *ctx = dh_get_ctx(tfm); | ||
106 | MPI base, val = mpi_alloc(0); | ||
107 | int ret = 0; | ||
108 | int sign; | ||
109 | |||
110 | if (!val) | ||
111 | return -ENOMEM; | ||
112 | |||
113 | if (unlikely(!ctx->xa)) { | ||
114 | ret = -EINVAL; | ||
115 | goto err_free_val; | ||
116 | } | ||
117 | |||
118 | if (req->src) { | ||
119 | base = mpi_read_raw_from_sgl(req->src, req->src_len); | ||
120 | if (!base) { | ||
121 | ret = EINVAL; | ||
122 | goto err_free_val; | ||
123 | } | ||
124 | } else { | ||
125 | base = ctx->g; | ||
126 | } | ||
127 | |||
128 | ret = _compute_val(ctx, base, val); | ||
129 | if (ret) | ||
130 | goto err_free_base; | ||
131 | |||
132 | ret = mpi_write_to_sgl(val, req->dst, &req->dst_len, &sign); | ||
133 | if (ret) | ||
134 | goto err_free_base; | ||
135 | |||
136 | if (sign < 0) | ||
137 | ret = -EBADMSG; | ||
138 | err_free_base: | ||
139 | if (req->src) | ||
140 | mpi_free(base); | ||
141 | err_free_val: | ||
142 | mpi_free(val); | ||
143 | return ret; | ||
144 | } | ||
145 | |||
146 | static int dh_max_size(struct crypto_kpp *tfm) | ||
147 | { | ||
148 | struct dh_ctx *ctx = dh_get_ctx(tfm); | ||
149 | |||
150 | return mpi_get_size(ctx->p); | ||
151 | } | ||
152 | |||
153 | static void dh_exit_tfm(struct crypto_kpp *tfm) | ||
154 | { | ||
155 | struct dh_ctx *ctx = dh_get_ctx(tfm); | ||
156 | |||
157 | dh_free_ctx(ctx); | ||
158 | } | ||
159 | |||
160 | static struct kpp_alg dh = { | ||
161 | .set_secret = dh_set_secret, | ||
162 | .generate_public_key = dh_compute_value, | ||
163 | .compute_shared_secret = dh_compute_value, | ||
164 | .max_size = dh_max_size, | ||
165 | .exit = dh_exit_tfm, | ||
166 | .base = { | ||
167 | .cra_name = "dh", | ||
168 | .cra_driver_name = "dh-generic", | ||
169 | .cra_priority = 100, | ||
170 | .cra_module = THIS_MODULE, | ||
171 | .cra_ctxsize = sizeof(struct dh_ctx), | ||
172 | }, | ||
173 | }; | ||
174 | |||
175 | static int dh_init(void) | ||
176 | { | ||
177 | return crypto_register_kpp(&dh); | ||
178 | } | ||
179 | |||
180 | static void dh_exit(void) | ||
181 | { | ||
182 | crypto_unregister_kpp(&dh); | ||
183 | } | ||
184 | |||
185 | module_init(dh_init); | ||
186 | module_exit(dh_exit); | ||
187 | MODULE_ALIAS_CRYPTO("dh"); | ||
188 | MODULE_LICENSE("GPL"); | ||
189 | MODULE_DESCRIPTION("DH generic algorithm"); | ||
diff --git a/crypto/dh_helper.c b/crypto/dh_helper.c new file mode 100644 index 000000000000..02db76b20d00 --- /dev/null +++ b/crypto/dh_helper.c | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, Intel Corporation | ||
3 | * Authors: Salvatore Benedetto <salvatore.benedetto@intel.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public Licence | ||
7 | * as published by the Free Software Foundation; either version | ||
8 | * 2 of the Licence, or (at your option) any later version. | ||
9 | */ | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/export.h> | ||
12 | #include <linux/err.h> | ||
13 | #include <linux/string.h> | ||
14 | #include <crypto/dh.h> | ||
15 | #include <crypto/kpp.h> | ||
16 | |||
17 | #define DH_KPP_SECRET_MIN_SIZE (sizeof(struct kpp_secret) + 3 * sizeof(int)) | ||
18 | |||
19 | static inline u8 *dh_pack_data(void *dst, const void *src, size_t size) | ||
20 | { | ||
21 | memcpy(dst, src, size); | ||
22 | return dst + size; | ||
23 | } | ||
24 | |||
25 | static inline const u8 *dh_unpack_data(void *dst, const void *src, size_t size) | ||
26 | { | ||
27 | memcpy(dst, src, size); | ||
28 | return src + size; | ||
29 | } | ||
30 | |||
31 | static inline int dh_data_size(const struct dh *p) | ||
32 | { | ||
33 | return p->key_size + p->p_size + p->g_size; | ||
34 | } | ||
35 | |||
36 | int crypto_dh_key_len(const struct dh *p) | ||
37 | { | ||
38 | return DH_KPP_SECRET_MIN_SIZE + dh_data_size(p); | ||
39 | } | ||
40 | EXPORT_SYMBOL_GPL(crypto_dh_key_len); | ||
41 | |||
42 | int crypto_dh_encode_key(char *buf, unsigned int len, const struct dh *params) | ||
43 | { | ||
44 | u8 *ptr = buf; | ||
45 | struct kpp_secret secret = { | ||
46 | .type = CRYPTO_KPP_SECRET_TYPE_DH, | ||
47 | .len = len | ||
48 | }; | ||
49 | |||
50 | if (unlikely(!buf)) | ||
51 | return -EINVAL; | ||
52 | |||
53 | if (len != crypto_dh_key_len(params)) | ||
54 | return -EINVAL; | ||
55 | |||
56 | ptr = dh_pack_data(ptr, &secret, sizeof(secret)); | ||
57 | ptr = dh_pack_data(ptr, ¶ms->key_size, sizeof(params->key_size)); | ||
58 | ptr = dh_pack_data(ptr, ¶ms->p_size, sizeof(params->p_size)); | ||
59 | ptr = dh_pack_data(ptr, ¶ms->g_size, sizeof(params->g_size)); | ||
60 | ptr = dh_pack_data(ptr, params->key, params->key_size); | ||
61 | ptr = dh_pack_data(ptr, params->p, params->p_size); | ||
62 | dh_pack_data(ptr, params->g, params->g_size); | ||
63 | |||
64 | return 0; | ||
65 | } | ||
66 | EXPORT_SYMBOL_GPL(crypto_dh_encode_key); | ||
67 | |||
68 | int crypto_dh_decode_key(const char *buf, unsigned int len, struct dh *params) | ||
69 | { | ||
70 | const u8 *ptr = buf; | ||
71 | struct kpp_secret secret; | ||
72 | |||
73 | if (unlikely(!buf || len < DH_KPP_SECRET_MIN_SIZE)) | ||
74 | return -EINVAL; | ||
75 | |||
76 | ptr = dh_unpack_data(&secret, ptr, sizeof(secret)); | ||
77 | if (secret.type != CRYPTO_KPP_SECRET_TYPE_DH) | ||
78 | return -EINVAL; | ||
79 | |||
80 | ptr = dh_unpack_data(¶ms->key_size, ptr, sizeof(params->key_size)); | ||
81 | ptr = dh_unpack_data(¶ms->p_size, ptr, sizeof(params->p_size)); | ||
82 | ptr = dh_unpack_data(¶ms->g_size, ptr, sizeof(params->g_size)); | ||
83 | if (secret.len != crypto_dh_key_len(params)) | ||
84 | return -EINVAL; | ||
85 | |||
86 | /* Don't allocate memory. Set pointers to data within | ||
87 | * the given buffer | ||
88 | */ | ||
89 | params->key = (void *)ptr; | ||
90 | params->p = (void *)(ptr + params->key_size); | ||
91 | params->g = (void *)(ptr + params->key_size + params->p_size); | ||
92 | |||
93 | return 0; | ||
94 | } | ||
95 | EXPORT_SYMBOL_GPL(crypto_dh_decode_key); | ||
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index b773a563809b..ff79eb887fd0 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <crypto/rng.h> | 32 | #include <crypto/rng.h> |
33 | #include <crypto/drbg.h> | 33 | #include <crypto/drbg.h> |
34 | #include <crypto/akcipher.h> | 34 | #include <crypto/akcipher.h> |
35 | #include <crypto/kpp.h> | ||
35 | 36 | ||
36 | #include "internal.h" | 37 | #include "internal.h" |
37 | 38 | ||
@@ -120,6 +121,11 @@ struct akcipher_test_suite { | |||
120 | unsigned int count; | 121 | unsigned int count; |
121 | }; | 122 | }; |
122 | 123 | ||
124 | struct kpp_test_suite { | ||
125 | struct kpp_testvec *vecs; | ||
126 | unsigned int count; | ||
127 | }; | ||
128 | |||
123 | struct alg_test_desc { | 129 | struct alg_test_desc { |
124 | const char *alg; | 130 | const char *alg; |
125 | int (*test)(const struct alg_test_desc *desc, const char *driver, | 131 | int (*test)(const struct alg_test_desc *desc, const char *driver, |
@@ -134,6 +140,7 @@ struct alg_test_desc { | |||
134 | struct cprng_test_suite cprng; | 140 | struct cprng_test_suite cprng; |
135 | struct drbg_test_suite drbg; | 141 | struct drbg_test_suite drbg; |
136 | struct akcipher_test_suite akcipher; | 142 | struct akcipher_test_suite akcipher; |
143 | struct kpp_test_suite kpp; | ||
137 | } suite; | 144 | } suite; |
138 | }; | 145 | }; |
139 | 146 | ||
@@ -1777,6 +1784,133 @@ static int alg_test_drbg(const struct alg_test_desc *desc, const char *driver, | |||
1777 | 1784 | ||
1778 | } | 1785 | } |
1779 | 1786 | ||
1787 | static int do_test_kpp(struct crypto_kpp *tfm, struct kpp_testvec *vec, | ||
1788 | const char *alg) | ||
1789 | { | ||
1790 | struct kpp_request *req; | ||
1791 | void *input_buf = NULL; | ||
1792 | void *output_buf = NULL; | ||
1793 | struct tcrypt_result result; | ||
1794 | unsigned int out_len_max; | ||
1795 | int err = -ENOMEM; | ||
1796 | struct scatterlist src, dst; | ||
1797 | |||
1798 | req = kpp_request_alloc(tfm, GFP_KERNEL); | ||
1799 | if (!req) | ||
1800 | return err; | ||
1801 | |||
1802 | init_completion(&result.completion); | ||
1803 | |||
1804 | err = crypto_kpp_set_secret(tfm, vec->secret, vec->secret_size); | ||
1805 | if (err < 0) | ||
1806 | goto free_req; | ||
1807 | |||
1808 | out_len_max = crypto_kpp_maxsize(tfm); | ||
1809 | output_buf = kzalloc(out_len_max, GFP_KERNEL); | ||
1810 | if (!output_buf) { | ||
1811 | err = -ENOMEM; | ||
1812 | goto free_req; | ||
1813 | } | ||
1814 | |||
1815 | /* Use appropriate parameter as base */ | ||
1816 | kpp_request_set_input(req, NULL, 0); | ||
1817 | sg_init_one(&dst, output_buf, out_len_max); | ||
1818 | kpp_request_set_output(req, &dst, out_len_max); | ||
1819 | kpp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, | ||
1820 | tcrypt_complete, &result); | ||
1821 | |||
1822 | /* Compute public key */ | ||
1823 | err = wait_async_op(&result, crypto_kpp_generate_public_key(req)); | ||
1824 | if (err) { | ||
1825 | pr_err("alg: %s: generate public key test failed. err %d\n", | ||
1826 | alg, err); | ||
1827 | goto free_output; | ||
1828 | } | ||
1829 | /* Verify calculated public key */ | ||
1830 | if (memcmp(vec->expected_a_public, sg_virt(req->dst), | ||
1831 | vec->expected_a_public_size)) { | ||
1832 | pr_err("alg: %s: generate public key test failed. Invalid output\n", | ||
1833 | alg); | ||
1834 | err = -EINVAL; | ||
1835 | goto free_output; | ||
1836 | } | ||
1837 | |||
1838 | /* Calculate shared secret key by using counter part (b) public key. */ | ||
1839 | input_buf = kzalloc(vec->b_public_size, GFP_KERNEL); | ||
1840 | if (!input_buf) { | ||
1841 | err = -ENOMEM; | ||
1842 | goto free_output; | ||
1843 | } | ||
1844 | |||
1845 | memcpy(input_buf, vec->b_public, vec->b_public_size); | ||
1846 | sg_init_one(&src, input_buf, vec->b_public_size); | ||
1847 | sg_init_one(&dst, output_buf, out_len_max); | ||
1848 | kpp_request_set_input(req, &src, vec->b_public_size); | ||
1849 | kpp_request_set_output(req, &dst, out_len_max); | ||
1850 | kpp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, | ||
1851 | tcrypt_complete, &result); | ||
1852 | err = wait_async_op(&result, crypto_kpp_compute_shared_secret(req)); | ||
1853 | if (err) { | ||
1854 | pr_err("alg: %s: compute shard secret test failed. err %d\n", | ||
1855 | alg, err); | ||
1856 | goto free_all; | ||
1857 | } | ||
1858 | /* | ||
1859 | * verify shared secret from which the user will derive | ||
1860 | * secret key by executing whatever hash it has chosen | ||
1861 | */ | ||
1862 | if (memcmp(vec->expected_ss, sg_virt(req->dst), | ||
1863 | vec->expected_ss_size)) { | ||
1864 | pr_err("alg: %s: compute shared secret test failed. Invalid output\n", | ||
1865 | alg); | ||
1866 | err = -EINVAL; | ||
1867 | } | ||
1868 | |||
1869 | free_all: | ||
1870 | kfree(input_buf); | ||
1871 | free_output: | ||
1872 | kfree(output_buf); | ||
1873 | free_req: | ||
1874 | kpp_request_free(req); | ||
1875 | return err; | ||
1876 | } | ||
1877 | |||
1878 | static int test_kpp(struct crypto_kpp *tfm, const char *alg, | ||
1879 | struct kpp_testvec *vecs, unsigned int tcount) | ||
1880 | { | ||
1881 | int ret, i; | ||
1882 | |||
1883 | for (i = 0; i < tcount; i++) { | ||
1884 | ret = do_test_kpp(tfm, vecs++, alg); | ||
1885 | if (ret) { | ||
1886 | pr_err("alg: %s: test failed on vector %d, err=%d\n", | ||
1887 | alg, i + 1, ret); | ||
1888 | return ret; | ||
1889 | } | ||
1890 | } | ||
1891 | return 0; | ||
1892 | } | ||
1893 | |||
1894 | static int alg_test_kpp(const struct alg_test_desc *desc, const char *driver, | ||
1895 | u32 type, u32 mask) | ||
1896 | { | ||
1897 | struct crypto_kpp *tfm; | ||
1898 | int err = 0; | ||
1899 | |||
1900 | tfm = crypto_alloc_kpp(driver, type | CRYPTO_ALG_INTERNAL, mask); | ||
1901 | if (IS_ERR(tfm)) { | ||
1902 | pr_err("alg: kpp: Failed to load tfm for %s: %ld\n", | ||
1903 | driver, PTR_ERR(tfm)); | ||
1904 | return PTR_ERR(tfm); | ||
1905 | } | ||
1906 | if (desc->suite.kpp.vecs) | ||
1907 | err = test_kpp(tfm, desc->alg, desc->suite.kpp.vecs, | ||
1908 | desc->suite.kpp.count); | ||
1909 | |||
1910 | crypto_free_kpp(tfm); | ||
1911 | return err; | ||
1912 | } | ||
1913 | |||
1780 | static int do_test_rsa(struct crypto_akcipher *tfm, | 1914 | static int do_test_rsa(struct crypto_akcipher *tfm, |
1781 | struct akcipher_testvec *vecs) | 1915 | struct akcipher_testvec *vecs) |
1782 | { | 1916 | { |
@@ -2729,6 +2863,16 @@ static const struct alg_test_desc alg_test_descs[] = { | |||
2729 | } | 2863 | } |
2730 | } | 2864 | } |
2731 | }, { | 2865 | }, { |
2866 | .alg = "dh", | ||
2867 | .test = alg_test_kpp, | ||
2868 | .fips_allowed = 1, | ||
2869 | .suite = { | ||
2870 | .kpp = { | ||
2871 | .vecs = dh_tv_template, | ||
2872 | .count = DH_TEST_VECTORS | ||
2873 | } | ||
2874 | } | ||
2875 | }, { | ||
2732 | .alg = "digest_null", | 2876 | .alg = "digest_null", |
2733 | .test = alg_test_null, | 2877 | .test = alg_test_null, |
2734 | }, { | 2878 | }, { |
diff --git a/crypto/testmgr.h b/crypto/testmgr.h index b70e3c92bedd..78e874eca031 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h | |||
@@ -133,6 +133,17 @@ struct akcipher_testvec { | |||
133 | bool public_key_vec; | 133 | bool public_key_vec; |
134 | }; | 134 | }; |
135 | 135 | ||
136 | struct kpp_testvec { | ||
137 | unsigned char *secret; | ||
138 | unsigned char *b_public; | ||
139 | unsigned char *expected_a_public; | ||
140 | unsigned char *expected_ss; | ||
141 | unsigned short secret_size; | ||
142 | unsigned short b_public_size; | ||
143 | unsigned short expected_a_public_size; | ||
144 | unsigned short expected_ss_size; | ||
145 | }; | ||
146 | |||
136 | static char zeroed_string[48]; | 147 | static char zeroed_string[48]; |
137 | 148 | ||
138 | /* | 149 | /* |
@@ -330,6 +341,225 @@ static struct akcipher_testvec rsa_tv_template[] = { | |||
330 | } | 341 | } |
331 | }; | 342 | }; |
332 | 343 | ||
344 | #define DH_TEST_VECTORS 2 | ||
345 | |||
346 | struct kpp_testvec dh_tv_template[] = { | ||
347 | { | ||
348 | .secret = | ||
349 | #ifdef __LITTLE_ENDIAN | ||
350 | "\x01\x00" /* type */ | ||
351 | "\x11\x02" /* len */ | ||
352 | "\x00\x01\x00\x00" /* key_size */ | ||
353 | "\x00\x01\x00\x00" /* p_size */ | ||
354 | "\x01\x00\x00\x00" /* g_size */ | ||
355 | #else | ||
356 | "\x00\x01" /* type */ | ||
357 | "\x02\x11" /* len */ | ||
358 | "\x00\x00\x01\x00" /* key_size */ | ||
359 | "\x00\x00\x01\x00" /* p_size */ | ||
360 | "\x00\x00\x00\x01" /* g_size */ | ||
361 | #endif | ||
362 | /* xa */ | ||
363 | "\x44\xc1\x48\x36\xa7\x2b\x6f\x4e\x43\x03\x68\xad\x31\x00\xda\xf3" | ||
364 | "\x2a\x01\xa8\x32\x63\x5f\x89\x32\x1f\xdf\x4c\xa1\x6a\xbc\x10\x15" | ||
365 | "\x90\x35\xc9\x26\x41\xdf\x7b\xaa\x56\x56\x3d\x85\x44\xb5\xc0\x8e" | ||
366 | "\x37\x83\x06\x50\xb3\x5f\x0e\x28\x2c\xd5\x46\x15\xe3\xda\x7d\x74" | ||
367 | "\x87\x13\x91\x4f\xd4\x2d\xf6\xc7\x5e\x14\x2c\x11\xc2\x26\xb4\x3a" | ||
368 | "\xe3\xb2\x36\x20\x11\x3b\x22\xf2\x06\x65\x66\xe2\x57\x58\xf8\x22" | ||
369 | "\x1a\x94\xbd\x2b\x0e\x8c\x55\xad\x61\x23\x45\x2b\x19\x1e\x63\x3a" | ||
370 | "\x13\x61\xe3\xa0\x79\x70\x3e\x6d\x98\x32\xbc\x7f\x82\xc3\x11\xd8" | ||
371 | "\xeb\x53\xb5\xfc\xb5\xd5\x3c\x4a\xea\x92\x3e\x01\xce\x15\x65\xd4" | ||
372 | "\xaa\x85\xc1\x11\x90\x83\x31\x6e\xfe\xe7\x7f\x7d\xed\xab\xf9\x29" | ||
373 | "\xf8\xc7\xf1\x68\xc6\xb7\xe4\x1f\x2f\x28\xa0\xc9\x1a\x50\x64\x29" | ||
374 | "\x4b\x01\x6d\x1a\xda\x46\x63\x21\x07\x40\x8c\x8e\x4c\x6f\xb5\xe5" | ||
375 | "\x12\xf3\xc2\x1b\x48\x27\x5e\x27\x01\xb1\xaa\xed\x68\x9b\x83\x18" | ||
376 | "\x8f\xb1\xeb\x1f\x04\xd1\x3c\x79\xed\x4b\xf7\x0a\x33\xdc\xe0\xc6" | ||
377 | "\xd8\x02\x51\x59\x00\x74\x30\x07\x4c\x2d\xac\xe4\x13\xf1\x80\xf0" | ||
378 | "\xce\xfa\xff\xa9\xce\x29\x46\xdd\x9d\xad\xd1\xc3\xc6\x58\x1a\x63" | ||
379 | /* p */ | ||
380 | "\xb9\x36\x3a\xf1\x82\x1f\x60\xd3\x22\x47\xb8\xbc\x2d\x22\x6b\x81" | ||
381 | "\x7f\xe8\x20\x06\x09\x23\x73\x49\x9a\x59\x8b\x35\x25\xf8\x31\xbc" | ||
382 | "\x7d\xa8\x1c\x9d\x56\x0d\x1a\xf7\x4b\x4f\x96\xa4\x35\x77\x6a\x89" | ||
383 | "\xab\x42\x00\x49\x21\x71\xed\x28\x16\x1d\x87\x5a\x10\xa7\x9c\x64" | ||
384 | "\x94\xd4\x87\x3d\x28\xef\x44\xfe\x4b\xe2\xb4\x15\x8c\x82\xa6\xf3" | ||
385 | "\x50\x5f\xa8\xe8\xa2\x60\xe7\x00\x86\x78\x05\xd4\x78\x19\xa1\x98" | ||
386 | "\x62\x4e\x4a\x00\x78\x56\x96\xe6\xcf\xd7\x10\x1b\x74\x5d\xd0\x26" | ||
387 | "\x61\xdb\x6b\x32\x09\x51\xd8\xa5\xfd\x54\x16\x71\x01\xb3\x39\xe6" | ||
388 | "\x4e\x69\xb1\xd7\x06\x8f\xd6\x1e\xdc\x72\x25\x26\x74\xc8\x41\x06" | ||
389 | "\x5c\xd1\x26\x5c\xb0\x2f\xf9\x59\x13\xc1\x2a\x0f\x78\xea\x7b\xf7" | ||
390 | "\xbd\x59\xa0\x90\x1d\xfc\x33\x5b\x4c\xbf\x05\x9c\x3a\x3f\x69\xa2" | ||
391 | "\x45\x61\x4e\x10\x6a\xb3\x17\xc5\x68\x30\xfb\x07\x5f\x34\xc6\xfb" | ||
392 | "\x73\x07\x3c\x70\xf6\xae\xe7\x72\x84\xc3\x18\x81\x8f\xe8\x11\x1f" | ||
393 | "\x3d\x83\x83\x01\x2a\x14\x73\xbf\x32\x32\x2e\xc9\x4d\xdb\x2a\xca" | ||
394 | "\xee\x71\xf9\xda\xad\xe8\x82\x0b\x4d\x0c\x1f\xb6\x1d\xef\x00\x67" | ||
395 | "\x74\x3d\x95\xe0\xb7\xc4\x30\x8a\x24\x87\x12\x47\x27\x70\x0d\x73" | ||
396 | /* g */ | ||
397 | "\x02", | ||
398 | .b_public = | ||
399 | "\x2a\x67\x5c\xfd\x63\x5d\xc0\x97\x0a\x8b\xa2\x1f\xf8\x8a\xcb\x54" | ||
400 | "\xca\x2f\xd3\x49\x3f\x01\x8e\x87\xfe\xcc\x94\xa0\x3e\xd4\x26\x79" | ||
401 | "\x9a\x94\x3c\x11\x81\x58\x5c\x60\x3d\xf5\x98\x90\x89\x64\x62\x1f" | ||
402 | "\xbd\x05\x6d\x2b\xcd\x84\x40\x9b\x4a\x1f\xe0\x19\xf1\xca\x20\xb3" | ||
403 | "\x4e\xa0\x4f\x15\xcc\xa5\xfe\xa5\xb4\xf5\x0b\x18\x7a\x5a\x37\xaa" | ||
404 | "\x58\x00\x19\x7f\xe2\xa3\xd9\x1c\x44\x57\xcc\xde\x2e\xc1\x38\xea" | ||
405 | "\xeb\xe3\x90\x40\xc4\x6c\xf7\xcd\xe9\x22\x50\x71\xf5\x7c\xdb\x37" | ||
406 | "\x0e\x80\xc3\xed\x7e\xb1\x2b\x2f\xbe\x71\xa6\x11\xa5\x9d\xf5\x39" | ||
407 | "\xf1\xa2\xe5\x85\xbc\x25\x91\x4e\x84\x8d\x26\x9f\x4f\xe6\x0f\xa6" | ||
408 | "\x2b\x6b\xf9\x0d\xaf\x6f\xbb\xfa\x2d\x79\x15\x31\x57\xae\x19\x60" | ||
409 | "\x22\x0a\xf5\xfd\x98\x0e\xbf\x5d\x49\x75\x58\x37\xbc\x7f\xf5\x21" | ||
410 | "\x56\x1e\xd5\xb3\x50\x0b\xca\x96\xf3\xd1\x3f\xb3\x70\xa8\x6d\x63" | ||
411 | "\x48\xfb\x3d\xd7\x29\x91\x45\xb5\x48\xcd\xb6\x78\x30\xf2\x3f\x1e" | ||
412 | "\xd6\x22\xd6\x35\x9b\xf9\x1f\x85\xae\xab\x4b\xd7\xe0\xc7\x86\x67" | ||
413 | "\x3f\x05\x7f\xa6\x0d\x2f\x0d\xbf\x53\x5f\x4d\x2c\x6d\x5e\x57\x40" | ||
414 | "\x30\x3a\x23\x98\xf9\xb4\x32\xf5\x32\x83\xdd\x0b\xae\x33\x97\x2f", | ||
415 | .expected_a_public = | ||
416 | "\x5c\x24\xdf\xeb\x5b\x4b\xf8\xc5\xef\x39\x48\x82\xe0\x1e\x62\xee" | ||
417 | "\x8a\xae\xdf\x93\x6c\x2b\x16\x95\x92\x16\x3f\x16\x7b\x75\x03\x85" | ||
418 | "\xd9\xf1\x69\xc2\x14\x87\x45\xfc\xa4\x19\xf6\xf0\xa4\xf3\xec\xd4" | ||
419 | "\x6c\x5c\x03\x3b\x94\xc2\x2f\x92\xe4\xce\xb3\xe4\x72\xe8\x17\xe6" | ||
420 | "\x23\x7e\x00\x01\x09\x59\x13\xbf\xc1\x2f\x99\xa9\x07\xaa\x02\x23" | ||
421 | "\x4a\xca\x39\x4f\xbc\xec\x0f\x27\x4f\x19\x93\x6c\xb9\x30\x52\xfd" | ||
422 | "\x2b\x9d\x86\xf1\x06\x1e\xb6\x56\x27\x4a\xc9\x8a\xa7\x8a\x48\x5e" | ||
423 | "\xb5\x60\xcb\xdf\xff\x03\x26\x10\xbf\x90\x8f\x46\x60\xeb\x9b\x9a" | ||
424 | "\xd6\x6f\x44\x91\x03\x92\x18\x2c\x96\x5e\x40\x19\xfb\xf4\x4f\x3a" | ||
425 | "\x02\x7b\xaf\xcc\x22\x20\x79\xb9\xf8\x9f\x8f\x85\x6b\xec\x44\xbb" | ||
426 | "\xe6\xa8\x8e\xb1\xe8\x2c\xee\x64\xee\xf8\xbd\x00\xf3\xe2\x2b\x93" | ||
427 | "\xcd\xe7\xc4\xdf\xc9\x19\x46\xfe\xb6\x07\x73\xc1\x8a\x64\x79\x26" | ||
428 | "\xe7\x30\xad\x2a\xdf\xe6\x8f\x59\xf5\x81\xbf\x4a\x29\x91\xe7\xb7" | ||
429 | "\xcf\x48\x13\x27\x75\x79\x40\xd9\xd6\x32\x52\x4e\x6a\x86\xae\x6f" | ||
430 | "\xc2\xbf\xec\x1f\xc2\x69\xb2\xb6\x59\xe5\xa5\x17\xa4\x77\xb7\x62" | ||
431 | "\x46\xde\xe8\xd2\x89\x78\x9a\xef\xa3\xb5\x8f\x26\xec\x80\xda\x39", | ||
432 | .expected_ss = | ||
433 | "\x8f\xf3\xac\xa2\xea\x22\x11\x5c\x45\x65\x1a\x77\x75\x2e\xcf\x46" | ||
434 | "\x23\x14\x1e\x67\x53\x4d\x35\xb0\x38\x1d\x4e\xb9\x41\x9a\x21\x24" | ||
435 | "\x6e\x9f\x40\xfe\x90\x51\xb1\x06\xa4\x7b\x87\x17\x2f\xe7\x5e\x22" | ||
436 | "\xf0\x7b\x54\x84\x0a\xac\x0a\x90\xd2\xd7\xe8\x7f\xe7\xe3\x30\x75" | ||
437 | "\x01\x1f\x24\x75\x56\xbe\xcc\x8d\x1e\x68\x0c\x41\x72\xd3\xfa\xbb" | ||
438 | "\xe5\x9c\x60\xc7\x28\x77\x0c\xbe\x89\xab\x08\xd6\x21\xe7\x2e\x1a" | ||
439 | "\x58\x7a\xca\x4f\x22\xf3\x2b\x30\xfd\xf4\x98\xc1\xa3\xf8\xf6\xcc" | ||
440 | "\xa9\xe4\xdb\x5b\xee\xd5\x5c\x6f\x62\x4c\xd1\x1a\x02\x2a\x23\xe4" | ||
441 | "\xb5\x57\xf3\xf9\xec\x04\x83\x54\xfe\x08\x5e\x35\xac\xfb\xa8\x09" | ||
442 | "\x82\x32\x60\x11\xb2\x16\x62\x6b\xdf\xda\xde\x9c\xcb\x63\x44\x6c" | ||
443 | "\x59\x26\x6a\x8f\xb0\x24\xcb\xa6\x72\x48\x1e\xeb\xe0\xe1\x09\x44" | ||
444 | "\xdd\xee\x66\x6d\x84\xcf\xa5\xc1\xb8\x36\x74\xd3\x15\x96\xc3\xe4" | ||
445 | "\xc6\x5a\x4d\x23\x97\x0c\x5c\xcb\xa9\xf5\x29\xc2\x0e\xff\x93\x82" | ||
446 | "\xd3\x34\x49\xad\x64\xa6\xb1\xc0\x59\x28\x75\x60\xa7\x8a\xb0\x11" | ||
447 | "\x56\x89\x42\x74\x11\xf5\xf6\x5e\x6f\x16\x54\x6a\xb1\x76\x4d\x50" | ||
448 | "\x8a\x68\xc1\x5b\x82\xb9\x0d\x00\x32\x50\xed\x88\x87\x48\x92\x17", | ||
449 | .secret_size = 529, | ||
450 | .b_public_size = 256, | ||
451 | .expected_a_public_size = 256, | ||
452 | .expected_ss_size = 256, | ||
453 | }, | ||
454 | { | ||
455 | .secret = | ||
456 | #ifdef __LITTLE_ENDIAN | ||
457 | "\x01\x00" /* type */ | ||
458 | "\x11\x02" /* len */ | ||
459 | "\x00\x01\x00\x00" /* key_size */ | ||
460 | "\x00\x01\x00\x00" /* p_size */ | ||
461 | "\x01\x00\x00\x00" /* g_size */ | ||
462 | #else | ||
463 | "\x00\x01" /* type */ | ||
464 | "\x02\x11" /* len */ | ||
465 | "\x00\x00\x01\x00" /* key_size */ | ||
466 | "\x00\x00\x01\x00" /* p_size */ | ||
467 | "\x00\x00\x00\x01" /* g_size */ | ||
468 | #endif | ||
469 | /* xa */ | ||
470 | "\x4d\x75\xa8\x6e\xba\x23\x3a\x0c\x63\x56\xc8\xc9\x5a\xa7\xd6\x0e" | ||
471 | "\xed\xae\x40\x78\x87\x47\x5f\xe0\xa7\x7b\xba\x84\x88\x67\x4e\xe5" | ||
472 | "\x3c\xcc\x5c\x6a\xe7\x4a\x20\xec\xbe\xcb\xf5\x52\x62\x9f\x37\x80" | ||
473 | "\x0c\x72\x7b\x83\x66\xa4\xf6\x7f\x95\x97\x1c\x6a\x5c\x7e\xf1\x67" | ||
474 | "\x37\xb3\x93\x39\x3d\x0b\x55\x35\xd9\xe5\x22\x04\x9f\xf8\xc1\x04" | ||
475 | "\xce\x13\xa5\xac\xe1\x75\x05\xd1\x2b\x53\xa2\x84\xef\xb1\x18\xf4" | ||
476 | "\x66\xdd\xea\xe6\x24\x69\x5a\x49\xe0\x7a\xd8\xdf\x1b\xb7\xf1\x6d" | ||
477 | "\x9b\x50\x2c\xc8\x1c\x1c\xa3\xb4\x37\xfb\x66\x3f\x67\x71\x73\xa9" | ||
478 | "\xff\x5f\xd9\xa2\x25\x6e\x25\x1b\x26\x54\xbf\x0c\xc6\xdb\xea\x0a" | ||
479 | "\x52\x6c\x16\x7c\x27\x68\x15\x71\x58\x73\x9d\xe6\xc2\x80\xaa\x97" | ||
480 | "\x31\x66\xfb\xa6\xfb\xfd\xd0\x9c\x1d\xbe\x81\x48\xf5\x9a\x32\xf1" | ||
481 | "\x69\x62\x18\x78\xae\x72\x36\xe6\x94\x27\xd1\xff\x18\x4f\x28\x6a" | ||
482 | "\x16\xbd\x6a\x60\xee\xe5\xf9\x6d\x16\xe4\xb8\xa6\x41\x9b\x23\x7e" | ||
483 | "\xf7\x9d\xd1\x1d\x03\x15\x66\x3a\xcf\xb6\x2c\x13\x96\x2c\x52\x21" | ||
484 | "\xe4\x2d\x48\x7a\x8a\x5d\xb2\x88\xed\x98\x61\x79\x8b\x6a\x1e\x5f" | ||
485 | "\xd0\x8a\x2d\x99\x5a\x2b\x0f\xbc\xef\x53\x8f\x32\xc1\xa2\x99\x26" | ||
486 | /* p */ | ||
487 | "\xb9\x36\x3a\xf1\x82\x1f\x60\xd3\x22\x47\xb8\xbc\x2d\x22\x6b\x81" | ||
488 | "\x7f\xe8\x20\x06\x09\x23\x73\x49\x9a\x59\x8b\x35\x25\xf8\x31\xbc" | ||
489 | "\x7d\xa8\x1c\x9d\x56\x0d\x1a\xf7\x4b\x4f\x96\xa4\x35\x77\x6a\x89" | ||
490 | "\xab\x42\x00\x49\x21\x71\xed\x28\x16\x1d\x87\x5a\x10\xa7\x9c\x64" | ||
491 | "\x94\xd4\x87\x3d\x28\xef\x44\xfe\x4b\xe2\xb4\x15\x8c\x82\xa6\xf3" | ||
492 | "\x50\x5f\xa8\xe8\xa2\x60\xe7\x00\x86\x78\x05\xd4\x78\x19\xa1\x98" | ||
493 | "\x62\x4e\x4a\x00\x78\x56\x96\xe6\xcf\xd7\x10\x1b\x74\x5d\xd0\x26" | ||
494 | "\x61\xdb\x6b\x32\x09\x51\xd8\xa5\xfd\x54\x16\x71\x01\xb3\x39\xe6" | ||
495 | "\x4e\x69\xb1\xd7\x06\x8f\xd6\x1e\xdc\x72\x25\x26\x74\xc8\x41\x06" | ||
496 | "\x5c\xd1\x26\x5c\xb0\x2f\xf9\x59\x13\xc1\x2a\x0f\x78\xea\x7b\xf7" | ||
497 | "\xbd\x59\xa0\x90\x1d\xfc\x33\x5b\x4c\xbf\x05\x9c\x3a\x3f\x69\xa2" | ||
498 | "\x45\x61\x4e\x10\x6a\xb3\x17\xc5\x68\x30\xfb\x07\x5f\x34\xc6\xfb" | ||
499 | "\x73\x07\x3c\x70\xf6\xae\xe7\x72\x84\xc3\x18\x81\x8f\xe8\x11\x1f" | ||
500 | "\x3d\x83\x83\x01\x2a\x14\x73\xbf\x32\x32\x2e\xc9\x4d\xdb\x2a\xca" | ||
501 | "\xee\x71\xf9\xda\xad\xe8\x82\x0b\x4d\x0c\x1f\xb6\x1d\xef\x00\x67" | ||
502 | "\x74\x3d\x95\xe0\xb7\xc4\x30\x8a\x24\x87\x12\x47\x27\x70\x0d\x73" | ||
503 | /* g */ | ||
504 | "\x02", | ||
505 | .b_public = | ||
506 | "\x99\x4d\xd9\x01\x84\x8e\x4a\x5b\xb8\xa5\x64\x8c\x6c\x00\x5c\x0e" | ||
507 | "\x1e\x1b\xee\x5d\x9f\x53\xe3\x16\x70\x01\xed\xbf\x4f\x14\x36\x6e" | ||
508 | "\xe4\x43\x45\x43\x49\xcc\xb1\xb0\x2a\xc0\x6f\x22\x55\x42\x17\x94" | ||
509 | "\x18\x83\xd7\x2a\x5c\x51\x54\xf8\x4e\x7c\x10\xda\x76\x68\x57\x77" | ||
510 | "\x1e\x62\x03\x30\x04\x7b\x4c\x39\x9c\x54\x01\x54\xec\xef\xb3\x55" | ||
511 | "\xa4\xc0\x24\x6d\x3d\xbd\xcc\x46\x5b\x00\x96\xc7\xea\x93\xd1\x3f" | ||
512 | "\xf2\x6a\x72\xe3\xf2\xc1\x92\x24\x5b\xda\x48\x70\x2c\xa9\x59\x97" | ||
513 | "\x19\xb1\xd6\x54\xb3\x9c\x2e\xb0\x63\x07\x9b\x5e\xac\xb5\xf2\xb1" | ||
514 | "\x5b\xf8\xf3\xd7\x2d\x37\x9b\x68\x6c\xf8\x90\x07\xbc\x37\x9a\xa5" | ||
515 | "\xe2\x91\x12\x25\x47\x77\xe3\x3d\xb2\x95\x69\x44\x0b\x91\x1e\xaf" | ||
516 | "\x7c\x8c\x7c\x34\x41\x6a\xab\x60\x6e\xc6\x52\xec\x7e\x94\x0a\x37" | ||
517 | "\xec\x98\x90\xdf\x3f\x02\xbd\x23\x52\xdd\xd9\xe5\x31\x80\x74\x25" | ||
518 | "\xb6\xd2\xd3\xcc\xd5\xcc\x6d\xf9\x7e\x4d\x78\xab\x77\x51\xfa\x77" | ||
519 | "\x19\x94\x49\x8c\x05\xd4\x75\xed\xd2\xb3\x64\x57\xe0\x52\x99\xc0" | ||
520 | "\x83\xe3\xbb\x5e\x2b\xf1\xd2\xc0\xb1\x37\x36\x0b\x7c\xb5\x63\x96" | ||
521 | "\x8e\xde\x04\x23\x11\x95\x62\x11\x9a\xce\x6f\x63\xc8\xd5\xd1\x8f", | ||
522 | .expected_a_public = | ||
523 | "\x90\x89\xe4\x82\xd6\x0a\xcf\x1a\xae\xce\x1b\x66\xa7\x19\x71\x18" | ||
524 | "\x8f\x95\x4b\x5b\x80\x45\x4a\x5a\x43\x99\x4d\x37\xcf\xa3\xa7\x28" | ||
525 | "\x9c\xc7\x73\xf1\xb2\x17\xf6\x99\xe3\x6b\x56\xcb\x3e\x35\x60\x7d" | ||
526 | "\x65\xc7\x84\x6b\x3e\x60\xee\xcd\xd2\x70\xe7\xc9\x32\x1c\xf0\xb4" | ||
527 | "\xf9\x52\xd9\x88\x75\xfd\x40\x2c\xa7\xbe\x19\x1c\x0a\xae\x93\xe1" | ||
528 | "\x71\xc7\xcd\x4f\x33\x5c\x10\x7d\x39\x56\xfc\x73\x84\xb2\x67\xc3" | ||
529 | "\x77\x26\x20\x97\x2b\xf8\x13\x43\x93\x9c\x9a\xa4\x08\xc7\x34\x83" | ||
530 | "\xe6\x98\x61\xe7\x16\x30\x2c\xb1\xdb\x2a\xb2\xcc\xc3\x02\xa5\x3c" | ||
531 | "\x71\x50\x14\x83\xc7\xbb\xa4\xbe\x98\x1b\xfe\xcb\x43\xe9\x97\x62" | ||
532 | "\xd6\xf0\x8c\xcb\x1c\xba\x1e\xa8\xa6\xa6\x50\xfc\x85\x7d\x47\xbf" | ||
533 | "\xf4\x3e\x23\xd3\x5f\xb2\x71\x3e\x40\x94\xaa\x87\x83\x2c\x6c\x8e" | ||
534 | "\x60\xfd\xdd\xf7\xf4\x76\x03\xd3\x1d\xec\x18\x51\xa3\xf2\x44\x1a" | ||
535 | "\x3f\xb4\x7c\x18\x0d\x68\x65\x92\x54\x0d\x2d\x81\x16\xf1\x84\x66" | ||
536 | "\x89\x92\xd0\x1a\x5e\x1f\x42\x46\x5b\xe5\x83\x86\x80\xd9\xcd\x3a" | ||
537 | "\x5a\x2f\xb9\x59\x9b\xe4\x43\x84\x64\xf3\x09\x1a\x0a\xa2\x64\x0f" | ||
538 | "\x77\x4e\x8d\x8b\xe6\x88\xd1\xfc\xaf\x8f\xdf\x1d\xbc\x31\xb3\xbd", | ||
539 | .expected_ss = | ||
540 | "\x34\xc3\x35\x14\x88\x46\x26\x23\x97\xbb\xdd\x28\x5c\x94\xf6\x47" | ||
541 | "\xca\xb3\x19\xaf\xca\x44\x9b\xc2\x7d\x89\xfd\x96\x14\xfd\x6d\x58" | ||
542 | "\xd8\xc4\x6b\x61\x2a\x0d\xf2\x36\x45\xc8\xe4\xa4\xed\x81\x53\x81" | ||
543 | "\x66\x1e\xe0\x5a\xb1\x78\x2d\x0b\x5c\xb4\xd1\xfc\x90\xc6\x9c\xdb" | ||
544 | "\x5a\x30\x0b\x14\x7d\xbe\xb3\x7d\xb1\xb2\x76\x3c\x6c\xef\x74\x6b" | ||
545 | "\xe7\x1f\x64\x0c\xab\x65\xe1\x76\x5c\x3d\x83\xb5\x8a\xfb\xaf\x0f" | ||
546 | "\xf2\x06\x14\x8f\xa0\xf6\xc1\x89\x78\xf2\xba\x72\x73\x3c\xf7\x76" | ||
547 | "\x21\x67\xbc\x24\x31\xb8\x09\x65\x0f\x0c\x02\x32\x4a\x98\x14\xfc" | ||
548 | "\x72\x2c\x25\x60\x68\x5f\x2f\x30\x1e\x5b\xf0\x3b\xd1\xa2\x87\xa0" | ||
549 | "\x54\xdf\xdb\xc0\xee\x0a\x0f\x47\xc9\x90\x20\x2c\xf9\xe3\x52\xad" | ||
550 | "\x27\x65\x8d\x54\x8d\xa8\xa1\xf3\xed\x15\xd4\x94\x28\x90\x31\x93" | ||
551 | "\x1b\xc0\x51\xbb\x43\x5d\x76\x3b\x1d\x2a\x71\x50\xea\x5d\x48\x94" | ||
552 | "\x7f\x6f\xf1\x48\xdb\x30\xe5\xae\x64\x79\xd9\x7a\xdb\xc6\xff\xd8" | ||
553 | "\x5e\x5a\x64\xbd\xf6\x85\x04\xe8\x28\x6a\xac\xef\xce\x19\x8e\x9a" | ||
554 | "\xfe\x75\xc0\x27\x69\xe3\xb3\x7b\x21\xa7\xb1\x16\xa4\x85\x23\xee" | ||
555 | "\xb0\x1b\x04\x6e\xbd\xab\x16\xde\xfd\x86\x6b\xa9\x95\xd7\x0b\xfd", | ||
556 | .secret_size = 529, | ||
557 | .b_public_size = 256, | ||
558 | .expected_a_public_size = 256, | ||
559 | .expected_ss_size = 256, | ||
560 | } | ||
561 | }; | ||
562 | |||
333 | /* | 563 | /* |
334 | * MD4 test vectors from RFC1320 | 564 | * MD4 test vectors from RFC1320 |
335 | */ | 565 | */ |