提交 0f6b33ea 编写于 作者: X x00467182 提交者: public tcshversion

TicketNo:AR000CROD4

Description:add libcrypto_commu shared library
Team:OTHERS
Feature or Bugfix:Feature
Binary Source:No
PrivateCode(Yes/No):Yes

Change-Id: I11ae34ecb11d0439cdc659ec33942079d21c4ea1
Reviewed-on: http://mgit-tm.rnd.huawei.com/7008248Reviewed-by: Npengjianxin 00207387 <pengjianxin@huawei.com>
Tested-by: Npublic jenkins <public_jenkins@notesmail.huawei.com>
上级 68b4f9db
......@@ -658,6 +658,666 @@ zidane_shared_library("libcrypto") {
remove_configs = ["//build/config/coverage:default_coverage"]
}
zidane_shared_library("libcrypto_commu") {
include_dirs = [
"./",
"./crypto/include",
"./include",
"./crypto/modes",
"./crypto/ec/curve448",
"./crypto/ec/curve448/arch_32",
]
sources = [
"crypto/aes/aes_cbc.c",
"crypto/aes/aes_cfb.c",
"crypto/aes/aes_core.c",
"crypto/aes/aes_ecb.c",
"crypto/aes/aes_ige.c",
"crypto/aes/aes_misc.c",
"crypto/aes/aes_ofb.c",
"crypto/aes/aes_wrap.c",
"crypto/aria/aria.c",
"crypto/asn1/a_bitstr.c",
"crypto/asn1/a_d2i_fp.c",
"crypto/asn1/a_digest.c",
"crypto/asn1/a_dup.c",
"crypto/asn1/a_gentm.c",
"crypto/asn1/a_i2d_fp.c",
"crypto/asn1/a_int.c",
"crypto/asn1/a_mbstr.c",
"crypto/asn1/a_object.c",
"crypto/asn1/a_octet.c",
"crypto/asn1/a_print.c",
"crypto/asn1/a_sign.c",
"crypto/asn1/a_strex.c",
"crypto/asn1/a_strnid.c",
"crypto/asn1/a_time.c",
"crypto/asn1/a_type.c",
"crypto/asn1/a_utctm.c",
"crypto/asn1/a_utf8.c",
"crypto/asn1/a_verify.c",
"crypto/asn1/ameth_lib.c",
"crypto/asn1/asn1_err.c",
"crypto/asn1/asn1_gen.c",
"crypto/asn1/asn1_item_list.c",
"crypto/asn1/asn1_lib.c",
"crypto/asn1/asn1_par.c",
"crypto/asn1/asn_mime.c",
"crypto/asn1/asn_moid.c",
"crypto/asn1/asn_mstbl.c",
"crypto/asn1/asn_pack.c",
"crypto/asn1/bio_asn1.c",
"crypto/asn1/bio_ndef.c",
"crypto/asn1/d2i_pr.c",
"crypto/asn1/d2i_pu.c",
"crypto/asn1/evp_asn1.c",
"crypto/asn1/f_int.c",
"crypto/asn1/f_string.c",
"crypto/asn1/i2d_pr.c",
"crypto/asn1/i2d_pu.c",
"crypto/asn1/n_pkey.c",
"crypto/asn1/nsseq.c",
"crypto/asn1/p5_pbe.c",
"crypto/asn1/p5_pbev2.c",
"crypto/asn1/p5_scrypt.c",
"crypto/asn1/p8_pkey.c",
"crypto/asn1/t_bitst.c",
"crypto/asn1/t_pkey.c",
"crypto/asn1/t_spki.c",
"crypto/asn1/tasn_dec.c",
"crypto/asn1/tasn_enc.c",
"crypto/asn1/tasn_fre.c",
"crypto/asn1/tasn_new.c",
"crypto/asn1/tasn_prn.c",
"crypto/asn1/tasn_scn.c",
"crypto/asn1/tasn_typ.c",
"crypto/asn1/tasn_utl.c",
"crypto/asn1/x_algor.c",
"crypto/asn1/x_bignum.c",
"crypto/asn1/x_info.c",
"crypto/asn1/x_int64.c",
"crypto/asn1/x_long.c",
"crypto/asn1/x_pkey.c",
"crypto/asn1/x_sig.c",
"crypto/asn1/x_spki.c",
"crypto/asn1/x_val.c",
"crypto/async/arch/async_null.c",
"crypto/async/arch/async_posix.c",
"crypto/async/arch/async_win.c",
"crypto/async/async.c",
"crypto/async/async_err.c",
"crypto/async/async_wait.c",
"crypto/bio/b_addr.c",
"crypto/bio/b_dump.c",
"crypto/bio/b_print.c",
"crypto/bio/b_sock.c",
"crypto/bio/b_sock2.c",
"crypto/bio/bf_buff.c",
"crypto/bio/bf_lbuf.c",
"crypto/bio/bf_nbio.c",
"crypto/bio/bf_null.c",
"crypto/bio/bio_cb.c",
"crypto/bio/bio_err.c",
"crypto/bio/bio_lib.c",
"crypto/bio/bio_meth.c",
"crypto/bio/bss_acpt.c",
"crypto/bio/bss_bio.c",
"crypto/bio/bss_conn.c",
"crypto/bio/bss_dgram.c",
"crypto/bio/bss_fd.c",
"crypto/bio/bss_file.c",
"crypto/bio/bss_log.c",
"crypto/bio/bss_mem.c",
"crypto/bio/bss_null.c",
"crypto/bio/bss_sock.c",
"crypto/blake2/blake2b.c",
"crypto/blake2/blake2s.c",
"crypto/blake2/m_blake2b.c",
"crypto/blake2/m_blake2s.c",
"crypto/bn/bn_add.c",
"crypto/bn/bn_asm.c",
"crypto/bn/bn_blind.c",
"crypto/bn/bn_const.c",
"crypto/bn/bn_ctx.c",
"crypto/bn/bn_depr.c",
"crypto/bn/bn_dh.c",
"crypto/bn/bn_div.c",
"crypto/bn/bn_err.c",
"crypto/bn/bn_exp.c",
"crypto/bn/bn_exp2.c",
"crypto/bn/bn_gcd.c",
"crypto/bn/bn_gf2m.c",
"crypto/bn/bn_intern.c",
"crypto/bn/bn_kron.c",
"crypto/bn/bn_lib.c",
"crypto/bn/bn_mod.c",
"crypto/bn/bn_mont.c",
"crypto/bn/bn_mpi.c",
"crypto/bn/bn_mul.c",
"crypto/bn/bn_nist.c",
"crypto/bn/bn_prime.c",
"crypto/bn/bn_print.c",
"crypto/bn/bn_rand.c",
"crypto/bn/bn_recp.c",
"crypto/bn/bn_shift.c",
"crypto/bn/bn_sqr.c",
"crypto/bn/bn_sqrt.c",
"crypto/bn/bn_srp.c",
"crypto/bn/bn_word.c",
"crypto/bn/bn_x931p.c",
"crypto/buffer/buf_err.c",
"crypto/buffer/buffer.c",
"crypto/chacha/chacha_enc.c",
"crypto/cmac/cm_ameth.c",
"crypto/cmac/cm_pmeth.c",
"crypto/cmac/cmac.c",
"crypto/cms/cms_asn1.c",
"crypto/cms/cms_att.c",
"crypto/cms/cms_cd.c",
"crypto/cms/cms_dd.c",
"crypto/cms/cms_enc.c",
"crypto/cms/cms_env.c",
"crypto/cms/cms_err.c",
"crypto/cms/cms_ess.c",
"crypto/cms/cms_io.c",
"crypto/cms/cms_kari.c",
"crypto/cms/cms_lib.c",
"crypto/cms/cms_pwri.c",
"crypto/cms/cms_sd.c",
"crypto/cms/cms_smime.c",
"crypto/comp/c_zlib.c",
"crypto/comp/comp_err.c",
"crypto/comp/comp_lib.c",
"crypto/conf/conf_api.c",
"crypto/conf/conf_def.c",
"crypto/conf/conf_err.c",
"crypto/conf/conf_lib.c",
"crypto/conf/conf_mall.c",
"crypto/conf/conf_mod.c",
"crypto/conf/conf_sap.c",
"crypto/conf/conf_ssl.c",
"crypto/cpt_err.c",
"crypto/cryptlib.c",
"crypto/ctype.c",
"crypto/cversion.c",
"crypto/des/cbc_cksm.c",
"crypto/des/cbc_enc.c",
"crypto/des/cfb64ede.c",
"crypto/des/cfb64enc.c",
"crypto/des/cfb_enc.c",
"crypto/des/des_enc.c",
"crypto/des/ecb3_enc.c",
"crypto/des/ecb_enc.c",
"crypto/des/fcrypt.c",
"crypto/des/fcrypt_b.c",
"crypto/des/ofb64ede.c",
"crypto/des/ofb64enc.c",
"crypto/des/ofb_enc.c",
"crypto/des/pcbc_enc.c",
"crypto/des/qud_cksm.c",
"crypto/des/rand_key.c",
"crypto/des/set_key.c",
"crypto/des/str2key.c",
"crypto/des/xcbc_enc.c",
"crypto/dh/dh_ameth.c",
"crypto/dh/dh_asn1.c",
"crypto/dh/dh_check.c",
"crypto/dh/dh_depr.c",
"crypto/dh/dh_err.c",
"crypto/dh/dh_gen.c",
"crypto/dh/dh_kdf.c",
"crypto/dh/dh_key.c",
"crypto/dh/dh_lib.c",
"crypto/dh/dh_meth.c",
"crypto/dh/dh_pmeth.c",
"crypto/dh/dh_prn.c",
"crypto/dh/dh_rfc5114.c",
"crypto/dh/dh_rfc7919.c",
"crypto/dsa/dsa_ameth.c",
"crypto/dsa/dsa_asn1.c",
"crypto/dsa/dsa_depr.c",
"crypto/dsa/dsa_err.c",
"crypto/dsa/dsa_gen.c",
"crypto/dsa/dsa_key.c",
"crypto/dsa/dsa_lib.c",
"crypto/dsa/dsa_meth.c",
"crypto/dsa/dsa_ossl.c",
"crypto/dsa/dsa_pmeth.c",
"crypto/dsa/dsa_prn.c",
"crypto/dsa/dsa_sign.c",
"crypto/dsa/dsa_vrf.c",
"crypto/dso/dso_dl.c",
"crypto/dso/dso_dlfcn.c",
"crypto/dso/dso_err.c",
"crypto/dso/dso_lib.c",
"crypto/dso/dso_openssl.c",
"crypto/dso/dso_vms.c",
"crypto/dso/dso_win32.c",
"crypto/ebcdic.c",
"crypto/ec/curve25519.c",
"crypto/ec/curve448/arch_32/f_impl.c",
"crypto/ec/curve448/curve448.c",
"crypto/ec/curve448/curve448_tables.c",
"crypto/ec/curve448/eddsa.c",
"crypto/ec/curve448/f_generic.c",
"crypto/ec/curve448/scalar.c",
"crypto/ec/ec2_oct.c",
"crypto/ec/ec2_smpl.c",
"crypto/ec/ec_ameth.c",
"crypto/ec/ec_asn1.c",
"crypto/ec/ec_check.c",
"crypto/ec/ec_curve.c",
"crypto/ec/ec_cvt.c",
"crypto/ec/ec_err.c",
"crypto/ec/ec_key.c",
"crypto/ec/ec_kmeth.c",
"crypto/ec/ec_lib.c",
"crypto/ec/ec_mult.c",
"crypto/ec/ec_oct.c",
"crypto/ec/ec_pmeth.c",
"crypto/ec/ec_print.c",
"crypto/ec/ecdh_kdf.c",
"crypto/ec/ecdh_ossl.c",
"crypto/ec/ecdsa_ossl.c",
"crypto/ec/ecdsa_sign.c",
"crypto/ec/ecdsa_vrf.c",
"crypto/ec/eck_prn.c",
"crypto/ec/ecp_mont.c",
"crypto/ec/ecp_nist.c",
"crypto/ec/ecp_nistp224.c",
"crypto/ec/ecp_nistp256.c",
"crypto/ec/ecp_nistp521.c",
"crypto/ec/ecp_nistputil.c",
"crypto/ec/ecp_oct.c",
"crypto/ec/ecp_smpl.c",
"crypto/ec/ecx_meth.c",
"crypto/engine/eng_all.c",
"crypto/engine/eng_cnf.c",
"crypto/engine/eng_ctrl.c",
"crypto/engine/eng_dyn.c",
"crypto/engine/eng_err.c",
"crypto/engine/eng_fat.c",
"crypto/engine/eng_init.c",
"crypto/engine/eng_lib.c",
"crypto/engine/eng_list.c",
"crypto/engine/eng_openssl.c",
"crypto/engine/eng_pkey.c",
"crypto/engine/eng_rdrand.c",
"crypto/engine/eng_table.c",
"crypto/engine/tb_asnmth.c",
"crypto/engine/tb_cipher.c",
"crypto/engine/tb_dh.c",
"crypto/engine/tb_digest.c",
"crypto/engine/tb_dsa.c",
"crypto/engine/tb_eckey.c",
"crypto/engine/tb_pkmeth.c",
"crypto/engine/tb_rand.c",
"crypto/engine/tb_rsa.c",
"crypto/err/err.c",
"crypto/err/err_all.c",
"crypto/err/err_prn.c",
"crypto/evp/bio_b64.c",
"crypto/evp/bio_enc.c",
"crypto/evp/bio_md.c",
"crypto/evp/bio_ok.c",
"crypto/evp/c_allc.c",
"crypto/evp/c_alld.c",
"crypto/evp/cmeth_lib.c",
"crypto/evp/digest.c",
"crypto/evp/e_aes.c",
"crypto/evp/e_aes_cbc_hmac_sha1.c",
"crypto/evp/e_aes_cbc_hmac_sha256.c",
"crypto/evp/e_aria.c",
"crypto/evp/e_bf.c",
"crypto/evp/e_camellia.c",
"crypto/evp/e_cast.c",
"crypto/evp/e_chacha20_poly1305.c",
"crypto/evp/e_des.c",
"crypto/evp/e_des3.c",
"crypto/evp/e_idea.c",
"crypto/evp/e_null.c",
"crypto/evp/e_old.c",
"crypto/evp/e_rc2.c",
"crypto/evp/e_rc4.c",
"crypto/evp/e_rc4_hmac_md5.c",
"crypto/evp/e_rc5.c",
"crypto/evp/e_seed.c",
"crypto/evp/e_sm4.c",
"crypto/evp/e_xcbc_d.c",
"crypto/evp/encode.c",
"crypto/evp/evp_cnf.c",
"crypto/evp/evp_enc.c",
"crypto/evp/evp_err.c",
"crypto/evp/evp_key.c",
"crypto/evp/evp_lib.c",
"crypto/evp/evp_pbe.c",
"crypto/evp/evp_pkey.c",
"crypto/evp/m_md2.c",
"crypto/evp/m_md4.c",
"crypto/evp/m_md5.c",
"crypto/evp/m_md5_sha1.c",
"crypto/evp/m_mdc2.c",
"crypto/evp/m_null.c",
"crypto/evp/m_ripemd.c",
"crypto/evp/m_sha1.c",
"crypto/evp/m_sha3.c",
"crypto/evp/m_sigver.c",
"crypto/evp/m_wp.c",
"crypto/evp/names.c",
"crypto/evp/p5_crpt.c",
"crypto/evp/p5_crpt2.c",
"crypto/evp/p_dec.c",
"crypto/evp/p_enc.c",
"crypto/evp/p_lib.c",
"crypto/evp/p_open.c",
"crypto/evp/p_seal.c",
"crypto/evp/p_sign.c",
"crypto/evp/p_verify.c",
"crypto/evp/pbe_scrypt.c",
"crypto/evp/pmeth_fn.c",
"crypto/evp/pmeth_gn.c",
"crypto/evp/pmeth_lib.c",
"crypto/ex_data.c",
"crypto/getenv.c",
"crypto/hmac/hm_ameth.c",
"crypto/hmac/hm_pmeth.c",
"crypto/hmac/hmac.c",
"crypto/idea/i_cbc.c",
"crypto/idea/i_cfb64.c",
"crypto/idea/i_ecb.c",
"crypto/idea/i_ofb64.c",
"crypto/idea/i_skey.c",
"crypto/init.c",
"crypto/kdf/hkdf.c",
"crypto/kdf/kdf_err.c",
"crypto/kdf/scrypt.c",
"crypto/kdf/tls1_prf.c",
"crypto/lhash/lh_stats.c",
"crypto/lhash/lhash.c",
"crypto/md4/md4_dgst.c",
"crypto/md4/md4_one.c",
"crypto/md5/md5_dgst.c",
"crypto/md5/md5_one.c",
"crypto/mdc2/mdc2_one.c",
"crypto/mdc2/mdc2dgst.c",
"crypto/mem.c",
"crypto/mem_clr.c",
"crypto/mem_dbg.c",
"crypto/mem_sec.c",
"crypto/modes/cbc128.c",
"crypto/modes/ccm128.c",
"crypto/modes/cfb128.c",
"crypto/modes/ctr128.c",
"crypto/modes/cts128.c",
"crypto/modes/gcm128.c",
"crypto/modes/ocb128.c",
"crypto/modes/ofb128.c",
"crypto/modes/wrap128.c",
"crypto/modes/xts128.c",
"crypto/o_dir.c",
"crypto/o_fips.c",
"crypto/o_fopen.c",
"crypto/o_init.c",
"crypto/o_str.c",
"crypto/o_time.c",
"crypto/objects/o_names.c",
"crypto/objects/obj_dat.c",
"crypto/objects/obj_err.c",
"crypto/objects/obj_lib.c",
"crypto/objects/obj_xref.c",
"crypto/ocsp/ocsp_asn.c",
"crypto/ocsp/ocsp_cl.c",
"crypto/ocsp/ocsp_err.c",
"crypto/ocsp/ocsp_ext.c",
"crypto/ocsp/ocsp_ht.c",
"crypto/ocsp/ocsp_lib.c",
"crypto/ocsp/ocsp_prn.c",
"crypto/ocsp/ocsp_srv.c",
"crypto/ocsp/ocsp_vfy.c",
"crypto/ocsp/v3_ocsp.c",
"crypto/pem/pem_all.c",
"crypto/pem/pem_err.c",
"crypto/pem/pem_info.c",
"crypto/pem/pem_lib.c",
"crypto/pem/pem_oth.c",
"crypto/pem/pem_pk8.c",
"crypto/pem/pem_pkey.c",
"crypto/pem/pem_sign.c",
"crypto/pem/pem_x509.c",
"crypto/pem/pem_xaux.c",
"crypto/pem/pvkfmt.c",
"crypto/pkcs12/p12_add.c",
"crypto/pkcs12/p12_asn.c",
"crypto/pkcs12/p12_attr.c",
"crypto/pkcs12/p12_crpt.c",
"crypto/pkcs12/p12_crt.c",
"crypto/pkcs12/p12_decr.c",
"crypto/pkcs12/p12_init.c",
"crypto/pkcs12/p12_key.c",
"crypto/pkcs12/p12_kiss.c",
"crypto/pkcs12/p12_mutl.c",
"crypto/pkcs12/p12_npas.c",
"crypto/pkcs12/p12_p8d.c",
"crypto/pkcs12/p12_p8e.c",
"crypto/pkcs12/p12_sbag.c",
"crypto/pkcs12/p12_utl.c",
"crypto/pkcs12/pk12err.c",
"crypto/pkcs7/bio_pk7.c",
"crypto/pkcs7/pk7_asn1.c",
"crypto/pkcs7/pk7_attr.c",
"crypto/pkcs7/pk7_doit.c",
"crypto/pkcs7/pk7_lib.c",
"crypto/pkcs7/pk7_mime.c",
"crypto/pkcs7/pk7_smime.c",
"crypto/pkcs7/pkcs7err.c",
"crypto/poly1305/poly1305.c",
"crypto/poly1305/poly1305_ameth.c",
"crypto/poly1305/poly1305_pmeth.c",
"crypto/rand/drbg_ctr.c",
"crypto/rand/drbg_lib.c",
"crypto/rand/rand_egd.c",
"crypto/rand/rand_err.c",
"crypto/rand/rand_lib.c",
"crypto/rand/rand_unix.c",
"crypto/rand/rand_vms.c",
"crypto/rand/rand_win.c",
"crypto/rand/randfile.c",
"crypto/rc4/rc4_enc.c",
"crypto/rc4/rc4_skey.c",
"crypto/rsa/rsa_ameth.c",
"crypto/rsa/rsa_asn1.c",
"crypto/rsa/rsa_chk.c",
"crypto/rsa/rsa_crpt.c",
"crypto/rsa/rsa_depr.c",
"crypto/rsa/rsa_err.c",
"crypto/rsa/rsa_gen.c",
"crypto/rsa/rsa_lib.c",
"crypto/rsa/rsa_meth.c",
"crypto/rsa/rsa_mp.c",
"crypto/rsa/rsa_none.c",
"crypto/rsa/rsa_oaep.c",
"crypto/rsa/rsa_ossl.c",
"crypto/rsa/rsa_pk1.c",
"crypto/rsa/rsa_pmeth.c",
"crypto/rsa/rsa_prn.c",
"crypto/rsa/rsa_pss.c",
"crypto/rsa/rsa_saos.c",
"crypto/rsa/rsa_sign.c",
"crypto/rsa/rsa_ssl.c",
"crypto/rsa/rsa_x931.c",
"crypto/rsa/rsa_x931g.c",
"crypto/seed/seed.c",
"crypto/seed/seed_cbc.c",
"crypto/seed/seed_cfb.c",
"crypto/seed/seed_ecb.c",
"crypto/seed/seed_ofb.c",
"crypto/sha/keccak1600.c",
"crypto/sha/sha1_one.c",
"crypto/sha/sha1dgst.c",
"crypto/sha/sha256.c",
"crypto/sha/sha512.c",
"crypto/siphash/siphash.c",
"crypto/siphash/siphash_ameth.c",
"crypto/siphash/siphash_pmeth.c",
"crypto/sm2/sm2_crypt.c",
"crypto/sm2/sm2_err.c",
"crypto/sm2/sm2_pmeth.c",
"crypto/sm2/sm2_sign.c",
"crypto/sm3/m_sm3.c",
"crypto/sm3/sm3.c",
"crypto/sm4/sm4.c",
"crypto/srp/srp_lib.c",
"crypto/srp/srp_vfy.c",
"crypto/stack/stack.c",
"crypto/store/loader_file.c",
"crypto/store/store_err.c",
"crypto/store/store_init.c",
"crypto/store/store_lib.c",
"crypto/store/store_register.c",
"crypto/store/store_strings.c",
"crypto/threads_none.c",
"crypto/threads_pthread.c",
"crypto/threads_win.c",
"crypto/ts/ts_asn1.c",
"crypto/ts/ts_conf.c",
"crypto/ts/ts_err.c",
"crypto/ts/ts_lib.c",
"crypto/ts/ts_req_print.c",
"crypto/ts/ts_req_utils.c",
"crypto/ts/ts_rsp_print.c",
"crypto/ts/ts_rsp_sign.c",
"crypto/ts/ts_rsp_utils.c",
"crypto/ts/ts_rsp_verify.c",
"crypto/ts/ts_verify_ctx.c",
"crypto/txt_db/txt_db.c",
"crypto/ui/ui_err.c",
"crypto/ui/ui_lib.c",
"crypto/ui/ui_null.c",
"crypto/ui/ui_openssl.c",
"crypto/ui/ui_util.c",
"crypto/uid.c",
"crypto/whrlpool/wp_block.c",
"crypto/whrlpool/wp_dgst.c",
"crypto/x509/by_dir.c",
"crypto/x509/by_file.c",
"crypto/x509/t_crl.c",
"crypto/x509/t_req.c",
"crypto/x509/t_x509.c",
"crypto/x509/x509_att.c",
"crypto/x509/x509_cmp.c",
"crypto/x509/x509_d2.c",
"crypto/x509/x509_def.c",
"crypto/x509/x509_err.c",
"crypto/x509/x509_ext.c",
"crypto/x509/x509_lu.c",
"crypto/x509/x509_meth.c",
"crypto/x509/x509_obj.c",
"crypto/x509/x509_r2x.c",
"crypto/x509/x509_req.c",
"crypto/x509/x509_set.c",
"crypto/x509/x509_trs.c",
"crypto/x509/x509_txt.c",
"crypto/x509/x509_v3.c",
"crypto/x509/x509_vfy.c",
"crypto/x509/x509_vpm.c",
"crypto/x509/x509cset.c",
"crypto/x509/x509name.c",
"crypto/x509/x509rset.c",
"crypto/x509/x509spki.c",
"crypto/x509/x509type.c",
"crypto/x509/x_all.c",
"crypto/x509/x_attrib.c",
"crypto/x509/x_crl.c",
"crypto/x509/x_exten.c",
"crypto/x509/x_name.c",
"crypto/x509/x_pubkey.c",
"crypto/x509/x_req.c",
"crypto/x509/x_x509.c",
"crypto/x509/x_x509a.c",
"crypto/x509v3/pcy_cache.c",
"crypto/x509v3/pcy_data.c",
"crypto/x509v3/pcy_lib.c",
"crypto/x509v3/pcy_map.c",
"crypto/x509v3/pcy_node.c",
"crypto/x509v3/pcy_tree.c",
"crypto/x509v3/v3_addr.c",
"crypto/x509v3/v3_admis.c",
"crypto/x509v3/v3_akey.c",
"crypto/x509v3/v3_akeya.c",
"crypto/x509v3/v3_alt.c",
"crypto/x509v3/v3_asid.c",
"crypto/x509v3/v3_bcons.c",
"crypto/x509v3/v3_bitst.c",
"crypto/x509v3/v3_conf.c",
"crypto/x509v3/v3_cpols.c",
"crypto/x509v3/v3_crld.c",
"crypto/x509v3/v3_enum.c",
"crypto/x509v3/v3_extku.c",
"crypto/x509v3/v3_genn.c",
"crypto/x509v3/v3_ia5.c",
"crypto/x509v3/v3_info.c",
"crypto/x509v3/v3_int.c",
"crypto/x509v3/v3_lib.c",
"crypto/x509v3/v3_ncons.c",
"crypto/x509v3/v3_pci.c",
"crypto/x509v3/v3_pcia.c",
"crypto/x509v3/v3_pcons.c",
"crypto/x509v3/v3_pku.c",
"crypto/x509v3/v3_pmaps.c",
"crypto/x509v3/v3_prn.c",
"crypto/x509v3/v3_purp.c",
"crypto/x509v3/v3_skey.c",
"crypto/x509v3/v3_sxnet.c",
"crypto/x509v3/v3_tlsf.c",
"crypto/x509v3/v3_utl.c",
"crypto/x509v3/v3err.c",
]
cflags = [
"-DNDEBUG",
"-DOPENSSL_PIC",
"-Wall",
"-pthread",
"-fPIC",
"-DOPENSSL_USE_NODELETE",
"-DOPENSSLDIR=\"\"",
"-DENGINESDIR=\"\"",
"-DOPENSSL_NO_BF",
"-DOPENSSL_NO_CAMELLIA",
"-DOPENSSL_NO_CAST",
"-DOPENSSL_NO_CT",
"-DOPENSSL_NO_MD2",
"-DOPENSSL_NO_RC5",
"-DOPENSSL_NO_RC2",
"-DOPENSSL_NO_RIPEMD",
"-DOPENSSL_NO_RMD160",
]
include_dirs += [
"harmoney_api/communication/include",
"//sdk/phone/android-arm64/hiviewdfx/libhilog/include",
]
sources += [
"harmoney_api/communication/src/crypto_commu.c"
]
cflags_cc = [
"-fvisibility=hidden",
]
cflags += [
"-fvisibility=hidden",
]
deps = [
"//utils/native/base:utils",
]
external_deps = [
"hiviewdfx:libhilog",
]
subsystem_name = "common"
remove_configs = ["//build/config/coverage:default_coverage"]
}
config("ssl_config") {
include_dirs = [
"./",
......
/*
* Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved.
* Description: Interface of encrypt decrypt
* Author: tanshengguo
* Create: 2019-10-23
*/
#ifndef CRYPTO_COMMUH_H
#define CRYPTO_COMMUH_H
#include <stdint.h>
#include <sys/types.h>
#define GCM_KEY_LENGTH_256 32
#define GCM_IV_BITS 96
#define GCM_IV_BYTES 12
#define AES_BLOCK_SIZE 16
#define OPENSSL_API __attribute__((visibility("default")))
#define OPENSSL_UNUSED __attribute__((unused))
OPENSSL_API extern ssize_t CryptoCommuGetEncryptOverhead();
OPENSSL_API extern ssize_t CryptoCommuEncrypt(const uint8_t *key, const void *in, size_t inLen, void *out,
size_t outLen);
OPENSSL_API extern ssize_t CryptoCommuDecrypt(const uint8_t *key, const void *in, size_t inLen, void *out,
size_t outLen);
#endif // CRYPTO_COMMUH_H
/*
* Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved.
* Description: Implement encrypt decrpyt.
* Author: luoxinqiang
* Create: 2019-10-23
*/
#include "../include/crypto_commu.h"
#include <netinet/in.h>
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include "crypto_commu_log.h"
ssize_t CryptoCommuGetEncryptOverhead()
{
return GCM_IV_BYTES + AES_BLOCK_SIZE;
}
ssize_t CryptoCommuEncrypt(const uint8_t *key, const void *in, size_t inLen, void *out, size_t outLen)
{
if ((in == NULL) || ((ssize_t)inLen <= 0) || (out == NULL) || ((ssize_t)outLen <= 0)) {
DB_LOGE("invalid parameters");
return -1;
}
uint8_t *outBuf = (uint8_t *)(out);
if (RAND_bytes(outBuf, GCM_IV_BYTES) != 1) {
DB_LOGE("%s: generate iv fail!\n", __func__);
return -1;
}
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
do {
ssize_t overheadLen = CryptoCommuGetEncryptOverhead();
if (((ssize_t)(outLen - overheadLen) <= 0) || (inLen + overheadLen) > outLen) {
DB_LOGE("outBuf small");
break;
}
// the begin of outBuf is key
if (EVP_EncryptInit(ctx, EVP_aes_256_gcm(), key, outBuf) != 1) {
DB_LOGE("%s: init ctx fail!\n", __func__);
break;
}
const uint8_t *inBuf = (const uint8_t *)(in);
int outBufLen;
int inBufLen = (int)(inLen);
// outBuf + IV length is context
if (EVP_EncryptUpdate(ctx, outBuf + GCM_IV_BYTES, &outBufLen, inBuf, inBufLen) != 1) {
DB_LOGE("%s: update fail!\n", __func__);
break;
}
int outLenFinal;
if (EVP_EncryptFinal_ex(ctx, outBuf + GCM_IV_BYTES, &outLenFinal) < 0) {
DB_LOGE("%s: final fail!\n", __func__);
break;
}
// the last 16 byte of outbuf is tag
if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, AES_BLOCK_SIZE, outBuf + GCM_IV_BYTES + inBufLen) != 1) {
DB_LOGE("%s: get tag fail!\n", __func__);
break;
}
EVP_CIPHER_CTX_free(ctx);
return outBufLen + CryptoCommuGetEncryptOverhead();
} while (0);
// error handler
EVP_CIPHER_CTX_free(ctx);
return -1;
}
ssize_t CryptoCommuDecrypt(const uint8_t *key, const void *in, size_t inLen, void *out, size_t outLen)
{
if ((key == NULL) || (in == NULL) || ((ssize_t)inLen <= 0) || (out == NULL) || ((ssize_t)outLen <= 0)) {
DB_LOGE("invalid parameters");
return -1;
}
const uint8_t *inBuf = (const uint8_t *)(in);
uint8_t *outBuf = (uint8_t *)(out);
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
// |---iv(12)-- | -----text----- | ----tag(16)----|
do {
ssize_t overheadLen = CryptoCommuGetEncryptOverhead();
if (((ssize_t)(inLen - overheadLen) <= 0) || ((inLen - overheadLen) > outLen)) {
DB_LOGE("outBuf small");
break;
}
if (EVP_DecryptInit(ctx, EVP_aes_256_gcm(), key, inBuf) != 1) {
DB_LOGE("%s: init ctx fail!\n", __func__);
break;
}
int inBufLen = (int)(inLen);
int outBufLen = 0;
if (EVP_DecryptUpdate(ctx, outBuf, &outBufLen, inBuf + GCM_IV_BYTES, inBufLen) != 1) {
DB_LOGE("%s: update fail!\n", __func__);
break;
}
if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, AES_BLOCK_SIZE,
(void *)(inBuf + GCM_IV_BYTES + outBufLen)) != 1) {
DB_LOGE("%s: set tag fail!\n", __func__);
break;
}
int outLenFinal;
if (EVP_DecryptFinal_ex(ctx, outBuf, &outLenFinal) < 0) {
break;
}
EVP_CIPHER_CTX_free(ctx);
DB_LOGD("decrypt success");
return outBufLen - overheadLen;
} while (0);
// error handler
EVP_CIPHER_CTX_free(ctx);
DB_LOGE("%s: decrypt fail!\n", __func__);
return -1;
}
/*
* Copyright (c) Huawei Technologies Co., Ltd. 2019-2019. All rights reserved.
* Description: Interface of Data Bus Log
* Author: xujingguo
* Create: 2019-11-25
*/
#ifndef CRYPTO_COMMU_LOG_H
#define CRYPTO_COMMU_LOG_H
#ifndef __TITLE__
#define __TITLE__ __PRETTY_FUNCTION__
#endif
#include "hilog/log.h"
#undef LOG_DOMAIN
#undef LOG_TAG
#define LOG_DOMAIN 0
#define LOG_TAG "CryptoCommu"
#define DB_LOGE(fmt, args...) HILOG_WARN(LOG_CORE,"%s %d: " fmt, __TITLE__, __LINE__, ##args)
#define DB_LOGW(fmt, args...) HILOG_WARN(LOG_CORE,"%s %d: " fmt, __TITLE__, __LINE__, ##args)
#define DB_LOGI(fmt, args...) HILOG_INFO(LOG_CORE,"%s %d: " fmt, __TITLE__, __LINE__, ##args)
#define DB_LOGD(fmt, args...) HILOG_DEBUG(LOG_CORE,"%s %d: " fmt, __TITLE__, __LINE__, ##args)
#endif // CRYPTO_COMMU_LOG_H
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册