d682e28d834ad488667db9cda567e30bcef93b4b
[openwrt/staging/chunkeey.git] / package / libs / polarssl / patches / 210-gen_key_config_fix.patch
1 --- a/programs/pkey/gen_key.c
2 +++ b/programs/pkey/gen_key.c
3 @@ -155,7 +155,9 @@ int main( int argc, char *argv[] )
4
5 opt.type = DFL_TYPE;
6 opt.rsa_keysize = DFL_RSA_KEYSIZE;
7 +#if defined(POLARSSL_ECP_C)
8 opt.ec_curve = DFL_EC_CURVE;
9 +#endif
10 opt.filename = DFL_FILENAME;
11 opt.format = DFL_FORMAT;
12
13 @@ -170,8 +172,10 @@ int main( int argc, char *argv[] )
14 {
15 if( strcmp( q, "rsa" ) == 0 )
16 opt.type = POLARSSL_PK_RSA;
17 +#if defined(POLARSSL_ECP_C)
18 if( strcmp( q, "ec" ) == 0 )
19 opt.type = POLARSSL_PK_ECKEY;
20 +#endif
21 else
22 goto usage;
23 }
24 @@ -190,12 +194,14 @@ int main( int argc, char *argv[] )
25 if( opt.rsa_keysize < 1024 || opt.rsa_keysize > 8192 )
26 goto usage;
27 }
28 +#if defined(POLARSSL_ECP_C)
29 else if( strcmp( p, "ec_curve" ) == 0 )
30 {
31 if( ( curve_info = ecp_curve_info_from_name( q ) ) == NULL )
32 goto usage;
33 opt.ec_curve = curve_info->grp_id;
34 }
35 +#endif
36 else if( strcmp( p, "filename" ) == 0 )
37 opt.filename = q;
38 else