]> git.cryptolib.org Git - arm-crypto-lib.git/blob - dsa/dsa_key_blob.c
82f3b60eddd42373b8144c05458bcd14320772cf
[arm-crypto-lib.git] / dsa / dsa_key_blob.c
1 /* dsa_key_blob.c */
2 /*
3     This file is part of the ARM-Crypto-Lib.
4     Copyright (C) 2006-2010  Daniel Otte (daniel.otte@rub.de)
5
6     This program is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include <stdlib.h>
21 #include <stdint.h>
22 #include <string.h>
23 #include "cli.h"
24 #include "dsa.h"
25 #include "bigint.h"
26
27
28 #define DSA_KEY_BLOB_SIZE 1024
29
30 #if DSA_KEY_BLOB_SIZE == 512
31
32 #define PRIV_LEN_B (20)
33 #define PUB_LEN_B  (8*8)
34 #define P_LEN_B (8*8)
35 #define Q_LEN_B (20)
36 #define G_LEN_B (8*8)
37 #define ALL_LEN_B (PRIV_LEN_B+PUB_LEN_B+P_LEN_B+Q_LEN_B+G_LEN_B)
38
39
40 static const uint8_t dsa_key_blob[] = {
41
42 //      priv:
43         0xac, 0xe6, 0xef, 0x99, 0x08, 0xe8, 0x5f, 0xc8,
44         0xc7, 0x51, 0x97, 0x99, 0xf4, 0xd3, 0x00, 0x0f,
45         0x49, 0x72, 0xee, 0x46,
46 //      pub:
47         0x18, 0x02, 0x53, 0x09, 0x61, 0xad, 0x0b, 0x9d,
48         0x44, 0x80, 0x8d, 0xb4, 0x52, 0xdc, 0xb5, 0xf2,
49         0x11, 0x20, 0x41, 0xc7, 0xd9, 0x7c, 0x7c, 0x6c,
50         0xa0, 0x9e, 0xca, 0x0d, 0xff, 0x28, 0x3c, 0x64,
51         0xfa, 0x92, 0xbb, 0x2c, 0xe9, 0x9b, 0x10, 0x94,
52         0xa5, 0x8d, 0x03, 0x50, 0xa5, 0x59, 0xd4, 0x3f,
53         0x57, 0x78, 0x8d, 0xcf, 0x0a, 0x99, 0x5d, 0xa3,
54         0x2e, 0x80, 0xfa, 0x99, 0x44, 0x73, 0x6d, 0x9a,
55 //      P:
56         0x9f, 0x2d, 0xc8, 0x3c, 0x34, 0xf9, 0xa1, 0xbc,
57         0x6a, 0xa7, 0x49, 0x17, 0xd3, 0x82, 0xa2, 0xe2,
58         0x25, 0x31, 0xc4, 0x3d, 0x1a, 0x3f, 0x0f, 0x8a,
59         0x8b, 0x84, 0x3c, 0x6c, 0x9c, 0xdd, 0x42, 0xd9,
60         0x1a, 0x22, 0xf2, 0x55, 0x98, 0xee, 0x7d, 0x98,
61         0x9c, 0x9a, 0x91, 0x42, 0x5f, 0x4f, 0xa8, 0x32,
62         0xa0, 0xb0, 0x0f, 0x79, 0xe2, 0x76, 0x08, 0x78,
63         0x6e, 0xba, 0xf7, 0x74, 0x43, 0x4a, 0xf2, 0xdf,
64 //      Q:
65         0xdb, 0x30, 0x69, 0xe6, 0x59, 0x77, 0xee, 0x38,
66         0xea, 0xf7, 0xcc, 0x18, 0x83, 0xcf, 0xb4, 0x21,
67         0xbc, 0xcf, 0x9a, 0x77,
68 //      G:
69         0x73, 0x90, 0x27, 0x68, 0xe7, 0xe9, 0x3a, 0x45,
70         0x6f, 0x7f, 0x95, 0xca, 0x9b, 0xfd, 0x33, 0x75,
71         0x75, 0xff, 0x0f, 0xe7, 0x69, 0xfd, 0xb7, 0x07,
72         0x0f, 0x6c, 0x3a, 0xec, 0x47, 0x82, 0x78, 0xb2,
73         0xb3, 0x0b, 0x7f, 0x11, 0x9d, 0x34, 0x3e, 0xff,
74         0xb8, 0x09, 0x42, 0x82, 0x81, 0x21, 0xad, 0x2b,
75         0x51, 0x20, 0xec, 0x9e, 0xf8, 0x15, 0xaa, 0x3d,
76         0x5f, 0x29, 0x2d, 0xb5, 0xc5, 0x64, 0x53, 0x2d
77 };
78
79 #endif
80
81 #if DSA_KEY_BLOB_SIZE == 1024
82
83 #define PRIV_LEN_B (20)
84 #define PUB_LEN_B  (16*8)
85 #define P_LEN_B (16*8)
86 #define Q_LEN_B (20)
87 #define G_LEN_B (16*8)
88 #define ALL_LEN_B (PRIV_LEN_B+PUB_LEN_B+P_LEN_B+Q_LEN_B+G_LEN_B)
89
90 static const uint8_t dsa_key_blob[] = {
91         // priv:
92 //      0x00, 0x00, 0x00, 0x00,
93         0x03, 0xad, 0x17, 0x81, 0x0f, 0x70, 0x7f, 0x89,
94         0xa2, 0x0a, 0x70, 0x1c, 0x3b, 0x24, 0xff, 0xd2,
95         0x39, 0x93, 0xd7, 0x8d,
96         // pub:
97         0x42, 0x1c, 0xb2, 0x03, 0xe5, 0xc6, 0x69, 0x81,
98         0x1e, 0x35, 0x85, 0x86, 0xd7, 0x94, 0xd2, 0x1f,
99         0x77, 0x05, 0x2f, 0xcc, 0xa5, 0x69, 0x46, 0x8f,
100         0xe1, 0x9f, 0x82, 0xf6, 0x24, 0x2c, 0x64, 0x1b,
101         0x29, 0x63, 0xd5, 0xb3, 0x32, 0xdc, 0xd9, 0x5a,
102         0x4e, 0x92, 0xd9, 0x69, 0xcc, 0x51, 0x81, 0xc2,
103         0xa3, 0x7e, 0xd7, 0xf8, 0x72, 0x1f, 0x8d, 0xd4,
104         0xe8, 0x59, 0xb0, 0xaa, 0xdd, 0xa0, 0x73, 0xe6,
105         0xc4, 0x50, 0x7f, 0x4c, 0x7c, 0xde, 0x35, 0x27,
106         0x49, 0x36, 0x23, 0x36, 0xe4, 0x90, 0x54, 0x24,
107         0x45, 0x99, 0xa3, 0x10, 0xc3, 0x59, 0x2f, 0x61,
108         0xff, 0x75, 0xf0, 0x51, 0x1d, 0xa0, 0x8f, 0x69,
109         0xc1, 0x1e, 0x3e, 0x65, 0xaf, 0x82, 0x9e, 0xa9,
110         0x91, 0x17, 0x04, 0x7c, 0x56, 0xd1, 0x68, 0x8a,
111         0x4b, 0xc9, 0x48, 0x92, 0xaf, 0x72, 0xca, 0xbf,
112         0xf2, 0x2b, 0x9e, 0x42, 0x92, 0x46, 0x19, 0x64,
113         // P:
114         0x97, 0x40, 0xda, 0x05, 0x19, 0x77, 0xb7, 0x17,
115         0x4b, 0x7d, 0xc0, 0x5b, 0x81, 0xdd, 0xcc, 0x0b,
116         0x86, 0xe0, 0x3c, 0x4d, 0xab, 0x3d, 0x43, 0xe4,
117         0xe3, 0x5f, 0xf3, 0x56, 0xcd, 0x5c, 0xf2, 0x85,
118         0x00, 0x45, 0x3c, 0xba, 0xf0, 0x56, 0xb3, 0x8b,
119         0x29, 0xc3, 0x55, 0x7b, 0xb6, 0xfb, 0x68, 0xca,
120         0x35, 0xe5, 0x0e, 0x46, 0xd6, 0xff, 0xc9, 0xbd,
121         0x08, 0x71, 0x65, 0x3b, 0xf7, 0xab, 0xb1, 0x96,
122         0x9b, 0x70, 0xdc, 0x8e, 0xf3, 0x02, 0xa4, 0x0f,
123         0xc6, 0xcd, 0x70, 0xe5, 0xeb, 0xd3, 0x07, 0xb5,
124         0x7d, 0x40, 0x8c, 0xfd, 0x33, 0x45, 0x8f, 0x9c,
125         0x7f, 0xa1, 0x69, 0xcb, 0xe6, 0x73, 0x1d, 0x37,
126         0xc7, 0x5f, 0x18, 0x57, 0x38, 0x96, 0x46, 0x24,
127         0xad, 0xa6, 0x59, 0x3d, 0x7a, 0x74, 0x6e, 0x88,
128         0x57, 0x18, 0x86, 0x7b, 0x07, 0x79, 0x52, 0xdd,
129         0xbc, 0xa7, 0x40, 0x88, 0xa6, 0x66, 0x50, 0x49,
130         // Q:
131 //      0x00, 0x00, 0x00, 0x00,
132         0xb4, 0x6d, 0x89, 0x7a, 0x72, 0xdb, 0x8c, 0x92,
133         0x60, 0xf9, 0x95, 0x47, 0x81, 0x57, 0xe8, 0x6b,
134         0xb4, 0xf9, 0xde, 0x51,
135         // G:
136         0x76, 0x1e, 0x1b, 0xd2, 0x5c, 0x5f, 0x92, 0x96,
137         0x42, 0x18, 0xba, 0x8d, 0xe1, 0x24, 0x12, 0x24,
138         0x6f, 0x3f, 0xb8, 0x05, 0xf9, 0x72, 0x74, 0xfa,
139         0xef, 0xc3, 0x1e, 0xd5, 0xa5, 0x93, 0x28, 0x07,
140         0xc0, 0x7b, 0x47, 0xef, 0x15, 0x13, 0x68, 0x18,
141         0xfb, 0x0d, 0x69, 0xea, 0xcc, 0x5a, 0x43, 0x08,
142         0x75, 0xec, 0xe4, 0x5e, 0x8e, 0xa9, 0x61, 0xe1,
143         0xcd, 0x27, 0x8c, 0x55, 0xc9, 0x42, 0x11, 0x11,
144         0x7f, 0x20, 0x4d, 0x70, 0x34, 0x49, 0x00, 0x8c,
145         0x79, 0x95, 0x79, 0x0b, 0xfd, 0x8d, 0xda, 0xe3,
146         0x0c, 0x27, 0x7a, 0x35, 0xe5, 0x35, 0xc9, 0x73,
147         0x31, 0xaa, 0xed, 0xbe, 0x81, 0x89, 0x67, 0x06,
148         0xf6, 0x97, 0x0d, 0x44, 0x07, 0xac, 0x09, 0xac,
149         0x44, 0xf3, 0xc6, 0x8b, 0x30, 0x4c, 0x76, 0x0b,
150         0x55, 0x74, 0x10, 0x06, 0xda, 0xd4, 0x3d, 0x96,
151         0x7e, 0xc3, 0xf8, 0x22, 0x9c, 0x71, 0x1d, 0x9c
152 };
153 #endif
154
155 #if DSA_KEY_BLOB_2048
156
157 #define PRIV_LEN_B (20)
158 #define PUB_LEN_B  (32*8)
159 #define P_LEN_B (32*8)
160 #define Q_LEN_B (20)
161 #define G_LEN_B (32*8)
162 #define ALL_LEN_B (PRIV_LEN_B+PUB_LEN_B+P_LEN_B+Q_LEN_B+G_LEN_B)
163
164 static const uint8_t dsa_key_blob[] = {
165 /* priv: */
166         0x1d, 0xe4, 0x81, 0x02, 0x52, 0x6b, 0x2b, 0x0e,
167         0x98, 0x08, 0xc8, 0xb9, 0x81, 0x40, 0xd1, 0x1e,
168         0x86, 0x69, 0x0d, 0xa9,
169 /* pub: */
170         0x70, 0xc4, 0x44, 0x28, 0x91, 0x77, 0x2b, 0x09,
171         0xde, 0xe8, 0x66, 0x0b, 0xa5, 0xc8, 0x05, 0xb4,
172         0x0a, 0x2d, 0x4f, 0x45, 0x8e, 0x0c, 0x8c, 0x38,
173         0x61, 0xf3, 0x77, 0x05, 0x64, 0xf7, 0xe6, 0xe9,
174         0x0b, 0x1f, 0x9b, 0x9f, 0x1f, 0xa1, 0x7e, 0x8f,
175         0x5b, 0x14, 0x70, 0x1d, 0x4d, 0x1c, 0xdc, 0x9d,
176         0xe0, 0x0a, 0xc4, 0x7b, 0x70, 0xfd, 0xef, 0xe6,
177         0x20, 0x2d, 0x17, 0x13, 0xd7, 0x1c, 0xc0, 0xbb,
178         0x5b, 0xce, 0x84, 0x6a, 0xa5, 0x4e, 0x27, 0x1c,
179         0x9e, 0xaa, 0xb2, 0xdc, 0xc1, 0xec, 0x74, 0x93,
180         0x67, 0xdb, 0xe1, 0xaa, 0x5a, 0x86, 0x1d, 0x8a,
181         0xa9, 0x28, 0x7e, 0xfc, 0xd5, 0x72, 0x94, 0x6c,
182         0x1d, 0x71, 0x85, 0x92, 0xa7, 0x6e, 0x84, 0x4f,
183         0x27, 0xf3, 0x7e, 0x04, 0x7d, 0xf2, 0x7c, 0x07,
184         0xa0, 0x7d, 0x02, 0x7c, 0x30, 0x70, 0xb5, 0x87,
185         0xc3, 0xf0, 0xc2, 0x0c, 0xdb, 0x26, 0x72, 0x33,
186         0x20, 0xca, 0xf0, 0x8b, 0x05, 0x20, 0x70, 0x98,
187         0x65, 0x03, 0xd7, 0xd4, 0x47, 0xf0, 0xb2, 0x6e,
188         0x2a, 0xbe, 0xcc, 0x83, 0x0d, 0xab, 0x60, 0x61,
189         0x26, 0x7b, 0xaf, 0xae, 0x18, 0x9e, 0x20, 0xeb,
190         0x12, 0x31, 0x18, 0x2e, 0x73, 0xca, 0xd4, 0x5e,
191         0x66, 0x74, 0x61, 0x07, 0x9b, 0x20, 0x68, 0x12,
192         0x88, 0xb1, 0xc5, 0x0f, 0x85, 0x9b, 0x45, 0x40,
193         0x7d, 0x76, 0x62, 0x73, 0xba, 0x41, 0x7b, 0xaf,
194         0xc7, 0xb9, 0x19, 0x7a, 0xd0, 0x55, 0xe6, 0xfd,
195         0xb5, 0xb9, 0xc4, 0x1b, 0x22, 0x47, 0x8f, 0x7b,
196         0xd7, 0x75, 0xe8, 0x7f, 0x01, 0xa2, 0x9b, 0x79,
197         0xde, 0xea, 0x55, 0x3c, 0x61, 0x4d, 0xcd, 0xce,
198         0x89, 0x8c, 0x76, 0x62, 0x12, 0x4d, 0xd4, 0x47,
199         0x03, 0x0e, 0xe8, 0xe2, 0xb8, 0xda, 0xca, 0x20,
200         0xb3, 0x64, 0xb6, 0x07, 0x06, 0x1b, 0xcb, 0x91,
201         0x51, 0x2c, 0x2e, 0xfa, 0xe1, 0xee, 0x1e, 0x78,
202 /* P: */
203         0x8d, 0x09, 0x00, 0x56, 0x63, 0x39, 0x42, 0x8d,
204         0x15, 0xd5, 0x1d, 0x86, 0x10, 0xde, 0xc7, 0xf4,
205         0x07, 0xe5, 0x81, 0xbe, 0x67, 0xee, 0xc5, 0x33,
206         0xd3, 0x41, 0x1b, 0xba, 0xd8, 0xa6, 0x61, 0x49,
207         0x2d, 0x66, 0xcf, 0x60, 0x9f, 0x52, 0x60, 0x6e,
208         0x0a, 0x16, 0xdc, 0x0b, 0x24, 0x1b, 0x62, 0x32,
209         0xc4, 0xab, 0x52, 0x17, 0xbf, 0xc5, 0xa2, 0x2a,
210         0xa4, 0x5e, 0x8c, 0xff, 0x97, 0x45, 0x51, 0xd9,
211         0xc3, 0xf2, 0x32, 0x4a, 0xb9, 0x08, 0xc1, 0x6a,
212         0x7b, 0x82, 0x93, 0x2a, 0x60, 0x29, 0x55, 0x1a,
213         0x36, 0x1f, 0x05, 0x4f, 0xf1, 0x43, 0x12, 0xb2,
214         0x73, 0x4e, 0xf6, 0x37, 0x65, 0x3d, 0x0b, 0x70,
215         0x08, 0xc7, 0x34, 0x0b, 0x4d, 0xc9, 0x08, 0x70,
216         0xaf, 0x4b, 0x95, 0x0b, 0x7c, 0x9f, 0xcf, 0xfc,
217         0x57, 0x94, 0x47, 0x6d, 0xd1, 0xaf, 0xc6, 0x52,
218         0xd9, 0xe2, 0x05, 0xce, 0xb2, 0xb8, 0x91, 0x6f,
219         0x5a, 0x77, 0x6b, 0x1b, 0xff, 0x97, 0x8c, 0x5e,
220         0x33, 0xfc, 0x80, 0x29, 0xdf, 0x83, 0x91, 0x0c,
221         0x28, 0x1b, 0x00, 0xb4, 0xc9, 0x3e, 0xb7, 0x67,
222         0xca, 0xab, 0x63, 0xd4, 0x48, 0xfe, 0xd2, 0xfd,
223         0x65, 0x57, 0x33, 0x25, 0xbd, 0xf1, 0xa5, 0x51,
224         0x51, 0x50, 0xf6, 0xcf, 0xfa, 0x0d, 0x67, 0x4e,
225         0x90, 0x08, 0x87, 0x34, 0xf6, 0x33, 0xc9, 0x58,
226         0xb1, 0x87, 0xf8, 0x5d, 0x73, 0x80, 0xde, 0x51,
227         0xcd, 0x17, 0x70, 0x3e, 0xa4, 0xa8, 0x4f, 0xda,
228         0xcd, 0xa2, 0x66, 0x0f, 0x95, 0xa7, 0xc6, 0xf7,
229         0x12, 0x2e, 0x27, 0x94, 0xa9, 0x26, 0x1b, 0x25,
230         0x16, 0x18, 0x99, 0x3b, 0x32, 0xaf, 0x71, 0x13,
231         0x35, 0xda, 0xb8, 0x71, 0x5b, 0x50, 0x7c, 0x7a,
232         0x9d, 0xcc, 0x0d, 0x95, 0xef, 0x6f, 0x64, 0x3c,
233         0x28, 0x4b, 0x15, 0xe9, 0xd4, 0xad, 0xcc, 0x56,
234         0xcb, 0x24, 0xf9, 0x61, 0x79, 0xd7, 0x56, 0xd3,
235 /* Q: */
236         0xf7, 0xdf, 0x85, 0xf5, 0x63, 0x36, 0x63, 0x71,
237         0x74, 0x34, 0x98, 0x19, 0xff, 0x79, 0xf2, 0xe2,
238         0x15, 0x75, 0x3c, 0x95,
239 /* G: */
240         0x0c, 0xf6, 0x8b, 0x1a, 0xbe, 0x66, 0x84, 0x98,
241         0xae, 0xcb, 0xb0, 0xd9, 0x75, 0x75, 0x32, 0x4b,
242         0xa3, 0xf2, 0x28, 0xa6, 0x6d, 0x13, 0xf2, 0xf3,
243         0xfd, 0x93, 0x91, 0xb1, 0x21, 0x1e, 0xcc, 0x08,
244         0x87, 0xce, 0x74, 0xb1, 0xd0, 0x19, 0x50, 0xff,
245         0xac, 0xef, 0x9f, 0x82, 0xda, 0x75, 0xda, 0x6d,
246         0x89, 0xf3, 0x0b, 0xdc, 0x27, 0x98, 0x85, 0x01,
247         0x68, 0xb7, 0xbd, 0x98, 0x83, 0xb1, 0xb0, 0x65,
248         0x31, 0x71, 0x43, 0x05, 0xa7, 0x76, 0x63, 0xe4,
249         0x7d, 0x61, 0x53, 0xc7, 0x3e, 0x3b, 0x82, 0x28,
250         0x65, 0x07, 0xfe, 0x9e, 0xa3, 0x35, 0x2c, 0xdc,
251         0x9e, 0x05, 0x7c, 0x9a, 0x69, 0xc6, 0x9f, 0xc2,
252         0x3f, 0x94, 0x6b, 0xad, 0xa4, 0x2b, 0x5d, 0x48,
253         0x9e, 0x2c, 0xad, 0xd2, 0x89, 0x49, 0xdc, 0xdb,
254         0x55, 0x49, 0x56, 0xaf, 0xe9, 0x0e, 0x37, 0xe7,
255         0x1f, 0x42, 0x6a, 0x7c, 0xac, 0xe8, 0x1b, 0xbb,
256         0x21, 0x82, 0x14, 0x72, 0x17, 0x64, 0xf0, 0x3c,
257         0x3d, 0xc1, 0x43, 0x27, 0x27, 0x9f, 0xe9, 0x21,
258         0xf2, 0x2f, 0xf7, 0xfa, 0x3c, 0xed, 0xbf, 0xab,
259         0xab, 0xb7, 0x3c, 0x6d, 0x1e, 0x85, 0x9f, 0x77,
260         0x4f, 0x69, 0x09, 0x4e, 0xed, 0x13, 0x84, 0x40,
261         0x1a, 0xc6, 0xa1, 0xd9, 0x68, 0xb6, 0x18, 0x32,
262         0x79, 0x25, 0x9e, 0xa6, 0x41, 0x30, 0xd1, 0xc2,
263         0x7a, 0x8f, 0x0d, 0x46, 0xee, 0xda, 0xb0, 0xbf,
264         0x64, 0x42, 0x59, 0x7e, 0x22, 0x88, 0xd6, 0x52,
265         0xec, 0xed, 0xc4, 0x13, 0xb1, 0x7f, 0x5c, 0x77,
266         0x4c, 0xfd, 0x22, 0x90, 0xd3, 0xe3, 0xa9, 0xc1,
267         0x0f, 0x25, 0xac, 0xd5, 0x04, 0x84, 0xe6, 0xa8,
268         0xc7, 0xb4, 0x4f, 0xa2, 0x67, 0xae, 0xaa, 0x92,
269         0xe9, 0x0a, 0xed, 0x45, 0x5b, 0xf0, 0x1b, 0x69,
270         0xec, 0xaf, 0x7d, 0xf2, 0x71, 0x25, 0xbf, 0x92,
271         0xd4, 0xd0, 0x5b, 0xde, 0x5a, 0x2d, 0x18, 0x8e
272 };
273 #endif
274
275 void load_dsa_key_blob(dsa_ctx_t* ctx){
276         if(ctx->priv.wordv){
277                 free(ctx->priv.wordv);
278         }
279         ctx->priv.wordv = malloc(ALL_LEN_B);
280         if(ctx->priv.wordv==NULL){
281                 cli_putstr("\r\nERROR: OUT OF MEMORY!!!");
282                 return;
283         }
284         memcpy(ctx->priv.wordv, dsa_key_blob, ALL_LEN_B);
285         ctx->priv.length_W=(PRIV_LEN_B+sizeof(bigint_word_t)-1)/sizeof(bigint_word_t);
286         ctx->pub.wordv = (bigint_word_t*)((uint8_t*)ctx->priv.wordv+PRIV_LEN_B);
287         ctx->pub.length_W = (PUB_LEN_B+sizeof(bigint_word_t)-1)/sizeof(bigint_word_t);
288         ctx->domain.p.wordv = (bigint_word_t*)((uint8_t*)ctx->priv.wordv+PRIV_LEN_B+PUB_LEN_B);
289         ctx->domain.p.length_W = (P_LEN_B+sizeof(bigint_word_t)-1)/sizeof(bigint_word_t);
290         ctx->domain.q.wordv = (bigint_word_t*)((uint8_t*)ctx->priv.wordv+PRIV_LEN_B+PUB_LEN_B+P_LEN_B);
291         ctx->domain.q.length_W = (Q_LEN_B+sizeof(bigint_word_t)-1)/sizeof(bigint_word_t);
292         ctx->domain.g.wordv = (bigint_word_t*)((uint8_t*)ctx->priv.wordv+PRIV_LEN_B+PUB_LEN_B+P_LEN_B+Q_LEN_B);
293         ctx->domain.g.length_W = (G_LEN_B+sizeof(bigint_word_t)-1)/sizeof(bigint_word_t);
294
295         bigint_changeendianess(&(ctx->priv));
296         bigint_changeendianess(&(ctx->pub));
297         bigint_changeendianess(&(ctx->domain.p));
298         bigint_changeendianess(&(ctx->domain.q));
299         bigint_changeendianess(&(ctx->domain.g));
300
301         bigint_adjust(&(ctx->priv));
302         bigint_adjust(&(ctx->pub));
303         bigint_adjust(&(ctx->domain.p));
304         bigint_adjust(&(ctx->domain.q));
305         bigint_adjust(&(ctx->domain.g));
306 }