@@ -27,7 +27,8 @@ int ecc_export_openssl(unsigned char *out, unsigned long *outlen, int type, cons
2727 unsigned char bin_a [256 ], bin_b [256 ], bin_k [256 ], bin_g [512 ], bin_xy [512 ];
2828 unsigned long len_a , len_b , len_k , len_g , len_xy ;
2929 unsigned long cofactor , one = 1 ;
30- oid_st oid ;
30+ const char * OID ;
31+ unsigned long oid [16 ], oidlen ;
3132 ltc_asn1_list seq_fieldid [2 ], seq_curve [2 ], seq_ecparams [6 ], seq_priv [4 ], pub_xy , ecparams ;
3233 int flag_oid = type & PK_CURVEOID ? 1 : 0 ;
3334 int flag_com = type & PK_COMPRESSED ? 1 : 0 ;
@@ -72,7 +73,7 @@ int ecc_export_openssl(unsigned char *out, unsigned long *outlen, int type, cons
7273 cofactor = key -> dp .cofactor ;
7374
7475 /* we support only prime-field EC */
75- if ((err = pk_get_oid (PKA_EC_PRIMEF , & oid )) != CRYPT_OK ) { goto error ; }
76+ if ((err = pk_get_oid (PKA_EC_PRIMEF , & OID )) != CRYPT_OK ) { goto error ; }
7677
7778 if (flag_oid ) {
7879 /* http://tools.ietf.org/html/rfc5912
@@ -102,8 +103,13 @@ int ecc_export_openssl(unsigned char *out, unsigned long *outlen, int type, cons
102103 }
103104 */
104105
106+ oidlen = sizeof (oid )/sizeof (oid [0 ]);
107+ if ((err = pk_oid_str_to_num (OID , oid , & oidlen )) != CRYPT_OK ) {
108+ goto error ;
109+ }
110+
105111 /* FieldID SEQUENCE */
106- LTC_SET_ASN1 (seq_fieldid , 0 , LTC_ASN1_OBJECT_IDENTIFIER , oid . OID , oid . OIDlen );
112+ LTC_SET_ASN1 (seq_fieldid , 0 , LTC_ASN1_OBJECT_IDENTIFIER , oid , oidlen );
107113 LTC_SET_ASN1 (seq_fieldid , 1 , LTC_ASN1_INTEGER , prime , 1UL );
108114
109115 /* Curve SEQUENCE */
0 commit comments