Hello, I was trying to understand the asn1 side of the openssl code.
In rsa_asn1.c there is IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(RSA, RSAPrivateKey, RSAPrivateKey) It's implenetation is in asn1t.h #define IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(stname, itname, fname) \ stname *d2i_##fname(stname **a, const unsigned char **in, long len) \ { \ return (stname *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, ASN1_ITEM_rptr(itname));\ } \ int i2d_##fname(const stname *a, unsigned char **out) \ { \ return ASN1_item_i2d((ASN1_VALUE *)a, out, ASN1_ITEM_rptr(itname));\ } What's throwing me off is this: ASN1_ITEM_rptr(itname) It is defined in asn1.h #define ASN1_ITEM_rptr(ref) (&(ref##_it)) So based on the above implement statement it turns out to be &RSAPrivateKey_it Now where is this guy RSAPrivateKey_it ??. My global search landed me to: libeay.num which shows RSAPrivateKey_it 2906 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA RSAPrivateKey_it 2906 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:RSA I also see that it is declared in rsa.h DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey) #define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \ type *d2i_##name(type **a, const unsigned char **in, long len); \ int i2d_##name(const type *a, unsigned char **out); \ DECLARE_ASN1_ITEM(name) #define DECLARE_ASN1_ITEM(name) \ OPENSSL_EXTERN const ASN1_ITEM name##_it; so the complete and correct declaration will be extern const ASN1_ITEM RSAPrivatekey_it If someone could PLEASE help me understand this, I will be very grateful. Thanks a lot Shravan ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org