资源描述:
《openssl源代码分析》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Openssl源代码的特点:1、openssl中只有实现而没有调用的函数2、openssl中各系列的函数都是用宏定义的(因而无法用代码浏览工具找到其定义)用于定义X509的new、free、i2d和d2i函数的宏:1、函数声明DECLARE_ASN1_FUNCTIONS(X509)用于声明函数x509x509.h在openssl中的具体定义如下:asn1asn1.h/*DeclareASN1functions:theimplementmacroininasn1t.h*/#defineDECLARE_AS
2、N1_FUNCTIONS(type)DECLARE_ASN1_FUNCTIONS_name(type,type)#defineDECLARE_ASN1_ALLOC_FUNCTIONS(type)DECLARE_ASN1_ALLOC_FUNCTIONS_name(type,type)#defineDECLARE_ASN1_FUNCTIONS_name(type,name)DECLARE_ASN1_ALLOC_FUNCTIONS_name(type,name)DECLARE_ASN1_ENCODE_FUN
3、CTIONS(type,name,name)#defineDECLARE_ASN1_FUNCTIONS_fname(type,itname,name)DECLARE_ASN1_ALLOC_FUNCTIONS_name(type,name)DECLARE_ASN1_ENCODE_FUNCTIONS(type,itname,name)#defineDECLARE_ASN1_ENCODE_FUNCTIONS(type,itname,name)type*d2i_##name(type**a,constunsi
4、gnedchar**in,longlen);inti2d_##name(type*a,unsignedchar**out);DECLARE_ASN1_ITEM(itname)#defineDECLARE_ASN1_ENCODE_FUNCTIONS_const(type,name)type*d2i_##name(type**a,constunsignedchar**in,longlen);inti2d_##name(consttype*a,unsignedchar**out);DECLARE_ASN
5、1_ITEM(name)#defineDECLARE_ASN1_NDEF_FUNCTION(name)inti2d_##name##_NDEF(name*a,unsignedchar**out);#defineDECLARE_ASN1_FUNCTIONS_const(name)constructionqualityacceptanceandassessmentRegulation(ProfessionalEdition)(DL/T5210.2-2009~DL/T5210.8-2009);1.9thequ
6、alitycheckoutandevaluationofelectricequipmentinstallationengineeringcode(DL/T5161.1-2002~5161.17-2002);1.10thenormsofconstructionsupervision,theelectricpowerconstructionsupervisionregulationsDECLARE_ASN1_ALLOC_FUNCTIONS(name)DECLARE_ASN1_ENCODE_FUNCTIONS_
7、const(name,name)#defineDECLARE_ASN1_ALLOC_FUNCTIONS_name(type,name)type*name##_new(void);voidname##_free(type*a);用于函数的实现asn1x_x509.cASN1_SEQUENCE_ref(X509,x509_cb,CRYPTO_LOCK_X509)={ASN1_SIMPLE(X509,cert_info,X509_CINF),ASN1_SIMPLE(X509,sig_alg,X509_ALG
8、OR),ASN1_SIMPLE(X509,signature,ASN1_BIT_STRING)}ASN1_SEQUENCE_END_ref(X509,X509)IMPLEMENT_ASN1_FUNCTIONS(X509)2、ASN1_SEQUENCE_ref:ASN1_SEQUENCE_ref:asn1asn1t.h#defineASN1_SEQUENCE_ref(tname,cb,lck)staticcon