Hi guys,

I 'm have updating the openssl.vapi file, and met a trouble about instance 
position. the OpenSSL api as follow:
 #include <openssl/rsa.h&gt;  int RSA_public_encrypt(int flen, const unsigned 
char *from,                         unsigned char *to, RSA *rsa, int padding);  
int RSA_private_decrypt(int flen, const unsigned char *from,                    
      unsigned char *to, RSA *rsa, int padding);
translate to Vala vapi code as follow:
&nbsp;&nbsp;&nbsp; [Compact]
&nbsp;&nbsp;&nbsp; [CCode&nbsp;(lower_case_cprefix&nbsp;= "RSA_", 
cprefix&nbsp;= "RSA_", cheader_filename&nbsp;= "openssl/rsa.h", 
free_function&nbsp;= "RSA_free")]
&nbsp;&nbsp;&nbsp; public&nbsp;class RSA
&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
public&nbsp;int&nbsp;generate_key_ex(int&nbsp;bits, BIGNUM e, BN_GENCB?&nbsp;cb 
= null);


&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [CCode&nbsp;(instance_pos = 2.1)]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
public&nbsp;int&nbsp;public_encrypt(int&nbsp;flen, [CCode&nbsp;(array_length = 
false)] uint8[] from, [CCode&nbsp;(array_length = false)] uint8[] to, 
int&nbsp;padding);
&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [CCode&nbsp;(instance_pos = 2.1)]
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
public&nbsp;int&nbsp;private_decrypt(int&nbsp;flen, [CCode&nbsp;(array_length = 
false)] uint8[] from, [CCode&nbsp;(array_length = false)] uint8[] to, 
int&nbsp;padding);&nbsp; 
&nbsp;&nbsp;&nbsp; }




if set the instance_pos as 3, the compiler will output errors:
error: too few arguments to function 'RSA_public_encrypt'



if set the instance_pos as 2.1, the code can compile and will crashed at 
function public_encrypt / private_decrypt, 


I don't know how to set the instance_pos's value, could anybody give me some 
tips to fix this error?


thanks in advanced.


ZuHong Tao
2/22/2020
_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to