├── .gitignore ├── COPYRIGHT ├── Cryptlib ├── Base.h ├── Cipher │ ├── CryptAes.c │ ├── CryptArc4.c │ └── CryptTdes.c ├── Cryptlib.diff ├── Hash │ ├── CryptMd4.c │ ├── CryptMd5.c │ ├── CryptSha1.c │ ├── CryptSha256.c │ └── CryptSha512.c ├── Hmac │ ├── CryptHmacMd5.c │ └── CryptHmacSha1.c ├── Include │ ├── OpenSslSupport.h │ ├── Protocol │ │ └── RuntimeCrypt.h │ ├── arpa │ │ └── inet.h │ ├── assert.h │ ├── ctype.h │ ├── dirent.h │ ├── errno.h │ ├── limits.h │ ├── malloc.h │ ├── math.h │ ├── memory.h │ ├── netdb.h │ ├── netinet │ │ └── in.h │ ├── openssl │ │ ├── README │ │ ├── aes.h │ │ ├── asn1.h │ │ ├── asn1_mac.h │ │ ├── asn1t.h │ │ ├── bio.h │ │ ├── blowfish.h │ │ ├── bn.h │ │ ├── buffer.h │ │ ├── camellia.h │ │ ├── cast.h │ │ ├── cmac.h │ │ ├── cms.h │ │ ├── comp.h │ │ ├── conf.h │ │ ├── conf_api.h │ │ ├── crypto.h │ │ ├── des.h │ │ ├── des_old.h │ │ ├── dh.h │ │ ├── dsa.h │ │ ├── dso.h │ │ ├── dtls1.h │ │ ├── e_os2.h │ │ ├── ebcdic.h │ │ ├── ec.h │ │ ├── ecdh.h │ │ ├── ecdsa.h │ │ ├── engine.h │ │ ├── err.h │ │ ├── evp.h │ │ ├── hmac.h │ │ ├── idea.h │ │ ├── krb5_asn.h │ │ ├── kssl.h │ │ ├── lhash.h │ │ ├── md4.h │ │ ├── md5.h │ │ ├── mdc2.h │ │ ├── modes.h │ │ ├── obj_mac.h │ │ ├── objects.h │ │ ├── ocsp.h │ │ ├── opensslconf.h │ │ ├── opensslv.h │ │ ├── ossl_typ.h │ │ ├── pem.h │ │ ├── pem2.h │ │ ├── pkcs12.h │ │ ├── pkcs7.h │ │ ├── pqueue.h │ │ ├── rand.h │ │ ├── rc2.h │ │ ├── rc4.h │ │ ├── ripemd.h │ │ ├── rsa.h │ │ ├── safestack.h │ │ ├── seed.h │ │ ├── sha.h │ │ ├── srp.h │ │ ├── srtp.h │ │ ├── ssl.h │ │ ├── ssl2.h │ │ ├── ssl23.h │ │ ├── ssl3.h │ │ ├── stack.h │ │ ├── symhacks.h │ │ ├── tls1.h │ │ ├── ts.h │ │ ├── txt_db.h │ │ ├── ui.h │ │ ├── ui_compat.h │ │ ├── whrlpool.h │ │ ├── x509.h │ │ ├── x509_vfy.h │ │ └── x509v3.h │ ├── sgtty.h │ ├── signal.h │ ├── stdarg.h │ ├── stddef.h │ ├── stdio.h │ ├── stdlib.h │ ├── string.h │ ├── strings.h │ ├── sys │ │ ├── ioctl.h │ │ ├── param.h │ │ ├── socket.h │ │ ├── stat.h │ │ ├── time.h │ │ ├── times.h │ │ ├── types.h │ │ └── un.h │ ├── syslog.h │ ├── time.h │ └── unistd.h ├── InternalCryptLib.h ├── Library │ ├── BaseCryptLib.h │ ├── BaseLib.h │ ├── BaseMemoryLib.h │ ├── DebugLib.h │ └── MemoryAllocationLib.h ├── Makefile ├── OpenSSL │ ├── Makefile │ ├── buildinf.h │ ├── crypto │ │ ├── LPdir_nyi.c │ │ ├── aes │ │ │ ├── aes_cbc.c │ │ │ ├── aes_cfb.c │ │ │ ├── aes_core.c │ │ │ ├── aes_ctr.c │ │ │ ├── aes_ecb.c │ │ │ ├── aes_ige.c │ │ │ ├── aes_locl.h │ │ │ ├── aes_misc.c │ │ │ ├── aes_ofb.c │ │ │ └── aes_wrap.c │ │ ├── asn1 │ │ │ ├── a_bitstr.c │ │ │ ├── a_bool.c │ │ │ ├── a_bytes.c │ │ │ ├── a_d2i_fp.c │ │ │ ├── a_digest.c │ │ │ ├── a_dup.c │ │ │ ├── a_enum.c │ │ │ ├── a_gentm.c │ │ │ ├── a_i2d_fp.c │ │ │ ├── a_int.c │ │ │ ├── a_mbstr.c │ │ │ ├── a_object.c │ │ │ ├── a_octet.c │ │ │ ├── a_print.c │ │ │ ├── a_set.c │ │ │ ├── a_sign.c │ │ │ ├── a_strex.c │ │ │ ├── a_strnid.c │ │ │ ├── a_time.c │ │ │ ├── a_type.c │ │ │ ├── a_utctm.c │ │ │ ├── a_utf8.c │ │ │ ├── a_verify.c │ │ │ ├── ameth_lib.c │ │ │ ├── asn1_err.c │ │ │ ├── asn1_gen.c │ │ │ ├── asn1_lib.c │ │ │ ├── asn1_locl.h │ │ │ ├── asn1_par.c │ │ │ ├── asn_mime.c │ │ │ ├── asn_moid.c │ │ │ ├── asn_pack.c │ │ │ ├── bio_asn1.c │ │ │ ├── bio_ndef.c │ │ │ ├── charmap.h │ │ │ ├── d2i_pr.c │ │ │ ├── d2i_pu.c │ │ │ ├── evp_asn1.c │ │ │ ├── f_enum.c │ │ │ ├── f_int.c │ │ │ ├── f_string.c │ │ │ ├── i2d_pr.c │ │ │ ├── i2d_pu.c │ │ │ ├── n_pkey.c │ │ │ ├── nsseq.c │ │ │ ├── p5_pbe.c │ │ │ ├── p5_pbev2.c │ │ │ ├── p8_pkey.c │ │ │ ├── t_bitst.c │ │ │ ├── t_crl.c │ │ │ ├── t_pkey.c │ │ │ ├── t_req.c │ │ │ ├── t_spki.c │ │ │ ├── t_x509.c │ │ │ ├── t_x509a.c │ │ │ ├── tasn_dec.c │ │ │ ├── tasn_enc.c │ │ │ ├── tasn_fre.c │ │ │ ├── tasn_new.c │ │ │ ├── tasn_prn.c │ │ │ ├── tasn_typ.c │ │ │ ├── tasn_utl.c │ │ │ ├── x_algor.c │ │ │ ├── x_attrib.c │ │ │ ├── x_bignum.c │ │ │ ├── x_crl.c │ │ │ ├── x_exten.c │ │ │ ├── x_info.c │ │ │ ├── x_long.c │ │ │ ├── x_name.c │ │ │ ├── x_nx509.c │ │ │ ├── x_pkey.c │ │ │ ├── x_pubkey.c │ │ │ ├── x_req.c │ │ │ ├── x_sig.c │ │ │ ├── x_spki.c │ │ │ ├── x_val.c │ │ │ ├── x_x509.c │ │ │ └── x_x509a.c │ │ ├── bio │ │ │ ├── b_dump.c │ │ │ ├── b_print.c │ │ │ ├── b_sock.c │ │ │ ├── bf_buff.c │ │ │ ├── bf_nbio.c │ │ │ ├── bf_null.c │ │ │ ├── bio_cb.c │ │ │ ├── bio_err.c │ │ │ ├── bio_lcl.h │ │ │ ├── bio_lib.c │ │ │ ├── bss_acpt.c │ │ │ ├── bss_bio.c │ │ │ ├── bss_conn.c │ │ │ ├── bss_dgram.c │ │ │ ├── bss_fd.c │ │ │ ├── bss_file.c │ │ │ ├── bss_log.c │ │ │ ├── bss_mem.c │ │ │ ├── bss_null.c │ │ │ └── bss_sock.c │ │ ├── bn │ │ │ ├── bn.h │ │ │ ├── bn_add.c │ │ │ ├── bn_asm.c │ │ │ ├── bn_blind.c │ │ │ ├── bn_const.c │ │ │ ├── bn_ctx.c │ │ │ ├── bn_depr.c │ │ │ ├── bn_div.c │ │ │ ├── bn_err.c │ │ │ ├── bn_exp.c │ │ │ ├── bn_exp2.c │ │ │ ├── bn_gcd.c │ │ │ ├── bn_gf2m.c │ │ │ ├── bn_kron.c │ │ │ ├── bn_lcl.h │ │ │ ├── bn_lib.c │ │ │ ├── bn_mod.c │ │ │ ├── bn_mont.c │ │ │ ├── bn_mpi.c │ │ │ ├── bn_mul.c │ │ │ ├── bn_nist.c │ │ │ ├── bn_prime.c │ │ │ ├── bn_prime.h │ │ │ ├── bn_print.c │ │ │ ├── bn_rand.c │ │ │ ├── bn_recp.c │ │ │ ├── bn_shift.c │ │ │ ├── bn_sqr.c │ │ │ ├── bn_sqrt.c │ │ │ ├── bn_word.c │ │ │ ├── bn_x931p.c │ │ │ └── rsaz_exp.h │ │ ├── buffer │ │ │ ├── buf_err.c │ │ │ ├── buf_str.c │ │ │ └── buffer.c │ │ ├── cmac │ │ │ ├── cm_ameth.c │ │ │ ├── cm_pmeth.c │ │ │ └── cmac.c │ │ ├── comp │ │ │ ├── c_rle.c │ │ │ ├── c_zlib.c │ │ │ ├── comp_err.c │ │ │ └── comp_lib.c │ │ ├── conf │ │ │ ├── conf_api.c │ │ │ ├── conf_def.c │ │ │ ├── conf_def.h │ │ │ ├── conf_err.c │ │ │ ├── conf_lib.c │ │ │ ├── conf_mall.c │ │ │ ├── conf_mod.c │ │ │ └── conf_sap.c │ │ ├── constant_time_locl.h │ │ ├── cpt_err.c │ │ ├── cryptlib.c │ │ ├── cryptlib.h │ │ ├── cversion.c │ │ ├── des │ │ │ ├── cbc_cksm.c │ │ │ ├── cbc_enc.c │ │ │ ├── cfb64ede.c │ │ │ ├── cfb64enc.c │ │ │ ├── cfb_enc.c │ │ │ ├── des_enc.c │ │ │ ├── des_locl.h │ │ │ ├── des_old.c │ │ │ ├── des_old2.c │ │ │ ├── des_ver.h │ │ │ ├── ecb3_enc.c │ │ │ ├── ecb_enc.c │ │ │ ├── ede_cbcm_enc.c │ │ │ ├── enc_read.c │ │ │ ├── enc_writ.c │ │ │ ├── fcrypt.c │ │ │ ├── fcrypt_b.c │ │ │ ├── ncbc_enc.c │ │ │ ├── ofb64ede.c │ │ │ ├── ofb64enc.c │ │ │ ├── ofb_enc.c │ │ │ ├── pcbc_enc.c │ │ │ ├── qud_cksm.c │ │ │ ├── rand_key.c │ │ │ ├── read2pwd.c │ │ │ ├── rpc_des.h │ │ │ ├── rpc_enc.c │ │ │ ├── set_key.c │ │ │ ├── spr.h │ │ │ ├── str2key.c │ │ │ └── xcbc_enc.c │ │ ├── dh │ │ │ ├── dh_ameth.c │ │ │ ├── dh_asn1.c │ │ │ ├── dh_check.c │ │ │ ├── dh_depr.c │ │ │ ├── dh_err.c │ │ │ ├── dh_gen.c │ │ │ ├── dh_key.c │ │ │ ├── dh_lib.c │ │ │ ├── dh_pmeth.c │ │ │ ├── dh_prn.c │ │ │ └── dh_rfc5114.c │ │ ├── dso │ │ │ ├── dso_beos.c │ │ │ ├── dso_dl.c │ │ │ ├── dso_dlfcn.c │ │ │ ├── dso_err.c │ │ │ ├── dso_lib.c │ │ │ ├── dso_null.c │ │ │ ├── dso_openssl.c │ │ │ ├── dso_vms.c │ │ │ └── dso_win32.c │ │ ├── ebcdic.c │ │ ├── err │ │ │ ├── err.c │ │ │ ├── err_all.c │ │ │ └── err_prn.c │ │ ├── evp │ │ │ ├── bio_b64.c │ │ │ ├── bio_enc.c │ │ │ ├── bio_md.c │ │ │ ├── bio_ok.c │ │ │ ├── c_all.c │ │ │ ├── c_allc.c │ │ │ ├── c_alld.c │ │ │ ├── digest.c │ │ │ ├── e_aes.c │ │ │ ├── e_aes_cbc_hmac_sha1.c │ │ │ ├── e_aes_cbc_hmac_sha256.c │ │ │ ├── e_bf.c │ │ │ ├── e_camellia.c │ │ │ ├── e_cast.c │ │ │ ├── e_des.c │ │ │ ├── e_des3.c │ │ │ ├── e_idea.c │ │ │ ├── e_null.c │ │ │ ├── e_old.c │ │ │ ├── e_rc2.c │ │ │ ├── e_rc4.c │ │ │ ├── e_rc4_hmac_md5.c │ │ │ ├── e_rc5.c │ │ │ ├── e_seed.c │ │ │ ├── e_xcbc_d.c │ │ │ ├── encode.c │ │ │ ├── evp_acnf.c │ │ │ ├── evp_cnf.c │ │ │ ├── evp_enc.c │ │ │ ├── evp_err.c │ │ │ ├── evp_key.c │ │ │ ├── evp_lib.c │ │ │ ├── evp_locl.h │ │ │ ├── evp_pbe.c │ │ │ ├── evp_pkey.c │ │ │ ├── m_dss.c │ │ │ ├── m_dss1.c │ │ │ ├── m_ecdsa.c │ │ │ ├── m_md2.c │ │ │ ├── m_md4.c │ │ │ ├── m_md5.c │ │ │ ├── m_mdc2.c │ │ │ ├── m_null.c │ │ │ ├── m_ripemd.c │ │ │ ├── m_sha.c │ │ │ ├── m_sha1.c │ │ │ ├── m_sigver.c │ │ │ ├── m_wp.c │ │ │ ├── names.c │ │ │ ├── p5_crpt.c │ │ │ ├── p5_crpt2.c │ │ │ ├── p_dec.c │ │ │ ├── p_enc.c │ │ │ ├── p_lib.c │ │ │ ├── p_open.c │ │ │ ├── p_seal.c │ │ │ ├── p_sign.c │ │ │ ├── p_verify.c │ │ │ ├── pmeth_fn.c │ │ │ ├── pmeth_gn.c │ │ │ └── pmeth_lib.c │ │ ├── ex_data.c │ │ ├── fips_ers.c │ │ ├── hmac │ │ │ ├── hm_ameth.c │ │ │ ├── hm_pmeth.c │ │ │ └── hmac.c │ │ ├── krb5 │ │ │ └── krb5_asn.c │ │ ├── lhash │ │ │ ├── lh_stats.c │ │ │ └── lhash.c │ │ ├── md32_common.h │ │ ├── md4 │ │ │ ├── md4_dgst.c │ │ │ ├── md4_locl.h │ │ │ └── md4_one.c │ │ ├── md5 │ │ │ ├── md5_dgst.c │ │ │ ├── md5_locl.h │ │ │ └── md5_one.c │ │ ├── mem.c │ │ ├── mem_clr.c │ │ ├── mem_dbg.c │ │ ├── modes │ │ │ ├── cbc128.c │ │ │ ├── ccm128.c │ │ │ ├── cfb128.c │ │ │ ├── ctr128.c │ │ │ ├── cts128.c │ │ │ ├── gcm128.c │ │ │ ├── modes_lcl.h │ │ │ ├── ofb128.c │ │ │ ├── wrap128.c │ │ │ └── xts128.c │ │ ├── o_dir.c │ │ ├── o_dir.h │ │ ├── o_fips.c │ │ ├── o_init.c │ │ ├── o_str.c │ │ ├── o_str.h │ │ ├── o_time.c │ │ ├── o_time.h │ │ ├── objects │ │ │ ├── o_names.c │ │ │ ├── obj_dat.c │ │ │ ├── obj_dat.h │ │ │ ├── obj_err.c │ │ │ ├── obj_lib.c │ │ │ ├── obj_xref.c │ │ │ └── obj_xref.h │ │ ├── ocsp │ │ │ ├── ocsp_asn.c │ │ │ ├── ocsp_cl.c │ │ │ ├── ocsp_err.c │ │ │ ├── ocsp_ext.c │ │ │ ├── ocsp_ht.c │ │ │ ├── ocsp_lib.c │ │ │ ├── ocsp_prn.c │ │ │ ├── ocsp_srv.c │ │ │ └── ocsp_vfy.c │ │ ├── pem │ │ │ ├── pem_all.c │ │ │ ├── pem_err.c │ │ │ ├── pem_info.c │ │ │ ├── pem_lib.c │ │ │ ├── pem_oth.c │ │ │ ├── pem_pk8.c │ │ │ ├── pem_pkey.c │ │ │ ├── pem_seal.c │ │ │ ├── pem_sign.c │ │ │ ├── pem_x509.c │ │ │ ├── pem_xaux.c │ │ │ └── pvkfmt.c │ │ ├── pkcs12 │ │ │ ├── p12_add.c │ │ │ ├── p12_asn.c │ │ │ ├── p12_attr.c │ │ │ ├── p12_crpt.c │ │ │ ├── p12_crt.c │ │ │ ├── p12_decr.c │ │ │ ├── p12_init.c │ │ │ ├── p12_key.c │ │ │ ├── p12_kiss.c │ │ │ ├── p12_mutl.c │ │ │ ├── p12_npas.c │ │ │ ├── p12_p8d.c │ │ │ ├── p12_p8e.c │ │ │ ├── p12_utl.c │ │ │ └── pk12err.c │ │ ├── pkcs7 │ │ │ ├── bio_pk7.c │ │ │ ├── pk7_asn1.c │ │ │ ├── pk7_attr.c │ │ │ ├── pk7_doit.c │ │ │ ├── pk7_lib.c │ │ │ ├── pk7_mime.c │ │ │ ├── pk7_smime.c │ │ │ └── pkcs7err.c │ │ ├── pqueue │ │ │ ├── pqueue.c │ │ │ └── pqueue.h │ │ ├── rand │ │ │ ├── md_rand.c │ │ │ ├── rand_err.c │ │ │ ├── rand_lcl.h │ │ │ ├── rand_lib.c │ │ │ ├── rand_unix.c │ │ │ └── randfile.c │ │ ├── rc4 │ │ │ ├── rc4_enc.c │ │ │ ├── rc4_locl.h │ │ │ ├── rc4_skey.c │ │ │ └── rc4_utl.c │ │ ├── rsa │ │ │ ├── rsa_ameth.c │ │ │ ├── rsa_asn1.c │ │ │ ├── rsa_chk.c │ │ │ ├── rsa_crpt.c │ │ │ ├── rsa_depr.c │ │ │ ├── rsa_eay.c │ │ │ ├── rsa_err.c │ │ │ ├── rsa_gen.c │ │ │ ├── rsa_lib.c │ │ │ ├── rsa_locl.h │ │ │ ├── rsa_none.c │ │ │ ├── rsa_null.c │ │ │ ├── rsa_oaep.c │ │ │ ├── rsa_pk1.c │ │ │ ├── rsa_pmeth.c │ │ │ ├── rsa_prn.c │ │ │ ├── rsa_pss.c │ │ │ ├── rsa_saos.c │ │ │ ├── rsa_sign.c │ │ │ ├── rsa_ssl.c │ │ │ └── rsa_x931.c │ │ ├── sha │ │ │ ├── sha1_one.c │ │ │ ├── sha1dgst.c │ │ │ ├── sha256.c │ │ │ ├── sha512.c │ │ │ ├── sha_dgst.c │ │ │ ├── sha_locl.h │ │ │ └── sha_one.c │ │ ├── stack │ │ │ └── stack.c │ │ ├── ts │ │ │ ├── ts.h │ │ │ ├── ts_asn1.c │ │ │ ├── ts_conf.c │ │ │ ├── ts_err.c │ │ │ ├── ts_lib.c │ │ │ ├── ts_req_print.c │ │ │ ├── ts_req_utils.c │ │ │ ├── ts_rsp_print.c │ │ │ ├── ts_rsp_sign.c │ │ │ ├── ts_rsp_utils.c │ │ │ ├── ts_rsp_verify.c │ │ │ └── ts_verify_ctx.c │ │ ├── txt_db │ │ │ └── txt_db.c │ │ ├── ui │ │ │ ├── ui_compat.c │ │ │ ├── ui_lib.c │ │ │ ├── ui_locl.h │ │ │ └── ui_util.c │ │ ├── uid.c │ │ ├── x509 │ │ │ ├── vpm_int.h │ │ │ ├── x509_att.c │ │ │ ├── x509_cmp.c │ │ │ ├── x509_d2.c │ │ │ ├── x509_def.c │ │ │ ├── x509_err.c │ │ │ ├── x509_ext.c │ │ │ ├── x509_lu.c │ │ │ ├── x509_obj.c │ │ │ ├── x509_r2x.c │ │ │ ├── x509_req.c │ │ │ ├── x509_set.c │ │ │ ├── x509_trs.c │ │ │ ├── x509_txt.c │ │ │ ├── x509_v3.c │ │ │ ├── x509_vfy.c │ │ │ ├── x509_vpm.c │ │ │ ├── x509cset.c │ │ │ ├── x509name.c │ │ │ ├── x509rset.c │ │ │ ├── x509spki.c │ │ │ ├── x509type.c │ │ │ └── x_all.c │ │ └── x509v3 │ │ │ ├── ext_dat.h │ │ │ ├── pcy_cache.c │ │ │ ├── pcy_data.c │ │ │ ├── pcy_int.h │ │ │ ├── pcy_lib.c │ │ │ ├── pcy_map.c │ │ │ ├── pcy_node.c │ │ │ ├── pcy_tree.c │ │ │ ├── v3_addr.c │ │ │ ├── v3_akey.c │ │ │ ├── v3_akeya.c │ │ │ ├── v3_alt.c │ │ │ ├── v3_asid.c │ │ │ ├── v3_bcons.c │ │ │ ├── v3_bitst.c │ │ │ ├── v3_conf.c │ │ │ ├── v3_cpols.c │ │ │ ├── v3_crld.c │ │ │ ├── v3_enum.c │ │ │ ├── v3_extku.c │ │ │ ├── v3_genn.c │ │ │ ├── v3_ia5.c │ │ │ ├── v3_info.c │ │ │ ├── v3_int.c │ │ │ ├── v3_lib.c │ │ │ ├── v3_ncons.c │ │ │ ├── v3_ocsp.c │ │ │ ├── v3_pci.c │ │ │ ├── v3_pcia.c │ │ │ ├── v3_pcons.c │ │ │ ├── v3_pku.c │ │ │ ├── v3_pmaps.c │ │ │ ├── v3_prn.c │ │ │ ├── v3_purp.c │ │ │ ├── v3_skey.c │ │ │ ├── v3_sxnet.c │ │ │ ├── v3_utl.c │ │ │ └── v3err.c │ ├── e_os.h │ ├── openssl-bio-b_print-disable-sse.patch │ └── update.sh ├── Pem │ └── CryptPem.c ├── Pk │ ├── CryptAuthenticode.c │ ├── CryptDhNull.c │ ├── CryptPkcs7SignNull.c │ ├── CryptPkcs7Verify.c │ ├── CryptRsaBasic.c │ ├── CryptRsaExtNull.c │ ├── CryptTs.c │ └── CryptX509.c ├── Rand │ └── CryptRand.c ├── SysCall │ ├── BaseMemAllocation.c │ ├── BaseStrings.c │ ├── CrtWrapper.c │ └── TimerWrapper.c └── update.sh ├── Makefile ├── MokManager.c ├── MokVars.txt ├── PasswordCrypt.c ├── PasswordCrypt.h ├── README ├── TODO ├── cert.S ├── crypt_blowfish.c ├── crypt_blowfish.h ├── elf_aarch64_efi.lds ├── elf_arm_efi.lds ├── elf_ia32_efi.lds ├── elf_ia64_efi.lds ├── elf_x86_64_efi.lds ├── fallback.c ├── include ├── PeImage.h ├── configtable.h ├── console.h ├── efiauthenticated.h ├── errors.h ├── execute.h ├── guid.h ├── security_policy.h ├── shell.h ├── simple_file.h ├── str.h ├── variables.h ├── version.h └── wincert.h ├── lib ├── Makefile ├── configtable.c ├── console.c ├── execute.c ├── guid.c ├── security_policy.c ├── shell.c ├── simple_file.c └── variables.c ├── make-certs ├── netboot.c ├── netboot.h ├── replacements.c ├── replacements.h ├── shim.c ├── shim.h ├── testplan.txt ├── ucs2.h ├── version.c.in └── version.h /.gitignore: -------------------------------------------------------------------------------- 1 | .*.sw? 2 | certdb 3 | shim_cert.h 4 | *.a 5 | *.cer 6 | *.crl 7 | *.crt 8 | *.csr 9 | *.db 10 | *.db.attr 11 | *.db.attr.old 12 | *.db.old 13 | *.domain.txt 14 | *.efi 15 | *.efi.debug 16 | *.efi.signed 17 | *.key 18 | *.key 19 | *.o 20 | *.pem 21 | *.p12 22 | *.so 23 | *.srl 24 | *.srl.old 25 | *.tar.* 26 | version.c 27 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright 2012 Red Hat, Inc 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the 13 | distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19 | COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 20 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 26 | OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | Significant portions of this code are derived from Tianocore 29 | (http://tianocore.sf.net) and are Copyright 2009-2012 Intel 30 | Corporation. 31 | -------------------------------------------------------------------------------- /Cryptlib/Base.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjg59/shim/e22a7b5b772dba6588dd955dc017e572f7e29784/Cryptlib/Base.h -------------------------------------------------------------------------------- /Cryptlib/Cryptlib.diff: -------------------------------------------------------------------------------- 1 | diff --git a/Cryptlib/SysCall/BaseMemAllocation.c b/Cryptlib/SysCall/BaseMemAllocation.c 2 | index 68bc25a..1abe78e 100644 3 | --- a/Cryptlib/SysCall/BaseMemAllocation.c 4 | +++ b/Cryptlib/SysCall/BaseMemAllocation.c 5 | @@ -32,7 +32,7 @@ void *realloc (void *ptr, size_t size) 6 | // BUG: hardcode OldSize == size! We have no any knowledge about 7 | // memory size of original pointer ptr. 8 | // 9 | - return ReallocatePool ((UINTN) size, (UINTN) size, ptr); 10 | + return ReallocatePool (ptr, (UINTN) size, (UINTN) size); 11 | } 12 | 13 | /* De-allocates or frees a memory block */ 14 | diff --git a/Cryptlib/SysCall/TimerWrapper.c b/Cryptlib/SysCall/TimerWrapper.c 15 | index 805e6b4..bb7bcba 100644 16 | --- a/Cryptlib/SysCall/TimerWrapper.c 17 | +++ b/Cryptlib/SysCall/TimerWrapper.c 18 | @@ -13,9 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 19 | 20 | **/ 21 | 22 | -#include 23 | #include 24 | -#include 25 | 26 | // 27 | // -- Time Management Routines -- 28 | @@ -78,7 +76,7 @@ time_t time (time_t *timer) 29 | // 30 | // Get the current time and date information 31 | // 32 | - gRT->GetTime (&Time, NULL); 33 | + uefi_call_wrapper(RT->GetTime, 2, &Time, NULL); 34 | 35 | // 36 | // Years Handling 37 | diff --git a/Cryptlib/SysCall/CrtWrapper.c b/Cryptlib/SysCall/CrtWrapper.c 38 | index fb446b6..5a8322d 100644 39 | --- a/Cryptlib/SysCall/CrtWrapper.c 40 | +++ b/Cryptlib/SysCall/CrtWrapper.c 41 | @@ -293,16 +293,6 @@ size_t fwrite (const void *buffer, size_t size, size_t count, FILE *stream) 42 | // -- Dummy OpenSSL Support Routines -- 43 | // 44 | 45 | -int BIO_printf (void *bio, const char *format, ...) 46 | -{ 47 | - return 0; 48 | -} 49 | - 50 | -int BIO_snprintf(char *buf, size_t n, const char *format, ...) 51 | -{ 52 | - return 0; 53 | -} 54 | - 55 | void *UI_OpenSSL(void) 56 | { 57 | return NULL; 58 | -------------------------------------------------------------------------------- /Cryptlib/Include/arpa/inet.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/assert.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/ctype.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/dirent.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/errno.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/limits.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/malloc.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/math.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OPEN SSL 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/memory.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2015, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/netdb.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/netinet/in.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/openssl/README: -------------------------------------------------------------------------------- 1 | This directory contains all the public include files from the OpenSSL project. 2 | -------------------------------------------------------------------------------- /Cryptlib/Include/openssl/cmac.h: -------------------------------------------------------------------------------- 1 | /* crypto/cmac/cmac.h */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 4 | * project. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | */ 54 | 55 | #ifndef HEADER_CMAC_H 56 | # define HEADER_CMAC_H 57 | 58 | #ifdef __cplusplus 59 | extern "C" { 60 | #endif 61 | 62 | # include 63 | 64 | /* Opaque */ 65 | typedef struct CMAC_CTX_st CMAC_CTX; 66 | 67 | CMAC_CTX *CMAC_CTX_new(void); 68 | void CMAC_CTX_cleanup(CMAC_CTX *ctx); 69 | void CMAC_CTX_free(CMAC_CTX *ctx); 70 | EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx); 71 | int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in); 72 | 73 | int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen, 74 | const EVP_CIPHER *cipher, ENGINE *impl); 75 | int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen); 76 | int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen); 77 | int CMAC_resume(CMAC_CTX *ctx); 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | #endif 83 | -------------------------------------------------------------------------------- /Cryptlib/Include/openssl/comp.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HEADER_COMP_H 3 | # define HEADER_COMP_H 4 | 5 | # include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct comp_ctx_st COMP_CTX; 12 | 13 | typedef struct comp_method_st { 14 | int type; /* NID for compression library */ 15 | const char *name; /* A text string to identify the library */ 16 | int (*init) (COMP_CTX *ctx); 17 | void (*finish) (COMP_CTX *ctx); 18 | int (*compress) (COMP_CTX *ctx, 19 | unsigned char *out, unsigned int olen, 20 | unsigned char *in, unsigned int ilen); 21 | int (*expand) (COMP_CTX *ctx, 22 | unsigned char *out, unsigned int olen, 23 | unsigned char *in, unsigned int ilen); 24 | /* 25 | * The following two do NOTHING, but are kept for backward compatibility 26 | */ 27 | long (*ctrl) (void); 28 | long (*callback_ctrl) (void); 29 | } COMP_METHOD; 30 | 31 | struct comp_ctx_st { 32 | COMP_METHOD *meth; 33 | unsigned long compress_in; 34 | unsigned long compress_out; 35 | unsigned long expand_in; 36 | unsigned long expand_out; 37 | CRYPTO_EX_DATA ex_data; 38 | }; 39 | 40 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); 41 | void COMP_CTX_free(COMP_CTX *ctx); 42 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, 43 | unsigned char *in, int ilen); 44 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, 45 | unsigned char *in, int ilen); 46 | COMP_METHOD *COMP_rle(void); 47 | COMP_METHOD *COMP_zlib(void); 48 | void COMP_zlib_cleanup(void); 49 | 50 | # ifdef HEADER_BIO_H 51 | # ifdef ZLIB 52 | BIO_METHOD *BIO_f_zlib(void); 53 | # endif 54 | # endif 55 | 56 | /* BEGIN ERROR CODES */ 57 | /* 58 | * The following lines are auto generated by the script mkerr.pl. Any changes 59 | * made after this point may be overwritten when the script is next run. 60 | */ 61 | void ERR_load_COMP_strings(void); 62 | 63 | /* Error codes for the COMP functions. */ 64 | 65 | /* Function codes. */ 66 | # define COMP_F_BIO_ZLIB_FLUSH 99 67 | # define COMP_F_BIO_ZLIB_NEW 100 68 | # define COMP_F_BIO_ZLIB_READ 101 69 | # define COMP_F_BIO_ZLIB_WRITE 102 70 | 71 | /* Reason codes. */ 72 | # define COMP_R_ZLIB_DEFLATE_ERROR 99 73 | # define COMP_R_ZLIB_INFLATE_ERROR 100 74 | # define COMP_R_ZLIB_NOT_SUPPORTED 101 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | #endif 80 | -------------------------------------------------------------------------------- /Cryptlib/Include/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* crypto/ebcdic.h */ 2 | 3 | #ifndef HEADER_EBCDIC_H 4 | # define HEADER_EBCDIC_H 5 | 6 | # include 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | /* Avoid name clashes with other applications */ 13 | # define os_toascii _openssl_os_toascii 14 | # define os_toebcdic _openssl_os_toebcdic 15 | # define ebcdic2ascii _openssl_ebcdic2ascii 16 | # define ascii2ebcdic _openssl_ascii2ebcdic 17 | 18 | extern const unsigned char os_toascii[256]; 19 | extern const unsigned char os_toebcdic[256]; 20 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 21 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | #endif 27 | -------------------------------------------------------------------------------- /Cryptlib/Include/openssl/pem2.h: -------------------------------------------------------------------------------- 1 | /* ==================================================================== 2 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in 13 | * the documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * 3. All advertising materials mentioning features or use of this 17 | * software must display the following acknowledgment: 18 | * "This product includes software developed by the OpenSSL Project 19 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 20 | * 21 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 22 | * endorse or promote products derived from this software without 23 | * prior written permission. For written permission, please contact 24 | * licensing@OpenSSL.org. 25 | * 26 | * 5. Products derived from this software may not be called "OpenSSL" 27 | * nor may "OpenSSL" appear in their names without prior written 28 | * permission of the OpenSSL Project. 29 | * 30 | * 6. Redistributions of any form whatsoever must retain the following 31 | * acknowledgment: 32 | * "This product includes software developed by the OpenSSL Project 33 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 34 | * 35 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 36 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 37 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 38 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 41 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 42 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 43 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 44 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 45 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 46 | * OF THE POSSIBILITY OF SUCH DAMAGE. 47 | * ==================================================================== 48 | * 49 | * This product includes cryptographic software written by Eric Young 50 | * (eay@cryptsoft.com). This product includes software written by Tim 51 | * Hudson (tjh@cryptsoft.com). 52 | * 53 | */ 54 | 55 | /* 56 | * This header only exists to break a circular dependency between pem and err 57 | * Ben 30 Jan 1999. 58 | */ 59 | 60 | #ifdef __cplusplus 61 | extern "C" { 62 | #endif 63 | 64 | #ifndef HEADER_PEM_H 65 | void ERR_load_PEM_strings(void); 66 | #endif 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | -------------------------------------------------------------------------------- /Cryptlib/Include/openssl/whrlpool.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_WHRLPOOL_H 2 | # define HEADER_WHRLPOOL_H 3 | 4 | # include 5 | # include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | # define WHIRLPOOL_DIGEST_LENGTH (512/8) 12 | # define WHIRLPOOL_BBLOCK 512 13 | # define WHIRLPOOL_COUNTER (256/8) 14 | 15 | typedef struct { 16 | union { 17 | unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; 18 | /* double q is here to ensure 64-bit alignment */ 19 | double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)]; 20 | } H; 21 | unsigned char data[WHIRLPOOL_BBLOCK / 8]; 22 | unsigned int bitoff; 23 | size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)]; 24 | } WHIRLPOOL_CTX; 25 | 26 | # ifndef OPENSSL_NO_WHIRLPOOL 27 | # ifdef OPENSSL_FIPS 28 | int private_WHIRLPOOL_Init(WHIRLPOOL_CTX *c); 29 | # endif 30 | int WHIRLPOOL_Init(WHIRLPOOL_CTX *c); 31 | int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes); 32 | void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits); 33 | int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c); 34 | unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md); 35 | # endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /Cryptlib/Include/sgtty.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/signal.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/stdarg.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/stddef.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | -------------------------------------------------------------------------------- /Cryptlib/Include/stdio.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/stdlib.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/string.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/strings.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | -------------------------------------------------------------------------------- /Cryptlib/Include/sys/ioctl.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/sys/param.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/sys/socket.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/sys/stat.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/sys/time.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/sys/times.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/sys/types.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/sys/un.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | 17 | -------------------------------------------------------------------------------- /Cryptlib/Include/syslog.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | -------------------------------------------------------------------------------- /Cryptlib/Include/time.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | -------------------------------------------------------------------------------- /Cryptlib/Include/unistd.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Include file to support building OpenSSL Crypto Library. 3 | 4 | Copyright (c) 2010, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include 16 | -------------------------------------------------------------------------------- /Cryptlib/InternalCryptLib.h: -------------------------------------------------------------------------------- 1 | /** @file 2 | Internal include file for BaseCryptLib. 3 | 4 | Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #ifndef __INTERNAL_CRYPT_LIB_H__ 16 | #define __INTERNAL_CRYPT_LIB_H__ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include "OpenSslSupport.h" 25 | 26 | // 27 | // Environment Setting for OpenSSL-based UEFI Crypto Library. 28 | // 29 | #ifndef OPENSSL_SYSNAME_UWIN 30 | #define OPENSSL_SYSNAME_UWIN 31 | #endif 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /Cryptlib/Library/BaseLib.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | -------------------------------------------------------------------------------- /Cryptlib/Library/BaseMemoryLib.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjg59/shim/e22a7b5b772dba6588dd955dc017e572f7e29784/Cryptlib/Library/BaseMemoryLib.h -------------------------------------------------------------------------------- /Cryptlib/Library/DebugLib.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjg59/shim/e22a7b5b772dba6588dd955dc017e572f7e29784/Cryptlib/Library/DebugLib.h -------------------------------------------------------------------------------- /Cryptlib/Library/MemoryAllocationLib.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjg59/shim/e22a7b5b772dba6588dd955dc017e572f7e29784/Cryptlib/Library/MemoryAllocationLib.h -------------------------------------------------------------------------------- /Cryptlib/Makefile: -------------------------------------------------------------------------------- 1 | 2 | EFI_INCLUDES = -IInclude -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH) -I$(EFI_INCLUDE)/protocol 3 | 4 | CFLAGS = -ggdb -O0 -I. -fno-stack-protector -fno-strict-aliasing -fpic -fshort-wchar \ 5 | -Wall $(EFI_INCLUDES) -std=gnu89 \ 6 | -ffreestanding -I$(shell $(CC) -print-file-name=include) 7 | 8 | ifeq ($(ARCH),x86_64) 9 | CFLAGS += -mno-mmx -mno-sse -mno-red-zone -nostdinc -maccumulate-outgoing-args \ 10 | -DEFI_FUNCTION_WRAPPER -DGNU_EFI_USE_MS_ABI 11 | endif 12 | ifeq ($(ARCH),ia32) 13 | CFLAGS += -mno-mmx -mno-sse -mno-red-zone -nostdinc -maccumulate-outgoing-args -m32 14 | endif 15 | LDFLAGS = -nostdlib -znocombreloc 16 | 17 | TARGET = libcryptlib.a 18 | OBJS = Hash/CryptMd4.o \ 19 | Hash/CryptMd5.o \ 20 | Hash/CryptSha1.o \ 21 | Hash/CryptSha256.o \ 22 | Hash/CryptSha512.o \ 23 | Hmac/CryptHmacMd5.o \ 24 | Hmac/CryptHmacSha1.o \ 25 | Cipher/CryptAes.o \ 26 | Cipher/CryptTdes.o \ 27 | Cipher/CryptArc4.o \ 28 | Rand/CryptRand.o \ 29 | Pk/CryptRsaBasic.o \ 30 | Pk/CryptRsaExtNull.o \ 31 | Pk/CryptPkcs7SignNull.o \ 32 | Pk/CryptPkcs7Verify.o \ 33 | Pk/CryptDhNull.o \ 34 | Pk/CryptTs.o \ 35 | Pk/CryptX509.o \ 36 | Pk/CryptAuthenticode.o \ 37 | Pem/CryptPem.o \ 38 | SysCall/CrtWrapper.o \ 39 | SysCall/TimerWrapper.o \ 40 | SysCall/BaseMemAllocation.o \ 41 | SysCall/BaseStrings.o 42 | 43 | all: $(TARGET) 44 | 45 | libcryptlib.a: $(OBJS) 46 | ar rcs libcryptlib.a $(OBJS) 47 | clean: 48 | rm -f $(TARGET) $(OBJS) 49 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/buildinf.h: -------------------------------------------------------------------------------- 1 | #define PLATFORM "UEFI" 2 | #define DATE "Mon Mar 8 14:17:05 PDT 2010" 3 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/LPdir_nyi.c: -------------------------------------------------------------------------------- 1 | /* 2 | * $LP: LPlib/source/LPdir_win.c,v 1.1 2004/06/14 10:07:56 _cvs_levitte Exp $ 3 | */ 4 | /* 5 | * Copyright (c) 2004, Richard Levitte 6 | * All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef LPDIR_H 31 | # include "LPdir.h" 32 | #endif 33 | 34 | struct LP_dir_context_st { 35 | void *dummy; 36 | }; 37 | const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) 38 | { 39 | errno = EINVAL; 40 | return 0; 41 | } 42 | 43 | int LP_find_file_end(LP_DIR_CTX **ctx) 44 | { 45 | errno = EINVAL; 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/aes/aes_cbc.c: -------------------------------------------------------------------------------- 1 | /* crypto/aes/aes_cbc.c -*- mode:C; c-file-style: "eay" -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | */ 51 | 52 | #include 53 | #include 54 | 55 | void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, 56 | size_t len, const AES_KEY *key, 57 | unsigned char *ivec, const int enc) 58 | { 59 | 60 | if (enc) 61 | CRYPTO_cbc128_encrypt(in, out, len, key, ivec, 62 | (block128_f) AES_encrypt); 63 | else 64 | CRYPTO_cbc128_decrypt(in, out, len, key, ivec, 65 | (block128_f) AES_decrypt); 66 | } 67 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/aes/aes_ctr.c: -------------------------------------------------------------------------------- 1 | /* crypto/aes/aes_ctr.c -*- mode:C; c-file-style: "eay" -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | */ 51 | 52 | #include 53 | #include 54 | 55 | void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, 56 | size_t length, const AES_KEY *key, 57 | unsigned char ivec[AES_BLOCK_SIZE], 58 | unsigned char ecount_buf[AES_BLOCK_SIZE], 59 | unsigned int *num) 60 | { 61 | CRYPTO_ctr128_encrypt(in, out, length, key, ivec, ecount_buf, num, 62 | (block128_f) AES_encrypt); 63 | } 64 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/aes/aes_ecb.c: -------------------------------------------------------------------------------- 1 | /* crypto/aes/aes_ecb.c -*- mode:C; c-file-style: "eay" -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | */ 51 | 52 | #ifndef AES_DEBUG 53 | # ifndef NDEBUG 54 | # define NDEBUG 55 | # endif 56 | #endif 57 | #include 58 | 59 | #include 60 | #include "aes_locl.h" 61 | 62 | void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, 63 | const AES_KEY *key, const int enc) 64 | { 65 | 66 | assert(in && out && key); 67 | assert((AES_ENCRYPT == enc) || (AES_DECRYPT == enc)); 68 | 69 | if (AES_ENCRYPT == enc) 70 | AES_encrypt(in, out, key); 71 | else 72 | AES_decrypt(in, out, key); 73 | } 74 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/aes/aes_misc.c: -------------------------------------------------------------------------------- 1 | /* crypto/aes/aes_misc.c -*- mode:C; c-file-style: "eay" -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | */ 51 | 52 | #include 53 | #include 54 | #include 55 | #include "aes_locl.h" 56 | 57 | const char AES_version[] = "AES" OPENSSL_VERSION_PTEXT; 58 | 59 | const char *AES_options(void) 60 | { 61 | #ifdef FULL_UNROLL 62 | return "aes(full)"; 63 | #else 64 | return "aes(partial)"; 65 | #endif 66 | } 67 | 68 | /* FIPS wrapper functions to block low level AES calls in FIPS mode */ 69 | 70 | int AES_set_encrypt_key(const unsigned char *userKey, const int bits, 71 | AES_KEY *key) 72 | { 73 | #ifdef OPENSSL_FIPS 74 | fips_cipher_abort(AES); 75 | #endif 76 | return private_AES_set_encrypt_key(userKey, bits, key); 77 | } 78 | 79 | int AES_set_decrypt_key(const unsigned char *userKey, const int bits, 80 | AES_KEY *key) 81 | { 82 | #ifdef OPENSSL_FIPS 83 | fips_cipher_abort(AES); 84 | #endif 85 | return private_AES_set_decrypt_key(userKey, bits, key); 86 | } 87 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/aes/aes_ofb.c: -------------------------------------------------------------------------------- 1 | /* crypto/aes/aes_ofb.c -*- mode:C; c-file-style: "eay" -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | */ 51 | 52 | #include 53 | #include 54 | 55 | void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, 56 | size_t length, const AES_KEY *key, 57 | unsigned char *ivec, int *num) 58 | { 59 | CRYPTO_ofb128_encrypt(in, out, length, key, ivec, num, 60 | (block128_f) AES_encrypt); 61 | } 62 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/aes/aes_wrap.c: -------------------------------------------------------------------------------- 1 | /* crypto/aes/aes_wrap.c */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 4 | * project. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | */ 54 | 55 | #include "cryptlib.h" 56 | #include 57 | #include 58 | 59 | int AES_wrap_key(AES_KEY *key, const unsigned char *iv, 60 | unsigned char *out, 61 | const unsigned char *in, unsigned int inlen) 62 | { 63 | return CRYPTO_128_wrap(key, iv, out, in, inlen, (block128_f) AES_encrypt); 64 | } 65 | 66 | int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, 67 | unsigned char *out, 68 | const unsigned char *in, unsigned int inlen) 69 | { 70 | return CRYPTO_128_unwrap(key, iv, out, in, inlen, 71 | (block128_f) AES_decrypt); 72 | } 73 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/asn1/charmap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Auto generated with chartype.pl script. Mask of various character 3 | * properties 4 | */ 5 | 6 | static const unsigned char char_type[] = { 7 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 8 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 9 | 120, 0, 1, 40, 0, 0, 0, 16, 16, 16, 0, 25, 25, 16, 16, 16, 10 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 9, 9, 16, 9, 16, 11 | 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 12 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 1, 0, 0, 0, 13 | 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 14 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 2 15 | }; 16 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/asn1/x_exten.c: -------------------------------------------------------------------------------- 1 | /* x_exten.c */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 4 | * 2000. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #include 61 | #include 62 | #include 63 | #include 64 | 65 | ASN1_SEQUENCE(X509_EXTENSION) = { 66 | ASN1_SIMPLE(X509_EXTENSION, object, ASN1_OBJECT), 67 | ASN1_OPT(X509_EXTENSION, critical, ASN1_BOOLEAN), 68 | ASN1_SIMPLE(X509_EXTENSION, value, ASN1_OCTET_STRING) 69 | } ASN1_SEQUENCE_END(X509_EXTENSION) 70 | 71 | ASN1_ITEM_TEMPLATE(X509_EXTENSIONS) = 72 | ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, Extension, X509_EXTENSION) 73 | ASN1_ITEM_TEMPLATE_END(X509_EXTENSIONS) 74 | 75 | IMPLEMENT_ASN1_FUNCTIONS(X509_EXTENSION) 76 | IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(X509_EXTENSIONS, X509_EXTENSIONS, X509_EXTENSIONS) 77 | IMPLEMENT_ASN1_DUP_FUNCTION(X509_EXTENSION) 78 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/asn1/x_nx509.c: -------------------------------------------------------------------------------- 1 | /* x_nx509.c */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 4 | * 2005. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2005 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #include 61 | #include 62 | #include 63 | #include 64 | 65 | /* Old netscape certificate wrapper format */ 66 | 67 | ASN1_SEQUENCE(NETSCAPE_X509) = { 68 | ASN1_SIMPLE(NETSCAPE_X509, header, ASN1_OCTET_STRING), 69 | ASN1_OPT(NETSCAPE_X509, cert, X509) 70 | } ASN1_SEQUENCE_END(NETSCAPE_X509) 71 | 72 | IMPLEMENT_ASN1_FUNCTIONS(NETSCAPE_X509) 73 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/asn1/x_sig.c: -------------------------------------------------------------------------------- 1 | /* crypto/asn1/x_sig.c */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #include 60 | #include "cryptlib.h" 61 | #include 62 | #include 63 | 64 | ASN1_SEQUENCE(X509_SIG) = { 65 | ASN1_SIMPLE(X509_SIG, algor, X509_ALGOR), 66 | ASN1_SIMPLE(X509_SIG, digest, ASN1_OCTET_STRING) 67 | } ASN1_SEQUENCE_END(X509_SIG) 68 | 69 | IMPLEMENT_ASN1_FUNCTIONS(X509_SIG) 70 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/asn1/x_val.c: -------------------------------------------------------------------------------- 1 | /* crypto/asn1/x_val.c */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #include 60 | #include "cryptlib.h" 61 | #include 62 | #include 63 | 64 | ASN1_SEQUENCE(X509_VAL) = { 65 | ASN1_SIMPLE(X509_VAL, notBefore, ASN1_TIME), 66 | ASN1_SIMPLE(X509_VAL, notAfter, ASN1_TIME) 67 | } ASN1_SEQUENCE_END(X509_VAL) 68 | 69 | IMPLEMENT_ASN1_FUNCTIONS(X509_VAL) 70 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/bio/bio_lcl.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #if BIO_FLAGS_UPLINK==0 4 | /* Shortcut UPLINK calls on most platforms... */ 5 | # define UP_stdin stdin 6 | # define UP_stdout stdout 7 | # define UP_stderr stderr 8 | # define UP_fprintf fprintf 9 | # define UP_fgets fgets 10 | # define UP_fread fread 11 | # define UP_fwrite fwrite 12 | # undef UP_fsetmod 13 | # define UP_feof feof 14 | # define UP_fclose fclose 15 | 16 | # define UP_fopen fopen 17 | # define UP_fseek fseek 18 | # define UP_ftell ftell 19 | # define UP_fflush fflush 20 | # define UP_ferror ferror 21 | # ifdef _WIN32 22 | # define UP_fileno _fileno 23 | # define UP_open _open 24 | # define UP_read _read 25 | # define UP_write _write 26 | # define UP_lseek _lseek 27 | # define UP_close _close 28 | # else 29 | # define UP_fileno fileno 30 | # define UP_open open 31 | # define UP_read read 32 | # define UP_write write 33 | # define UP_lseek lseek 34 | # define UP_close close 35 | # endif 36 | #endif 37 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/bn/rsaz_exp.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright(c) 2012, Intel Corp. 3 | * Developers and authors: 4 | * Shay Gueron (1, 2), and Vlad Krasnov (1) 5 | * (1) Intel Corporation, Israel Development Center, Haifa, Israel 6 | * (2) University of Haifa, Israel 7 | ****************************************************************************** 8 | * LICENSE: 9 | * This submission to OpenSSL is to be made available under the OpenSSL 10 | * license, and only to the OpenSSL project, in order to allow integration 11 | * into the publicly distributed code. 12 | * The use of this code, or portions of this code, or concepts embedded in 13 | * this code, or modification of this code and/or algorithm(s) in it, or the 14 | * use of this code for any other purpose than stated above, requires special 15 | * licensing. 16 | ****************************************************************************** 17 | * DISCLAIMER: 18 | * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS AND THE COPYRIGHT OWNERS 19 | * ``AS IS''. ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS OR THE COPYRIGHT 22 | * OWNERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 23 | * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | * POSSIBILITY OF SUCH DAMAGE. 29 | ******************************************************************************/ 30 | 31 | #ifndef RSAZ_EXP_H 32 | # define RSAZ_EXP_H 33 | 34 | # undef RSAZ_ENABLED 35 | # if defined(OPENSSL_BN_ASM_MONT) && \ 36 | (defined(__x86_64) || defined(__x86_64__) || \ 37 | defined(_M_AMD64) || defined(_M_X64)) 38 | # define RSAZ_ENABLED 39 | 40 | # include 41 | 42 | void RSAZ_1024_mod_exp_avx2(BN_ULONG result[16], 43 | const BN_ULONG base_norm[16], 44 | const BN_ULONG exponent[16], 45 | const BN_ULONG m_norm[16], const BN_ULONG RR[16], 46 | BN_ULONG k0); 47 | int rsaz_avx2_eligible(); 48 | 49 | void RSAZ_512_mod_exp(BN_ULONG result[8], 50 | const BN_ULONG base_norm[8], const BN_ULONG exponent[8], 51 | const BN_ULONG m_norm[8], BN_ULONG k0, 52 | const BN_ULONG RR[8]); 53 | 54 | # endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/cmac/cm_ameth.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 3 | * 2010. 4 | */ 5 | /* ==================================================================== 6 | * Copyright (c) 2010 The OpenSSL Project. All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in 17 | * the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * 3. All advertising materials mentioning features or use of this 21 | * software must display the following acknowledgment: 22 | * "This product includes software developed by the OpenSSL Project 23 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 24 | * 25 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 26 | * endorse or promote products derived from this software without 27 | * prior written permission. For written permission, please contact 28 | * licensing@OpenSSL.org. 29 | * 30 | * 5. Products derived from this software may not be called "OpenSSL" 31 | * nor may "OpenSSL" appear in their names without prior written 32 | * permission of the OpenSSL Project. 33 | * 34 | * 6. Redistributions of any form whatsoever must retain the following 35 | * acknowledgment: 36 | * "This product includes software developed by the OpenSSL Project 37 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 38 | * 39 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 40 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 42 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 43 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 45 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 46 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 48 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 49 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50 | * OF THE POSSIBILITY OF SUCH DAMAGE. 51 | * ==================================================================== 52 | */ 53 | 54 | #include 55 | #include "cryptlib.h" 56 | #include 57 | #include 58 | #include "asn1_locl.h" 59 | 60 | /* 61 | * CMAC "ASN1" method. This is just here to indicate the maximum CMAC output 62 | * length and to free up a CMAC key. 63 | */ 64 | 65 | static int cmac_size(const EVP_PKEY *pkey) 66 | { 67 | return EVP_MAX_BLOCK_LENGTH; 68 | } 69 | 70 | static void cmac_key_free(EVP_PKEY *pkey) 71 | { 72 | CMAC_CTX *cmctx = (CMAC_CTX *)pkey->pkey.ptr; 73 | if (cmctx) 74 | CMAC_CTX_free(cmctx); 75 | } 76 | 77 | const EVP_PKEY_ASN1_METHOD cmac_asn1_meth = { 78 | EVP_PKEY_CMAC, 79 | EVP_PKEY_CMAC, 80 | 0, 81 | 82 | "CMAC", 83 | "OpenSSL CMAC method", 84 | 85 | 0, 0, 0, 0, 86 | 87 | 0, 0, 0, 88 | 89 | cmac_size, 90 | 0, 91 | 0, 0, 0, 0, 0, 0, 0, 92 | 93 | cmac_key_free, 94 | 0, 95 | 0, 0 96 | }; 97 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/comp/c_rle.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, 8 | unsigned int olen, unsigned char *in, 9 | unsigned int ilen); 10 | static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, 11 | unsigned int olen, unsigned char *in, 12 | unsigned int ilen); 13 | 14 | static COMP_METHOD rle_method = { 15 | NID_rle_compression, 16 | LN_rle_compression, 17 | NULL, 18 | NULL, 19 | rle_compress_block, 20 | rle_expand_block, 21 | NULL, 22 | NULL, 23 | }; 24 | 25 | COMP_METHOD *COMP_rle(void) 26 | { 27 | return (&rle_method); 28 | } 29 | 30 | static int rle_compress_block(COMP_CTX *ctx, unsigned char *out, 31 | unsigned int olen, unsigned char *in, 32 | unsigned int ilen) 33 | { 34 | /* int i; */ 35 | 36 | if (ilen == 0 || olen < (ilen - 1)) { 37 | /* ZZZZZZZZZZZZZZZZZZZZZZ */ 38 | return (-1); 39 | } 40 | 41 | *(out++) = 0; 42 | memcpy(out, in, ilen); 43 | return (ilen + 1); 44 | } 45 | 46 | static int rle_expand_block(COMP_CTX *ctx, unsigned char *out, 47 | unsigned int olen, unsigned char *in, 48 | unsigned int ilen) 49 | { 50 | int i; 51 | 52 | if (olen < (ilen - 1)) { 53 | /* ZZZZZZZZZZZZZZZZZZZZZZ */ 54 | return (-1); 55 | } 56 | 57 | i = *(in++); 58 | if (i == 0) { 59 | memcpy(out, in, ilen - 1); 60 | } 61 | return (ilen - 1); 62 | } 63 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/comp/comp_lib.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth) 8 | { 9 | COMP_CTX *ret; 10 | 11 | if ((ret = (COMP_CTX *)OPENSSL_malloc(sizeof(COMP_CTX))) == NULL) { 12 | /* ZZZZZZZZZZZZZZZZ */ 13 | return (NULL); 14 | } 15 | memset(ret, 0, sizeof(COMP_CTX)); 16 | ret->meth = meth; 17 | if ((ret->meth->init != NULL) && !ret->meth->init(ret)) { 18 | OPENSSL_free(ret); 19 | ret = NULL; 20 | } 21 | return (ret); 22 | } 23 | 24 | void COMP_CTX_free(COMP_CTX *ctx) 25 | { 26 | if (ctx == NULL) 27 | return; 28 | 29 | if (ctx->meth->finish != NULL) 30 | ctx->meth->finish(ctx); 31 | 32 | OPENSSL_free(ctx); 33 | } 34 | 35 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, 36 | unsigned char *in, int ilen) 37 | { 38 | int ret; 39 | if (ctx->meth->compress == NULL) { 40 | /* ZZZZZZZZZZZZZZZZZ */ 41 | return (-1); 42 | } 43 | ret = ctx->meth->compress(ctx, out, olen, in, ilen); 44 | if (ret > 0) { 45 | ctx->compress_in += ilen; 46 | ctx->compress_out += ret; 47 | } 48 | return (ret); 49 | } 50 | 51 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, 52 | unsigned char *in, int ilen) 53 | { 54 | int ret; 55 | 56 | if (ctx->meth->expand == NULL) { 57 | /* ZZZZZZZZZZZZZZZZZ */ 58 | return (-1); 59 | } 60 | ret = ctx->meth->expand(ctx, out, olen, in, ilen); 61 | if (ret > 0) { 62 | ctx->expand_in += ilen; 63 | ctx->expand_out += ret; 64 | } 65 | return (ret); 66 | } 67 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/conf/conf_mall.c: -------------------------------------------------------------------------------- 1 | /* conf_mall.c */ 2 | /* 3 | * Written by Stephen Henson (steve@openssl.org) for the OpenSSL project 4 | * 2001. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #include 61 | #include 62 | #include "cryptlib.h" 63 | #include 64 | #include 65 | #include 66 | #include 67 | #ifndef OPENSSL_NO_ENGINE 68 | # include 69 | #endif 70 | 71 | /* Load all OpenSSL builtin modules */ 72 | 73 | void OPENSSL_load_builtin_modules(void) 74 | { 75 | /* Add builtin modules here */ 76 | ASN1_add_oid_module(); 77 | #ifndef OPENSSL_NO_ENGINE 78 | ENGINE_add_conf_module(); 79 | #endif 80 | EVP_add_alg_module(); 81 | } 82 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/des/cbc_enc.c: -------------------------------------------------------------------------------- 1 | /* crypto/des/cbc_enc.c */ 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 | * All rights reserved. 4 | * 5 | * This package is an SSL implementation written 6 | * by Eric Young (eay@cryptsoft.com). 7 | * The implementation was written so as to conform with Netscapes SSL. 8 | * 9 | * This library is free for commercial and non-commercial use as long as 10 | * the following conditions are aheared to. The following conditions 11 | * apply to all code found in this distribution, be it the RC4, RSA, 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 | * included with this distribution is covered by the same copyright terms 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 | * 16 | * Copyright remains Eric Young's, and as such any Copyright notices in 17 | * the code are not to be removed. 18 | * If this package is used in a product, Eric Young should be given attribution 19 | * as the author of the parts of the library used. 20 | * This can be in the form of a textual message at program startup or 21 | * in documentation (online or textual) provided with the package. 22 | * 23 | * Redistribution and use in source and binary forms, with or without 24 | * modification, are permitted provided that the following conditions 25 | * are met: 26 | * 1. Redistributions of source code must retain the copyright 27 | * notice, this list of conditions and the following disclaimer. 28 | * 2. Redistributions in binary form must reproduce the above copyright 29 | * notice, this list of conditions and the following disclaimer in the 30 | * documentation and/or other materials provided with the distribution. 31 | * 3. All advertising materials mentioning features or use of this software 32 | * must display the following acknowledgement: 33 | * "This product includes cryptographic software written by 34 | * Eric Young (eay@cryptsoft.com)" 35 | * The word 'cryptographic' can be left out if the rouines from the library 36 | * being used are not cryptographic related :-). 37 | * 4. If you include any Windows specific code (or a derivative thereof) from 38 | * the apps directory (application code) you must include an acknowledgement: 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 | * SUCH DAMAGE. 52 | * 53 | * The licence and distribution terms for any publically available version or 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be 55 | * copied and put under another distribution licence 56 | * [including the GNU Public Licence.] 57 | */ 58 | 59 | #define CBC_ENC_C__DONT_UPDATE_IV 60 | 61 | #include "ncbc_enc.c" /* des_cbc_encrypt */ 62 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/des/rand_key.c: -------------------------------------------------------------------------------- 1 | /* crypto/des/rand_key.c */ 2 | /* ==================================================================== 3 | * Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | * This product includes cryptographic software written by Eric Young 51 | * (eay@cryptsoft.com). This product includes software written by Tim 52 | * Hudson (tjh@cryptsoft.com). 53 | * 54 | */ 55 | 56 | #include 57 | #include 58 | 59 | int DES_random_key(DES_cblock *ret) 60 | { 61 | do { 62 | if (RAND_bytes((unsigned char *)ret, sizeof(DES_cblock)) != 1) 63 | return (0); 64 | } while (DES_is_weak_key(ret)); 65 | DES_set_odd_parity(ret); 66 | return (1); 67 | } 68 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/dh/dh_depr.c: -------------------------------------------------------------------------------- 1 | /* crypto/dh/dh_depr.c */ 2 | /* ==================================================================== 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | * This product includes cryptographic software written by Eric Young 51 | * (eay@cryptsoft.com). This product includes software written by Tim 52 | * Hudson (tjh@cryptsoft.com). 53 | * 54 | */ 55 | 56 | /* This file contains deprecated functions as wrappers to the new ones */ 57 | 58 | #include 59 | #include "cryptlib.h" 60 | #include 61 | #include 62 | 63 | static void *dummy = &dummy; 64 | 65 | #ifndef OPENSSL_NO_DEPRECATED 66 | DH *DH_generate_parameters(int prime_len, int generator, 67 | void (*callback) (int, int, void *), void *cb_arg) 68 | { 69 | BN_GENCB cb; 70 | DH *ret = NULL; 71 | 72 | if ((ret = DH_new()) == NULL) 73 | return NULL; 74 | 75 | BN_GENCB_set_old(&cb, callback, cb_arg); 76 | 77 | if (DH_generate_parameters_ex(ret, prime_len, generator, &cb)) 78 | return ret; 79 | DH_free(ret); 80 | return NULL; 81 | } 82 | #endif 83 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/dso/dso_openssl.c: -------------------------------------------------------------------------------- 1 | /* dso_openssl.c */ 2 | /* 3 | * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project 4 | * 2000. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #include 61 | #include "cryptlib.h" 62 | #include 63 | 64 | /* We just pinch the method from an appropriate "default" method. */ 65 | 66 | DSO_METHOD *DSO_METHOD_openssl(void) 67 | { 68 | #ifdef DEF_DSO_METHOD 69 | return (DEF_DSO_METHOD()); 70 | #elif defined(DSO_DLFCN) 71 | return (DSO_METHOD_dlfcn()); 72 | #elif defined(DSO_DL) 73 | return (DSO_METHOD_dl()); 74 | #elif defined(DSO_WIN32) 75 | return (DSO_METHOD_win32()); 76 | #elif defined(DSO_VMS) 77 | return (DSO_METHOD_vms()); 78 | #elif defined(DSO_BEOS) 79 | return (DSO_METHOD_beos()); 80 | #else 81 | return (DSO_METHOD_null()); 82 | #endif 83 | } 84 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/evp/e_seed.c: -------------------------------------------------------------------------------- 1 | /* crypto/evp/e_seed.c -*- mode:C; c-file-style: "eay" -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2007 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | * This product includes cryptographic software written by Eric Young 51 | * (eay@cryptsoft.com). This product includes software written by Tim 52 | * Hudson (tjh@cryptsoft.com). 53 | * 54 | */ 55 | 56 | #include 57 | #ifndef OPENSSL_NO_SEED 58 | # include 59 | # include 60 | # include 61 | # include 62 | # include 63 | # include "evp_locl.h" 64 | 65 | static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 66 | const unsigned char *iv, int enc); 67 | 68 | typedef struct { 69 | SEED_KEY_SCHEDULE ks; 70 | } EVP_SEED_KEY; 71 | 72 | IMPLEMENT_BLOCK_CIPHER(seed, ks, SEED, EVP_SEED_KEY, NID_seed, 73 | 16, 16, 16, 128, 0, seed_init_key, 0, 0, 0, 0) 74 | 75 | static int seed_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 76 | const unsigned char *iv, int enc) 77 | { 78 | SEED_set_key(key, ctx->cipher_data); 79 | return 1; 80 | } 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/evp/evp_acnf.c: -------------------------------------------------------------------------------- 1 | /* evp_acnf.c */ 2 | /* 3 | * Written by Stephen Henson (steve@openssl.org) for the OpenSSL project 4 | * 2001. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #include "cryptlib.h" 61 | #include 62 | #include 63 | 64 | /* 65 | * Load all algorithms and configure OpenSSL. This function is called 66 | * automatically when OPENSSL_LOAD_CONF is set. 67 | */ 68 | 69 | void OPENSSL_add_all_algorithms_conf(void) 70 | { 71 | OPENSSL_add_all_algorithms_noconf(); 72 | OPENSSL_config(NULL); 73 | } 74 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/evp/m_wp.c: -------------------------------------------------------------------------------- 1 | /* crypto/evp/m_wp.c */ 2 | 3 | #include 4 | #include "cryptlib.h" 5 | 6 | #ifndef OPENSSL_NO_WHIRLPOOL 7 | 8 | # include 9 | # include 10 | # include 11 | # include 12 | # include "evp_locl.h" 13 | 14 | static int init(EVP_MD_CTX *ctx) 15 | { 16 | return WHIRLPOOL_Init(ctx->md_data); 17 | } 18 | 19 | static int update(EVP_MD_CTX *ctx, const void *data, size_t count) 20 | { 21 | return WHIRLPOOL_Update(ctx->md_data, data, count); 22 | } 23 | 24 | static int final(EVP_MD_CTX *ctx, unsigned char *md) 25 | { 26 | return WHIRLPOOL_Final(md, ctx->md_data); 27 | } 28 | 29 | static const EVP_MD whirlpool_md = { 30 | NID_whirlpool, 31 | 0, 32 | WHIRLPOOL_DIGEST_LENGTH, 33 | 0, 34 | init, 35 | update, 36 | final, 37 | NULL, 38 | NULL, 39 | EVP_PKEY_NULL_method, 40 | WHIRLPOOL_BBLOCK / 8, 41 | sizeof(EVP_MD *) + sizeof(WHIRLPOOL_CTX), 42 | }; 43 | 44 | const EVP_MD *EVP_whirlpool(void) 45 | { 46 | return (&whirlpool_md); 47 | } 48 | #endif 49 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/fips_ers.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifdef OPENSSL_FIPS 4 | # include "fips_err.h" 5 | #else 6 | static void *dummy = &dummy; 7 | #endif 8 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/mem_clr.c: -------------------------------------------------------------------------------- 1 | /* crypto/mem_clr.c -*- mode:C; c-file-style: "eay" -*- */ 2 | /* 3 | * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project 4 | * 2002. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@openssl.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #include 61 | #include 62 | 63 | unsigned char cleanse_ctr = 0; 64 | 65 | void OPENSSL_cleanse(void *ptr, size_t len) 66 | { 67 | unsigned char *p = ptr; 68 | size_t loop = len, ctr = cleanse_ctr; 69 | while (loop--) { 70 | *(p++) = (unsigned char)ctr; 71 | ctr += (17 + ((size_t)p & 0xF)); 72 | } 73 | p = memchr(ptr, (unsigned char)ctr, len); 74 | if (p) 75 | ctr += (63 + (size_t)p); 76 | cleanse_ctr = (unsigned char)ctr; 77 | } 78 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/o_dir.c: -------------------------------------------------------------------------------- 1 | /* crypto/o_dir.c -*- mode:C; c-file-style: "eay" -*- */ 2 | /* 3 | * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project 4 | * 2004. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2004 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@openssl.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #include 61 | #include 62 | 63 | /* 64 | * The routines really come from the Levitte Programming, so to make life 65 | * simple, let's just use the raw files and hack the symbols to fit our 66 | * namespace. 67 | */ 68 | #define LP_DIR_CTX OPENSSL_DIR_CTX 69 | #define LP_dir_context_st OPENSSL_dir_context_st 70 | #define LP_find_file OPENSSL_DIR_read 71 | #define LP_find_file_end OPENSSL_DIR_end 72 | 73 | #include "o_dir.h" 74 | 75 | #define LPDIR_H 76 | #if defined OPENSSL_SYS_UNIX || defined DJGPP 77 | # include "LPdir_unix.c" 78 | #elif defined OPENSSL_SYS_VMS 79 | # include "LPdir_vms.c" 80 | #elif defined OPENSSL_SYS_WIN32 81 | # include "LPdir_win32.c" 82 | #elif defined OPENSSL_SYS_WINCE 83 | # include "LPdir_wince.c" 84 | #else 85 | # include "LPdir_nyi.c" 86 | #endif 87 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/o_dir.h: -------------------------------------------------------------------------------- 1 | /* crypto/o_dir.h -*- mode:C; c-file-style: "eay" -*- */ 2 | /* 3 | * Copied from Richard Levitte's (richard@levitte.org) LP library. All 4 | * symbol names have been changed, with permission from the author. 5 | */ 6 | 7 | /* $LP: LPlib/source/LPdir.h,v 1.1 2004/06/14 08:56:04 _cvs_levitte Exp $ */ 8 | /* 9 | * Copyright (c) 2004, Richard Levitte 10 | * All rights reserved. 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 1. Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef O_DIR_H 35 | # define O_DIR_H 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | typedef struct OPENSSL_dir_context_st OPENSSL_DIR_CTX; 42 | 43 | /* 44 | * returns NULL on error or end-of-directory. If it is end-of-directory, 45 | * errno will be zero 46 | */ 47 | const char *OPENSSL_DIR_read(OPENSSL_DIR_CTX **ctx, const char *directory); 48 | /* returns 1 on success, 0 on error */ 49 | int OPENSSL_DIR_end(OPENSSL_DIR_CTX **ctx); 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif /* LPDIR_H */ 56 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/o_init.c: -------------------------------------------------------------------------------- 1 | /* o_init.c */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 4 | * project. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2011 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * openssl-core@openssl.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | */ 55 | 56 | #include 57 | #include 58 | #ifdef OPENSSL_FIPS 59 | # include 60 | # include 61 | #endif 62 | 63 | /* 64 | * Perform any essential OpenSSL initialization operations. Currently only 65 | * sets FIPS callbacks 66 | */ 67 | 68 | void OPENSSL_init(void) 69 | { 70 | static int done = 0; 71 | if (done) 72 | return; 73 | done = 1; 74 | #ifdef OPENSSL_FIPS 75 | FIPS_set_locking_callbacks(CRYPTO_lock, CRYPTO_add_lock); 76 | FIPS_set_error_callbacks(ERR_put_error, ERR_add_error_vdata); 77 | FIPS_set_malloc_callbacks(CRYPTO_malloc, CRYPTO_free); 78 | RAND_init_fips(); 79 | #endif 80 | #if 0 81 | fprintf(stderr, "Called OPENSSL_init\n"); 82 | #endif 83 | } 84 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/o_str.h: -------------------------------------------------------------------------------- 1 | /* crypto/o_str.h -*- mode:C; c-file-style: "eay" -*- */ 2 | /* 3 | * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project 4 | * 2003. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2003 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #ifndef HEADER_O_STR_H 61 | # define HEADER_O_STR_H 62 | 63 | # include /* to get size_t */ 64 | 65 | int OPENSSL_strcasecmp(const char *str1, const char *str2); 66 | int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n); 67 | int OPENSSL_memcmp(const void *p1, const void *p2, size_t n); 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/o_time.h: -------------------------------------------------------------------------------- 1 | /* crypto/o_time.h -*- mode:C; c-file-style: "eay" -*- */ 2 | /* 3 | * Written by Richard Levitte (richard@levitte.org) for the OpenSSL project 4 | * 2001. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #ifndef HEADER_O_TIME_H 61 | # define HEADER_O_TIME_H 62 | 63 | # include 64 | 65 | struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result); 66 | int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec); 67 | int OPENSSL_gmtime_diff(int *pday, int *psec, 68 | const struct tm *from, const struct tm *to); 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/pem/pem_x509.c: -------------------------------------------------------------------------------- 1 | /* pem_x509.c */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 4 | * 2001. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #include 61 | #include "cryptlib.h" 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | 68 | IMPLEMENT_PEM_rw(X509, X509, PEM_STRING_X509, X509) 69 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/pem/pem_xaux.c: -------------------------------------------------------------------------------- 1 | /* pem_xaux.c */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 4 | * 2001. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #include 61 | #include "cryptlib.h" 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | 68 | IMPLEMENT_PEM_rw(X509_AUX, X509, PEM_STRING_X509_TRUSTED, X509_AUX) 69 | IMPLEMENT_PEM_rw(X509_CERT_PAIR, X509_CERT_PAIR, PEM_STRING_X509_PAIR, 70 | X509_CERT_PAIR) 71 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/pkcs12/p12_p8d.c: -------------------------------------------------------------------------------- 1 | /* p12_p8d.c */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 4 | * 2001. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #include 61 | #include "cryptlib.h" 62 | #include 63 | 64 | PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *p8, const char *pass, 65 | int passlen) 66 | { 67 | return PKCS12_item_decrypt_d2i(p8->algor, 68 | ASN1_ITEM_rptr(PKCS8_PRIV_KEY_INFO), pass, 69 | passlen, p8->digest, 1); 70 | } 71 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/pkcs7/bio_pk7.c: -------------------------------------------------------------------------------- 1 | /* bio_pk7.c */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 4 | * project. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | */ 55 | 56 | #include 57 | #include 58 | #include 59 | 60 | #if !defined(OPENSSL_SYSNAME_NETWARE) && !defined(OPENSSL_SYSNAME_VXWORKS) 61 | # include 62 | #endif 63 | #include 64 | 65 | /* Streaming encode support for PKCS#7 */ 66 | 67 | BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7) 68 | { 69 | return BIO_new_NDEF(out, (ASN1_VALUE *)p7, ASN1_ITEM_rptr(PKCS7)); 70 | } 71 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/rc4/rc4_locl.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_RC4_LOCL_H 2 | # define HEADER_RC4_LOCL_H 3 | # include 4 | # include 5 | #endif 6 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/rc4/rc4_utl.c: -------------------------------------------------------------------------------- 1 | /* crypto/rc4/rc4_utl.c -*- mode:C; c-file-style: "eay" -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2011 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | */ 51 | 52 | #include 53 | #include 54 | #include 55 | 56 | void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data) 57 | { 58 | #ifdef OPENSSL_FIPS 59 | fips_cipher_abort(RC4); 60 | #endif 61 | private_RC4_set_key(key, len, data); 62 | } 63 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/rsa/rsa_locl.h: -------------------------------------------------------------------------------- 1 | extern int int_rsa_verify(int dtype, const unsigned char *m, 2 | unsigned int m_len, unsigned char *rm, 3 | size_t *prm_len, const unsigned char *sigbuf, 4 | size_t siglen, RSA *rsa); 5 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/ui/ui_compat.c: -------------------------------------------------------------------------------- 1 | /* crypto/ui/ui_compat.c -*- mode:C; c-file-style: "eay" -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2001-2002 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * openssl-core@openssl.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | * This product includes cryptographic software written by Eric Young 51 | * (eay@cryptsoft.com). This product includes software written by Tim 52 | * Hudson (tjh@cryptsoft.com). 53 | * 54 | */ 55 | 56 | #include 57 | #include 58 | 59 | int _ossl_old_des_read_pw_string(char *buf, int length, const char *prompt, 60 | int verify) 61 | { 62 | return UI_UTIL_read_pw_string(buf, length, prompt, verify); 63 | } 64 | 65 | int _ossl_old_des_read_pw(char *buf, char *buff, int size, const char *prompt, 66 | int verify) 67 | { 68 | return UI_UTIL_read_pw(buf, buff, size, prompt, verify); 69 | } 70 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/uid.c: -------------------------------------------------------------------------------- 1 | /* crypto/uid.c */ 2 | /* ==================================================================== 3 | * Copyright (c) 2001 The OpenSSL Project. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * 3. All advertising materials mentioning features or use of this 18 | * software must display the following acknowledgment: 19 | * "This product includes software developed by the OpenSSL Project 20 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 21 | * 22 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23 | * endorse or promote products derived from this software without 24 | * prior written permission. For written permission, please contact 25 | * licensing@OpenSSL.org. 26 | * 27 | * 5. Products derived from this software may not be called "OpenSSL" 28 | * nor may "OpenSSL" appear in their names without prior written 29 | * permission of the OpenSSL Project. 30 | * 31 | * 6. Redistributions of any form whatsoever must retain the following 32 | * acknowledgment: 33 | * "This product includes software developed by the OpenSSL Project 34 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 | * OF THE POSSIBILITY OF SUCH DAMAGE. 48 | * ==================================================================== 49 | * 50 | * This product includes cryptographic software written by Eric Young 51 | * (eay@cryptsoft.com). This product includes software written by Tim 52 | * Hudson (tjh@cryptsoft.com). 53 | * 54 | */ 55 | 56 | #include 57 | #include 58 | 59 | #if defined(__OpenBSD__) || (defined(__FreeBSD__) && __FreeBSD__ > 2) 60 | 61 | # include OPENSSL_UNISTD 62 | 63 | int OPENSSL_issetugid(void) 64 | { 65 | return issetugid(); 66 | } 67 | 68 | #elif defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) 69 | 70 | int OPENSSL_issetugid(void) 71 | { 72 | return 0; 73 | } 74 | 75 | #else 76 | 77 | # include OPENSSL_UNISTD 78 | # include 79 | 80 | int OPENSSL_issetugid(void) 81 | { 82 | if (getuid() != geteuid()) 83 | return 1; 84 | if (getgid() != getegid()) 85 | return 1; 86 | return 0; 87 | } 88 | #endif 89 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/x509/vpm_int.h: -------------------------------------------------------------------------------- 1 | /* vpm_int.h */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 4 | * 2013. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 2013 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | /* internal only structure to hold additional X509_VERIFY_PARAM data */ 61 | 62 | struct X509_VERIFY_PARAM_ID_st { 63 | STACK_OF(OPENSSL_STRING) *hosts; /* Set of acceptable names */ 64 | unsigned int hostflags; /* Flags to control matching features */ 65 | char *peername; /* Matching hostname in peer certificate */ 66 | char *email; /* If not NULL email address to match */ 67 | size_t emaillen; 68 | unsigned char *ip; /* If not NULL IP address to match */ 69 | size_t iplen; /* Length of IP address */ 70 | }; 71 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/x509v3/v3_akeya.c: -------------------------------------------------------------------------------- 1 | /* v3_akey_asn1.c */ 2 | /* 3 | * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project 4 | * 1999. 5 | */ 6 | /* ==================================================================== 7 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in 18 | * the documentation and/or other materials provided with the 19 | * distribution. 20 | * 21 | * 3. All advertising materials mentioning features or use of this 22 | * software must display the following acknowledgment: 23 | * "This product includes software developed by the OpenSSL Project 24 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 25 | * 26 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 27 | * endorse or promote products derived from this software without 28 | * prior written permission. For written permission, please contact 29 | * licensing@OpenSSL.org. 30 | * 31 | * 5. Products derived from this software may not be called "OpenSSL" 32 | * nor may "OpenSSL" appear in their names without prior written 33 | * permission of the OpenSSL Project. 34 | * 35 | * 6. Redistributions of any form whatsoever must retain the following 36 | * acknowledgment: 37 | * "This product includes software developed by the OpenSSL Project 38 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 39 | * 40 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 41 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 44 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 46 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 47 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 49 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 50 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51 | * OF THE POSSIBILITY OF SUCH DAMAGE. 52 | * ==================================================================== 53 | * 54 | * This product includes cryptographic software written by Eric Young 55 | * (eay@cryptsoft.com). This product includes software written by Tim 56 | * Hudson (tjh@cryptsoft.com). 57 | * 58 | */ 59 | 60 | #include 61 | #include "cryptlib.h" 62 | #include 63 | #include 64 | #include 65 | #include 66 | 67 | ASN1_SEQUENCE(AUTHORITY_KEYID) = { 68 | ASN1_IMP_OPT(AUTHORITY_KEYID, keyid, ASN1_OCTET_STRING, 0), 69 | ASN1_IMP_SEQUENCE_OF_OPT(AUTHORITY_KEYID, issuer, GENERAL_NAME, 1), 70 | ASN1_IMP_OPT(AUTHORITY_KEYID, serial, ASN1_INTEGER, 2) 71 | } ASN1_SEQUENCE_END(AUTHORITY_KEYID) 72 | 73 | IMPLEMENT_ASN1_FUNCTIONS(AUTHORITY_KEYID) 74 | -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/x509v3/v3_pci.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjg59/shim/e22a7b5b772dba6588dd955dc017e572f7e29784/Cryptlib/OpenSSL/crypto/x509v3/v3_pci.c -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/crypto/x509v3/v3_pcia.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mjg59/shim/e22a7b5b772dba6588dd955dc017e572f7e29784/Cryptlib/OpenSSL/crypto/x509v3/v3_pcia.c -------------------------------------------------------------------------------- /Cryptlib/OpenSSL/openssl-bio-b_print-disable-sse.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Cryptlib/OpenSSL/crypto/bio/b_print.c b/Cryptlib/OpenSSL/crypto/bio/b_print.c 2 | index 7c81e25..9091d56 100644 3 | --- a/Cryptlib/OpenSSL/crypto/bio/b_print.c 4 | +++ b/Cryptlib/OpenSSL/crypto/bio/b_print.c 5 | @@ -129,8 +129,10 @@ static void fmtstr(char **, char **, size_t *, size_t *, 6 | const char *, int, int, int); 7 | static void fmtint(char **, char **, size_t *, size_t *, 8 | LLONG, int, int, int, int); 9 | +#ifndef OPENSSL_SYS_UEFI 10 | static void fmtfp(char **, char **, size_t *, size_t *, 11 | LDOUBLE, int, int, int); 12 | +#endif 13 | static void doapr_outch(char **, char **, size_t *, size_t *, int); 14 | static void _dopr(char **sbuffer, char **buffer, 15 | size_t *maxlen, size_t *retlen, int *truncated, 16 | @@ -173,7 +175,9 @@ _dopr(char **sbuffer, 17 | { 18 | char ch; 19 | LLONG value; 20 | +#ifndef OPENSSL_SYS_UEFI 21 | LDOUBLE fvalue; 22 | +#endif 23 | char *strvalue; 24 | int min; 25 | int max; 26 | @@ -275,10 +279,12 @@ _dopr(char **sbuffer, 27 | cflags = DP_C_LLONG; 28 | ch = *format++; 29 | break; 30 | +#ifndef OPENSSL_SYS_UEFI 31 | case 'L': 32 | cflags = DP_C_LDOUBLE; 33 | ch = *format++; 34 | break; 35 | +#endif 36 | default: 37 | break; 38 | } 39 | @@ -330,6 +336,7 @@ _dopr(char **sbuffer, 40 | ch == 'o' ? 8 : (ch == 'u' ? 10 : 16), 41 | min, max, flags); 42 | break; 43 | +#ifndef OPENSSL_SYS_UEFI 44 | case 'f': 45 | if (cflags == DP_C_LDOUBLE) 46 | fvalue = va_arg(args, LDOUBLE); 47 | @@ -354,6 +361,7 @@ _dopr(char **sbuffer, 48 | else 49 | fvalue = va_arg(args, double); 50 | break; 51 | +#endif 52 | case 'c': 53 | doapr_outch(sbuffer, buffer, &currlen, maxlen, 54 | va_arg(args, int)); 55 | @@ -550,6 +558,7 @@ fmtint(char **sbuffer, 56 | return; 57 | } 58 | 59 | +#ifndef OPENSSL_SYS_UEFI 60 | static LDOUBLE abs_val(LDOUBLE value) 61 | { 62 | LDOUBLE result = value; 63 | @@ -696,6 +705,7 @@ fmtfp(char **sbuffer, 64 | ++padlen; 65 | } 66 | } 67 | +#endif 68 | 69 | static void 70 | doapr_outch(char **sbuffer, 71 | -------------------------------------------------------------------------------- /Cryptlib/Pk/CryptPkcs7SignNull.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | PKCS#7 SignedData Sign Wrapper Implementation which does not provide real 3 | capabilities. 4 | 5 | Copyright (c) 2012, Intel Corporation. All rights reserved.
6 | This program and the accompanying materials 7 | are licensed and made available under the terms and conditions of the BSD License 8 | which accompanies this distribution. The full text of the license may be found at 9 | http://opensource.org/licenses/bsd-license.php 10 | 11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 | 14 | **/ 15 | 16 | #include "InternalCryptLib.h" 17 | 18 | /** 19 | Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message 20 | Syntax Standard, version 1.5". This interface is only intended to be used for 21 | application to perform PKCS#7 functionality validation. 22 | 23 | Return FALSE to indicate this interface is not supported. 24 | 25 | @param[in] PrivateKey Pointer to the PEM-formatted private key data for 26 | data signing. 27 | @param[in] PrivateKeySize Size of the PEM private key data in bytes. 28 | @param[in] KeyPassword NULL-terminated passphrase used for encrypted PEM 29 | key data. 30 | @param[in] InData Pointer to the content to be signed. 31 | @param[in] InDataSize Size of InData in bytes. 32 | @param[in] SignCert Pointer to signer's DER-encoded certificate to sign with. 33 | @param[in] OtherCerts Pointer to an optional additional set of certificates to 34 | include in the PKCS#7 signedData (e.g. any intermediate 35 | CAs in the chain). 36 | @param[out] SignedData Pointer to output PKCS#7 signedData. 37 | @param[out] SignedDataSize Size of SignedData in bytes. 38 | 39 | @retval FALSE This interface is not supported. 40 | 41 | **/ 42 | BOOLEAN 43 | EFIAPI 44 | Pkcs7Sign ( 45 | IN CONST UINT8 *PrivateKey, 46 | IN UINTN PrivateKeySize, 47 | IN CONST UINT8 *KeyPassword, 48 | IN UINT8 *InData, 49 | IN UINTN InDataSize, 50 | IN UINT8 *SignCert, 51 | IN UINT8 *OtherCerts OPTIONAL, 52 | OUT UINT8 **SignedData, 53 | OUT UINTN *SignedDataSize 54 | ) 55 | { 56 | ASSERT (FALSE); 57 | return FALSE; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /Cryptlib/Rand/CryptRand.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Pseudorandom Number Generator Wrapper Implementation over OpenSSL. 3 | 4 | Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.
5 | This program and the accompanying materials 6 | are licensed and made available under the terms and conditions of the BSD License 7 | which accompanies this distribution. The full text of the license may be found at 8 | http://opensource.org/licenses/bsd-license.php 9 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 | 13 | **/ 14 | 15 | #include "InternalCryptLib.h" 16 | #include 17 | #include 18 | 19 | // 20 | // Default seed for UEFI Crypto Library 21 | // 22 | CONST UINT8 DefaultSeed[] = "UEFI Crypto Library default seed"; 23 | 24 | /** 25 | Sets up the seed value for the pseudorandom number generator. 26 | 27 | This function sets up the seed value for the pseudorandom number generator. 28 | If Seed is not NULL, then the seed passed in is used. 29 | If Seed is NULL, then default seed is used. 30 | 31 | @param[in] Seed Pointer to seed value. 32 | If NULL, default seed is used. 33 | @param[in] SeedSize Size of seed value. 34 | If Seed is NULL, this parameter is ignored. 35 | 36 | @retval TRUE Pseudorandom number generator has enough entropy for random generation. 37 | @retval FALSE Pseudorandom number generator does not have enough entropy for random generation. 38 | 39 | **/ 40 | BOOLEAN 41 | EFIAPI 42 | RandomSeed ( 43 | IN CONST UINT8 *Seed OPTIONAL, 44 | IN UINTN SeedSize 45 | ) 46 | { 47 | if (SeedSize > INT_MAX) { 48 | return FALSE; 49 | } 50 | 51 | // 52 | // The software PRNG implementation built in OpenSSL depends on message digest algorithm. 53 | // Make sure SHA-1 digest algorithm is available here. 54 | // 55 | if (EVP_add_digest (EVP_sha1 ()) == 0) { 56 | return FALSE; 57 | } 58 | 59 | // 60 | // Seed the pseudorandom number generator with user-supplied value. 61 | // NOTE: A cryptographic PRNG must be seeded with unpredictable data. 62 | // 63 | if (Seed != NULL) { 64 | RAND_seed (Seed, (UINT32) SeedSize); 65 | } else { 66 | RAND_seed (DefaultSeed, sizeof (DefaultSeed)); 67 | } 68 | 69 | if (RAND_status () == 1) { 70 | return TRUE; 71 | } 72 | 73 | return FALSE; 74 | } 75 | 76 | /** 77 | Generates a pseudorandom byte stream of the specified size. 78 | 79 | If Output is NULL, then return FALSE. 80 | 81 | @param[out] Output Pointer to buffer to receive random value. 82 | @param[in] Size Size of randome bytes to generate. 83 | 84 | @retval TRUE Pseudorandom byte stream generated successfully. 85 | @retval FALSE Pseudorandom number generator fails to generate due to lack of entropy. 86 | 87 | **/ 88 | BOOLEAN 89 | EFIAPI 90 | RandomBytes ( 91 | OUT UINT8 *Output, 92 | IN UINTN Size 93 | ) 94 | { 95 | // 96 | // Check input parameters. 97 | // 98 | if (Output == NULL || Size > INT_MAX) { 99 | return FALSE; 100 | } 101 | 102 | // 103 | // Generate random data. 104 | // 105 | if (RAND_bytes (Output, (UINT32) Size) != 1) { 106 | return FALSE; 107 | } 108 | 109 | return TRUE; 110 | } 111 | -------------------------------------------------------------------------------- /Cryptlib/SysCall/BaseMemAllocation.c: -------------------------------------------------------------------------------- 1 | /** @file 2 | Base Memory Allocation Routines Wrapper for Crypto library over OpenSSL 3 | during PEI & DXE phases. 4 | 5 | Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
6 | This program and the accompanying materials 7 | are licensed and made available under the terms and conditions of the BSD License 8 | which accompanies this distribution. The full text of the license may be found at 9 | http://opensource.org/licenses/bsd-license.php 10 | 11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 13 | 14 | **/ 15 | 16 | #include 17 | 18 | // 19 | // -- Memory-Allocation Routines -- 20 | // 21 | 22 | /* Allocates memory blocks */ 23 | void *malloc (size_t size) 24 | { 25 | return AllocatePool ((UINTN) size); 26 | } 27 | 28 | /* Reallocate memory blocks */ 29 | void *realloc (void *ptr, size_t size) 30 | { 31 | // 32 | // BUG: hardcode OldSize == size! We have no any knowledge about 33 | // memory size of original pointer ptr. 34 | // 35 | return ReallocatePool (ptr, (UINTN) size, (UINTN) size); 36 | } 37 | 38 | /* De-allocates or frees a memory block */ 39 | void free (void *ptr) 40 | { 41 | FreePool (ptr); 42 | } 43 | -------------------------------------------------------------------------------- /Cryptlib/SysCall/BaseStrings.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | CHAR8 * 4 | AsciiStrCat(CHAR8 *Destination, CHAR8 *Source) 5 | { 6 | UINTN dest_len = strlena(Destination); 7 | UINTN i; 8 | 9 | for (i = 0; Source[i] != '\0'; i++) 10 | Destination[dest_len + i] = Source[i]; 11 | Destination[dest_len + i] = '\0'; 12 | 13 | return Destination; 14 | } 15 | 16 | CHAR8 * 17 | AsciiStrCpy(CHAR8 *Destination, CHAR8 *Source) 18 | { 19 | UINTN i; 20 | 21 | for (i=0; Source[i] != '\0'; i++) 22 | Destination[i] = Source[i]; 23 | Destination[i] = '\0'; 24 | 25 | return Destination; 26 | } 27 | 28 | CHAR8 * 29 | AsciiStrnCpy(CHAR8 *Destination, CHAR8 *Source, UINTN count) 30 | { 31 | UINTN i; 32 | 33 | for (i=0; i < count && Source[i] != '\0'; i++) 34 | Destination[i] = Source[i]; 35 | for ( ; i < count; i++) 36 | Destination[i] = '\0'; 37 | 38 | return Destination; 39 | } 40 | 41 | CHAR8 * 42 | ScanMem8(CHAR8 *str, UINTN count, CHAR8 ch) 43 | { 44 | UINTN i; 45 | 46 | for (i = 0; i < count; i++) { 47 | if (str[i] == ch) 48 | return str + i; 49 | } 50 | return NULL; 51 | } 52 | 53 | UINT32 54 | WriteUnaligned32(UINT32 *Buffer, UINT32 Value) 55 | { 56 | *Buffer = Value; 57 | 58 | return Value; 59 | } 60 | 61 | UINTN 62 | AsciiStrSize(CHAR8 *string) 63 | { 64 | return strlena(string) + 1; 65 | } 66 | 67 | 68 | -------------------------------------------------------------------------------- /Cryptlib/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR=$1 4 | 5 | cp $DIR/CryptoPkg/Library/BaseCryptLib/InternalCryptLib.h InternalCryptLib.h 6 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd4.c Hash/CryptMd4.c 7 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Hash/CryptMd5.c Hash/CryptMd5.c 8 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha1.c Hash/CryptSha1.c 9 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Hash/CryptSha256.c Hash/CryptSha256.c 10 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacMd5.c Hmac/CryptHmacMd5.c 11 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Hmac/CryptHmacSha1.c Hmac/CryptHmacSha1.c 12 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Cipher/CryptAes.c Cipher/CryptAes.c 13 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Cipher/CryptTdes.c Cipher/CryptTdes.c 14 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Cipher/CryptArc4.c Cipher/CryptArc4.c 15 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Rand/CryptRand.c Rand/CryptRand.c 16 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaBasic.c Pk/CryptRsaBasic.c 17 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Pk/CryptRsaExtNull.c Pk/CryptRsaExtNull.c 18 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7SignNull.c Pk/CryptPkcs7SignNull.c 19 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c Pk/CryptPkcs7Verify.c 20 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Pk/CryptDhNull.c Pk/CryptDhNull.c 21 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Pk/CryptTs.c Pk/CryptTs.c 22 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c Pk/CryptX509.c 23 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Pk/CryptAuthenticode.c Pk/CryptAuthenticode.c 24 | cp $DIR/CryptoPkg/Library/BaseCryptLib/Pem/CryptPem.c Pem/CryptPem.c 25 | cp $DIR/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c SysCall/CrtWrapper.c 26 | cp $DIR/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c SysCall/TimerWrapper.c 27 | cp $DIR/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c SysCall/BaseMemAllocation.c 28 | 29 | cp $DIR/CryptoPkg/Include/openssl/* Include/openssl/ 30 | 31 | patch -p2 in 2000-2011. 3 | * No copyright is claimed, and the software is hereby placed in the public 4 | * domain. In case this attempt to disclaim copyright and place the software 5 | * in the public domain is deemed null and void, then the software is 6 | * Copyright (c) 2000-2011 Solar Designer and it is hereby released to the 7 | * general public under the following terms: 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted. 11 | * 12 | * There's ABSOLUTELY NO WARRANTY, express or implied. 13 | * 14 | * See crypt_blowfish.c for more information. 15 | */ 16 | 17 | #ifndef _CRYPT_BLOWFISH_H 18 | #define _CRYPT_BLOWFISH_H 19 | 20 | char *crypt_blowfish_rn(const char *key, const char *setting, 21 | char *output, int size); 22 | #endif 23 | -------------------------------------------------------------------------------- /elf_aarch64_efi.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64") 2 | OUTPUT_ARCH(aarch64) 3 | ENTRY(_start) 4 | SECTIONS 5 | { 6 | .text 0x0 : { 7 | _text = .; 8 | *(.text.head) 9 | *(.text) 10 | *(.text.*) 11 | *(.gnu.linkonce.t.*) 12 | *(.srodata) 13 | *(.rodata*) 14 | . = ALIGN(16); 15 | _etext = .; 16 | } 17 | .dynamic : { *(.dynamic) } 18 | .data : 19 | { 20 | _data = .; 21 | *(.sdata) 22 | *(.data) 23 | *(.data1) 24 | *(.data.*) 25 | *(.got.plt) 26 | *(.got) 27 | 28 | /* the EFI loader doesn't seem to like a .bss section, so we stick 29 | it all into .data: */ 30 | . = ALIGN(16); 31 | _bss = .; 32 | *(.sbss) 33 | *(.scommon) 34 | *(.dynbss) 35 | *(.bss) 36 | *(COMMON) 37 | . = ALIGN(16); 38 | _bss_end = .; 39 | } 40 | .note.gnu.build-id : { *(.note.gnu.build-id) } 41 | 42 | . = ALIGN(4096); 43 | .vendor_cert : 44 | { 45 | *(.vendor_cert) 46 | } 47 | . = ALIGN(4096); 48 | 49 | .rela.dyn : { *(.rela.dyn) } 50 | .rela.plt : { *(.rela.plt) } 51 | .rela.got : { *(.rela.got) } 52 | .rela.data : { *(.rela.data) *(.rela.data*) } 53 | _edata = .; 54 | _data_size = . - _data; 55 | 56 | . = ALIGN(4096); 57 | .dynsym : { *(.dynsym) } 58 | . = ALIGN(4096); 59 | .dynstr : { *(.dynstr) } 60 | . = ALIGN(4096); 61 | /DISCARD/ : 62 | { 63 | *(.rel.reloc) 64 | *(.eh_frame) 65 | *(.note.GNU-stack) 66 | } 67 | .comment 0 : { *(.comment) } 68 | } 69 | -------------------------------------------------------------------------------- /elf_arm_efi.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") 2 | OUTPUT_ARCH(arm) 3 | ENTRY(_start) 4 | SECTIONS 5 | { 6 | .text 0x0 : { 7 | _text = .; 8 | *(.text.head) 9 | *(.text) 10 | *(.text.*) 11 | *(.gnu.linkonce.t.*) 12 | *(.srodata) 13 | *(.rodata*) 14 | . = ALIGN(16); 15 | _etext = .; 16 | } 17 | .dynamic : { *(.dynamic) } 18 | .data : 19 | { 20 | _data = .; 21 | *(.sdata) 22 | *(.data) 23 | *(.data1) 24 | *(.data*) 25 | *(.got.plt) 26 | *(.got) 27 | 28 | /* the EFI loader doesn't seem to like a .bss section, so we stick 29 | it all into .data: */ 30 | . = ALIGN(16); 31 | _bss = .; 32 | *(.sbss) 33 | *(.scommon) 34 | *(.dynbss) 35 | *(.bss) 36 | *(COMMON) 37 | . = ALIGN(16); 38 | _bss_end = .; 39 | } 40 | .note.gnu.build-id : { *(.note.gnu.build-id) } 41 | 42 | . = ALIGN(4096); 43 | .vendor_cert : 44 | { 45 | *(.vendor_cert) 46 | } 47 | . = ALIGN(4096); 48 | 49 | .rel.dyn : { *(.rel.dyn) } 50 | .rel.plt : { *(.rel.plt) } 51 | .rel.got : { *(.rel.got) } 52 | .rel.data : { *(.rel.data) *(.rel.data*) } 53 | _edata = .; 54 | _data_size = . - _data; 55 | 56 | . = ALIGN(4096); 57 | .dynsym : { *(.dynsym) } 58 | . = ALIGN(4096); 59 | .dynstr : { *(.dynstr) } 60 | . = ALIGN(4096); 61 | /DISCARD/ : 62 | { 63 | *(.rel.reloc) 64 | *(.eh_frame) 65 | *(.note.GNU-stack) 66 | } 67 | .comment 0 : { *(.comment) } 68 | } 69 | -------------------------------------------------------------------------------- /elf_ia32_efi.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") 2 | OUTPUT_ARCH(i386) 3 | ENTRY(_start) 4 | SECTIONS 5 | { 6 | . = 0; 7 | ImageBase = .; 8 | .hash : { *(.hash) } /* this MUST come first! */ 9 | . = ALIGN(4096); 10 | .text : 11 | { 12 | _text = .; 13 | *(.text) 14 | *(.text.*) 15 | *(.gnu.linkonce.t.*) 16 | _etext = .; 17 | } 18 | .reloc : 19 | { 20 | *(.reloc) 21 | } 22 | . = ALIGN(4096); 23 | .data : 24 | { 25 | _data = .; 26 | *(.rodata*) 27 | *(.data) 28 | *(.data1) 29 | *(.data.*) 30 | *(.sdata) 31 | *(.got.plt) 32 | *(.got) 33 | /* the EFI loader doesn't seem to like a .bss section, so we stick 34 | it all into .data: */ 35 | *(.sbss) 36 | *(.scommon) 37 | *(.dynbss) 38 | *(.bss) 39 | *(COMMON) 40 | } 41 | .note.gnu.build-id : { *(.note.gnu.build-id) } 42 | . = ALIGN(4096); 43 | .vendor_cert : 44 | { 45 | *(.vendor_cert) 46 | } 47 | . = ALIGN(4096); 48 | .dynamic : { *(.dynamic) } 49 | . = ALIGN(4096); 50 | .rel : 51 | { 52 | *(.rel.data) 53 | *(.rel.data.*) 54 | *(.rel.got) 55 | *(.rel.stab) 56 | *(.data.rel.ro.local) 57 | *(.data.rel.local) 58 | *(.data.rel.ro) 59 | *(.data.rel*) 60 | } 61 | _edata = .; 62 | _data_size = . - _data; 63 | . = ALIGN(4096); 64 | .dynsym : { *(.dynsym) } 65 | . = ALIGN(4096); 66 | .dynstr : { *(.dynstr) } 67 | . = ALIGN(4096); 68 | /DISCARD/ : 69 | { 70 | *(.rel.reloc) 71 | *(.eh_frame) 72 | *(.note.GNU-stack) 73 | } 74 | .comment 0 : { *(.comment) } 75 | } 76 | -------------------------------------------------------------------------------- /elf_ia64_efi.lds: -------------------------------------------------------------------------------- 1 | OUTPUT_FORMAT("elf64-ia64-little") 2 | OUTPUT_ARCH(ia64) 3 | ENTRY(_start_plabel) 4 | SECTIONS 5 | { 6 | . = 0; 7 | ImageBase = .; 8 | .hash : { *(.hash) } /* this MUST come first! */ 9 | . = ALIGN(4096); 10 | .text : 11 | { 12 | _text = .; 13 | *(.text) 14 | *(.text.*) 15 | *(.gnu.linkonce.t.*) 16 | _etext = .; 17 | } 18 | . = ALIGN(4096); 19 | __gp = ALIGN (8) + 0x200000; 20 | .sdata : 21 | { 22 | _data = .; 23 | *(.got.plt) 24 | *(.got) 25 | *(.srodata) 26 | *(.sdata) 27 | *(.sbss) 28 | *(.scommon) 29 | } 30 | . = ALIGN(4096); 31 | .data : 32 | { 33 | *(.rodata*) 34 | *(.ctors) 35 | *(.data*) 36 | *(.gnu.linkonce.d*) 37 | *(.plabel) /* data whose relocs we want to ignore */ 38 | /* the EFI loader doesn't seem to like a .bss section, so we stick 39 | it all into .data: */ 40 | *(.dynbss) 41 | *(.bss) 42 | *(COMMON) 43 | } 44 | .note.gnu.build-id : { *(.note.gnu.build-id) } 45 | . = ALIGN(4096); 46 | .vendor_cert : 47 | { 48 | *(.vendor_cert) 49 | } 50 | . = ALIGN(4096); 51 | .dynamic : { *(.dynamic) } 52 | . = ALIGN(4096); 53 | .rela : 54 | { 55 | *(.rela.text) 56 | *(.rela.data*) 57 | *(.rela.sdata) 58 | *(.rela.got) 59 | *(.rela.gnu.linkonce.d*) 60 | *(.rela.stab) 61 | *(.rela.ctors) 62 | } 63 | _edata = .; 64 | _data_size = . - _data; 65 | . = ALIGN(4096); 66 | .reloc : /* This is the PECOFF .reloc section! */ 67 | { 68 | *(.reloc) 69 | } 70 | . = ALIGN(4096); 71 | .dynsym : { *(.dynsym) } 72 | . = ALIGN(4096); 73 | .dynstr : { *(.dynstr) } 74 | /DISCARD/ : 75 | { 76 | *(.rela.plabel) 77 | *(.rela.reloc) 78 | *(.IA_64.unwind*) 79 | *(.IA64.unwind*) 80 | } 81 | .note.gnu.build-id : { *(.note.gnu.build-id) } 82 | } 83 | -------------------------------------------------------------------------------- /elf_x86_64_efi.lds: -------------------------------------------------------------------------------- 1 | /* Same as elf_x86_64_fbsd_efi.lds, except for OUTPUT_FORMAT below - KEEP IN SYNC */ 2 | OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") 3 | OUTPUT_ARCH(i386:x86-64) 4 | ENTRY(_start) 5 | SECTIONS 6 | { 7 | . = 0; 8 | ImageBase = .; 9 | .hash : { *(.hash) } /* this MUST come first! */ 10 | . = ALIGN(4096); 11 | .eh_frame : 12 | { 13 | *(.eh_frame) 14 | } 15 | . = ALIGN(4096); 16 | .text : 17 | { 18 | _text = .; 19 | *(.text) 20 | _etext = .; 21 | } 22 | . = ALIGN(4096); 23 | .reloc : 24 | { 25 | *(.reloc) 26 | } 27 | . = ALIGN(4096); 28 | .data : 29 | { 30 | _data = .; 31 | *(.rodata*) 32 | *(.got.plt) 33 | *(.got) 34 | *(.data*) 35 | *(.sdata) 36 | /* the EFI loader doesn't seem to like a .bss section, so we stick 37 | it all into .data: */ 38 | *(.sbss) 39 | *(.scommon) 40 | *(.dynbss) 41 | *(.bss) 42 | *(COMMON) 43 | *(.rel.local) 44 | } 45 | .note.gnu.build-id : { *(.note.gnu.build-id) } 46 | . = ALIGN(4096); 47 | .vendor_cert : 48 | { 49 | *(.vendor_cert) 50 | } 51 | . = ALIGN(4096); 52 | .dynamic : { *(.dynamic) } 53 | . = ALIGN(4096); 54 | .rela : 55 | { 56 | *(.rela.data*) 57 | *(.rela.got) 58 | *(.rela.stab) 59 | } 60 | _edata = .; 61 | _data_size = . - _data; 62 | 63 | . = ALIGN(4096); 64 | .dynsym : { *(.dynsym) } 65 | . = ALIGN(4096); 66 | .dynstr : { *(.dynstr) } 67 | . = ALIGN(4096); 68 | .ignored.reloc : 69 | { 70 | *(.rela.reloc) 71 | *(.eh_frame) 72 | *(.note.GNU-stack) 73 | } 74 | .comment 0 : { *(.comment) } 75 | .note.gnu.build-id : { *(.note.gnu.build-id) } 76 | } 77 | -------------------------------------------------------------------------------- /include/configtable.h: -------------------------------------------------------------------------------- 1 | /* definitions straight from TianoCore */ 2 | 3 | typedef UINT32 EFI_IMAGE_EXECUTION_ACTION; 4 | 5 | #define EFI_IMAGE_EXECUTION_AUTHENTICATION 0x00000007 6 | #define EFI_IMAGE_EXECUTION_AUTH_UNTESTED 0x00000000 7 | #define EFI_IMAGE_EXECUTION_AUTH_SIG_FAILED 0x00000001 8 | #define EFI_IMAGE_EXECUTION_AUTH_SIG_PASSED 0x00000002 9 | #define EFI_IMAGE_EXECUTION_AUTH_SIG_NOT_FOUND 0x00000003 10 | #define EFI_IMAGE_EXECUTION_AUTH_SIG_FOUND 0x00000004 11 | #define EFI_IMAGE_EXECUTION_POLICY_FAILED 0x00000005 12 | #define EFI_IMAGE_EXECUTION_INITIALIZED 0x00000008 13 | 14 | typedef struct { 15 | /// 16 | /// Describes the action taken by the firmware regarding this image. 17 | /// 18 | EFI_IMAGE_EXECUTION_ACTION Action; 19 | /// 20 | /// Size of all of the entire structure. 21 | /// 22 | UINT32 InfoSize; 23 | /// 24 | /// If this image was a UEFI device driver (for option ROM, for example) this is the 25 | /// null-terminated, user-friendly name for the device. If the image was for an application, 26 | /// then this is the name of the application. If this cannot be determined, then a simple 27 | /// NULL character should be put in this position. 28 | /// CHAR16 Name[]; 29 | /// 30 | 31 | /// 32 | /// For device drivers, this is the device path of the device for which this device driver 33 | /// was intended. In some cases, the driver itself may be stored as part of the system 34 | /// firmware, but this field should record the device's path, not the firmware path. For 35 | /// applications, this is the device path of the application. If this cannot be determined, 36 | /// a simple end-of-path device node should be put in this position. 37 | /// EFI_DEVICE_PATH_PROTOCOL DevicePath; 38 | /// 39 | 40 | /// 41 | /// Zero or more image signatures. If the image contained no signatures, 42 | /// then this field is empty. 43 | /// 44 | ///EFI_SIGNATURE_LIST Signature; 45 | UINT8 Data[]; 46 | } EFI_IMAGE_EXECUTION_INFO; 47 | 48 | typedef struct { 49 | /// 50 | /// Number of EFI_IMAGE_EXECUTION_INFO structures. 51 | /// 52 | UINTN NumberOfImages; 53 | /// 54 | /// Number of image instances of EFI_IMAGE_EXECUTION_INFO structures. 55 | /// 56 | EFI_IMAGE_EXECUTION_INFO InformationInfo[]; 57 | } EFI_IMAGE_EXECUTION_INFO_TABLE; 58 | 59 | 60 | void * 61 | configtable_get_table(EFI_GUID *guid); 62 | EFI_IMAGE_EXECUTION_INFO_TABLE * 63 | configtable_get_image_table(void); 64 | EFI_IMAGE_EXECUTION_INFO * 65 | configtable_find_image(const EFI_DEVICE_PATH *DevicePath); 66 | int 67 | configtable_image_is_forbidden(const EFI_DEVICE_PATH *DevicePath); 68 | 69 | -------------------------------------------------------------------------------- /include/console.h: -------------------------------------------------------------------------------- 1 | #ifndef _SHIM_LIB_CONSOLE_H 2 | #define _SHIM_LIB_CONSOLE_H 1 3 | 4 | EFI_STATUS 5 | console_get_keystroke(EFI_INPUT_KEY *key); 6 | void 7 | console_print_box_at(CHAR16 *str_arr[], int highlight, 8 | int start_col, int start_row, 9 | int size_cols, int size_rows, 10 | int offset, int lines); 11 | void 12 | console_print_box(CHAR16 *str_arr[], int highlight); 13 | int 14 | console_yes_no(CHAR16 *str_arr[]); 15 | int 16 | console_select(CHAR16 *title[], CHAR16* selectors[], unsigned int start); 17 | void 18 | console_errorbox(CHAR16 *err); 19 | void 20 | console_error(CHAR16 *err, EFI_STATUS); 21 | void 22 | console_alertbox(CHAR16 **title); 23 | void 24 | console_notify(CHAR16 *string); 25 | void 26 | console_reset(void); 27 | #define NOSEL 0x7fffffff 28 | 29 | #define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \ 30 | { 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21} } 31 | 32 | typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL EFI_CONSOLE_CONTROL_PROTOCOL; 33 | 34 | typedef enum { 35 | EfiConsoleControlScreenText, 36 | EfiConsoleControlScreenGraphics, 37 | EfiConsoleControlScreenMaxValue 38 | } EFI_CONSOLE_CONTROL_SCREEN_MODE; 39 | 40 | typedef 41 | EFI_STATUS 42 | (EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE) ( 43 | IN EFI_CONSOLE_CONTROL_PROTOCOL *This, 44 | OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode, 45 | OUT BOOLEAN *GopUgaExists, OPTIONAL 46 | OUT BOOLEAN *StdInLocked OPTIONAL 47 | ); 48 | 49 | typedef 50 | EFI_STATUS 51 | (EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE) ( 52 | IN EFI_CONSOLE_CONTROL_PROTOCOL *This, 53 | IN EFI_CONSOLE_CONTROL_SCREEN_MODE Mode 54 | ); 55 | 56 | typedef 57 | EFI_STATUS 58 | (EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN) ( 59 | IN EFI_CONSOLE_CONTROL_PROTOCOL *This, 60 | IN CHAR16 *Password 61 | ); 62 | 63 | struct _EFI_CONSOLE_CONTROL_PROTOCOL { 64 | EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE GetMode; 65 | EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE SetMode; 66 | EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN LockStdIn; 67 | }; 68 | 69 | extern VOID setup_console (int text); 70 | extern VOID setup_verbosity(VOID); 71 | extern UINT8 verbose; 72 | #define dprint(fmt, ...) ({ \ 73 | UINTN __dprint_ret = 0; \ 74 | if (verbose) \ 75 | __dprint_ret = Print((fmt), ##__VA_ARGS__); \ 76 | __dprint_ret; \ 77 | }) 78 | #define dprinta(fmt, ...) ({ \ 79 | UINTN __dprinta_ret = 0; \ 80 | if (verbose) { \ 81 | UINTN __dprinta_i; \ 82 | CHAR16 *__dprinta_str = AllocateZeroPool((strlena(fmt) + 1) * 2); \ 83 | for (__dprinta_i = 0; fmt[__dprinta_i] != '\0'; __dprinta_i++) \ 84 | __dprinta_str[__dprinta_i] = fmt[__dprinta_i]; \ 85 | __dprinta_ret = Print((__dprinta_str), ##__VA_ARGS__); \ 86 | FreePool(__dprinta_str); \ 87 | } \ 88 | __dprinta_ret; \ 89 | }) 90 | 91 | #endif /* _SHIM_LIB_CONSOLE_H */ 92 | -------------------------------------------------------------------------------- /include/errors.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #ifndef EFI_INCOMPATIBLE_VERSION 4 | #define EFI_INCOMPATIBLE_VERSION EFIERR(25) 5 | #endif 6 | #ifndef EFI_SECURITY_VIOLATION 7 | #define EFI_SECURITY_VIOLATION EFIERR(26) 8 | #endif 9 | 10 | -------------------------------------------------------------------------------- /include/execute.h: -------------------------------------------------------------------------------- 1 | EFI_STATUS 2 | generate_path(CHAR16* name, EFI_LOADED_IMAGE *li, 3 | EFI_DEVICE_PATH **path, CHAR16 **PathName); 4 | EFI_STATUS 5 | execute(EFI_HANDLE image, CHAR16 *name); 6 | -------------------------------------------------------------------------------- /include/guid.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern EFI_GUID GV_GUID; 4 | extern EFI_GUID SIG_DB; 5 | extern EFI_GUID X509_GUID; 6 | extern EFI_GUID RSA2048_GUID; 7 | extern EFI_GUID PKCS7_GUID; 8 | extern EFI_GUID IMAGE_PROTOCOL; 9 | extern EFI_GUID SIMPLE_FS_PROTOCOL; 10 | extern EFI_GUID EFI_CERT_SHA1_GUID; 11 | extern EFI_GUID EFI_CERT_SHA256_GUID; 12 | extern EFI_GUID MOK_OWNER; 13 | extern EFI_GUID SECURITY_PROTOCOL_GUID; 14 | extern EFI_GUID SECURITY2_PROTOCOL_GUID; 15 | -------------------------------------------------------------------------------- /include/security_policy.h: -------------------------------------------------------------------------------- 1 | #ifndef _SHIM_LIB_SECURITY_POLICY_H 2 | #define _SHIM_LIB_SECURITY_POLICY_H 1 3 | 4 | #if defined(OVERRIDE_SECURITY_POLICY) 5 | typedef EFI_STATUS (*SecurityHook) (void *data, UINT32 len); 6 | 7 | EFI_STATUS 8 | security_policy_install(SecurityHook authentication); 9 | EFI_STATUS 10 | security_policy_uninstall(void); 11 | void 12 | security_protocol_set_hashes(unsigned char *esl, int len); 13 | #endif /* OVERRIDE_SECURITY_POLICY */ 14 | 15 | #endif /* SHIM_LIB_SECURITY_POLICY_H */ 16 | -------------------------------------------------------------------------------- /include/shell.h: -------------------------------------------------------------------------------- 1 | EFI_STATUS 2 | argsplit(EFI_HANDLE image, int *argc, CHAR16*** ARGV); 3 | -------------------------------------------------------------------------------- /include/simple_file.h: -------------------------------------------------------------------------------- 1 | EFI_STATUS 2 | simple_file_open (EFI_HANDLE image, CHAR16 *name, EFI_FILE **file, UINT64 mode); 3 | EFI_STATUS 4 | simple_file_open_by_handle(EFI_HANDLE device, CHAR16 *name, EFI_FILE **file, UINT64 mode); 5 | EFI_STATUS 6 | simple_file_read_all(EFI_FILE *file, UINTN *size, void **buffer); 7 | EFI_STATUS 8 | simple_file_write_all(EFI_FILE *file, UINTN size, void *buffer); 9 | void 10 | simple_file_close(EFI_FILE *file); 11 | EFI_STATUS 12 | simple_dir_read_all(EFI_HANDLE image, CHAR16 *name, EFI_FILE_INFO **Entries, 13 | int *count); 14 | EFI_STATUS 15 | simple_dir_filter(EFI_HANDLE image, CHAR16 *name, CHAR16 *filter, 16 | CHAR16 ***result, int *count, EFI_FILE_INFO **entries); 17 | void 18 | simple_file_selector(EFI_HANDLE *im, CHAR16 **title, CHAR16 *name, 19 | CHAR16 *filter, CHAR16 **result); 20 | EFI_STATUS 21 | simple_volume_selector(CHAR16 **title, CHAR16 **selected, EFI_HANDLE *h); 22 | -------------------------------------------------------------------------------- /include/str.h: -------------------------------------------------------------------------------- 1 | #ifndef SHIM_STR_H 2 | #define SHIM_STR_H 3 | 4 | static inline 5 | __attribute__((unused)) 6 | unsigned long strnlena(const CHAR8 *s, unsigned long n) 7 | { 8 | unsigned long i; 9 | for (i = 0; i <= n; i++) 10 | if (s[i] == '\0') 11 | break; 12 | return i; 13 | } 14 | 15 | static inline 16 | __attribute__((unused)) 17 | CHAR8 * 18 | strncpya(CHAR8 *dest, const CHAR8 *src, unsigned long n) 19 | { 20 | unsigned long i; 21 | 22 | for (i = 0; i < n && src[i] != '\0'; i++) 23 | dest[i] = src[i]; 24 | for (; i < n; i++) 25 | dest[i] = '\0'; 26 | 27 | return dest; 28 | } 29 | 30 | static inline 31 | __attribute__((unused)) 32 | CHAR8 * 33 | strcata(CHAR8 *dest, const CHAR8 *src) 34 | { 35 | unsigned long dest_len = strlena(dest); 36 | unsigned long i; 37 | 38 | for (i = 0; src[i] != '\0'; i++) 39 | dest[dest_len + i] = src[i]; 40 | dest[dest_len + i] = '\0'; 41 | 42 | return dest; 43 | } 44 | 45 | #endif /* SHIM_STR_H */ 46 | -------------------------------------------------------------------------------- /include/variables.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include /* for SHA256_DIGEST_SIZE */ 4 | 5 | #define certlist_for_each_certentry(cl, cl_init, s, s_init) \ 6 | for (cl = (EFI_SIGNATURE_LIST *)(cl_init), s = (s_init); \ 7 | s > 0 && s >= cl->SignatureListSize; \ 8 | s -= cl->SignatureListSize, \ 9 | cl = (EFI_SIGNATURE_LIST *) ((UINT8 *)cl + cl->SignatureListSize)) 10 | 11 | /* 12 | * Warning: this assumes (cl)->SignatureHeaderSize is zero. It is for all 13 | * the signatures we process (X509, RSA2048, SHA256) 14 | */ 15 | #define certentry_for_each_cert(c, cl) \ 16 | for (c = (EFI_SIGNATURE_DATA *)((UINT8 *) (cl) + sizeof(EFI_SIGNATURE_LIST) + (cl)->SignatureHeaderSize); \ 17 | (UINT8 *)c < ((UINT8 *)(cl)) + (cl)->SignatureListSize; \ 18 | c = (EFI_SIGNATURE_DATA *)((UINT8 *)c + (cl)->SignatureSize)) 19 | 20 | EFI_STATUS 21 | CreatePkX509SignatureList ( 22 | IN UINT8 *X509Data, 23 | IN UINTN X509DataSize, 24 | IN EFI_GUID owner, 25 | OUT EFI_SIGNATURE_LIST **PkCert 26 | ); 27 | EFI_STATUS 28 | CreateTimeBasedPayload ( 29 | IN OUT UINTN *DataSize, 30 | IN OUT UINT8 **Data 31 | ); 32 | EFI_STATUS 33 | SetSecureVariable(CHAR16 *var, UINT8 *Data, UINTN len, EFI_GUID owner, UINT32 options, int createtimebased); 34 | EFI_STATUS 35 | get_variable(CHAR16 *var, UINT8 **data, UINTN *len, EFI_GUID owner); 36 | EFI_STATUS 37 | get_variable_attr(CHAR16 *var, UINT8 **data, UINTN *len, EFI_GUID owner, 38 | UINT32 *attributes); 39 | EFI_STATUS 40 | find_in_esl(UINT8 *Data, UINTN DataSize, UINT8 *key, UINTN keylen); 41 | EFI_STATUS 42 | find_in_variable_esl(CHAR16* var, EFI_GUID owner, UINT8 *key, UINTN keylen); 43 | 44 | #define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001 45 | 46 | UINT64 47 | GetOSIndications(void); 48 | EFI_STATUS 49 | SETOSIndicationsAndReboot(UINT64 indications); 50 | int 51 | variable_is_secureboot(void); 52 | int 53 | variable_is_setupmode(int default_return); 54 | EFI_STATUS 55 | variable_enroll_hash(CHAR16 *var, EFI_GUID owner, 56 | UINT8 hash[SHA256_DIGEST_SIZE]); 57 | EFI_STATUS 58 | variable_create_esl(void *cert, int cert_len, EFI_GUID *type, EFI_GUID *owner, 59 | void **out, int *outlen); 60 | -------------------------------------------------------------------------------- /include/version.h: -------------------------------------------------------------------------------- 1 | #define VERSION "1.3.4" 2 | 3 | static void 4 | version(const char *progname) 5 | { 6 | printf("%s " VERSION "\n", progname); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /include/wincert.h: -------------------------------------------------------------------------------- 1 | #ifndef _INC_WINCERT_H 2 | #define _INC_WINCERT_H 3 | 4 | /// 5 | /// The WIN_CERTIFICATE structure is part of the PE/COFF specification. 6 | /// 7 | typedef struct { 8 | /// 9 | /// The length of the entire certificate, 10 | /// including the length of the header, in bytes. 11 | /// 12 | UINT32 dwLength; 13 | /// 14 | /// The revision level of the WIN_CERTIFICATE 15 | /// structure. The current revision level is 0x0200. 16 | /// 17 | UINT16 wRevision; 18 | /// 19 | /// The certificate type. See WIN_CERT_TYPE_xxx for the UEFI 20 | /// certificate types. The UEFI specification reserves the range of 21 | /// certificate type values from 0x0EF0 to 0x0EFF. 22 | /// 23 | UINT16 wCertificateType; 24 | /// 25 | /// The following is the actual certificate. The format of 26 | /// the certificate depends on wCertificateType. 27 | /// 28 | /// UINT8 bCertificate[ANYSIZE_ARRAY]; 29 | /// 30 | } WIN_CERTIFICATE; 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /lib/Makefile: -------------------------------------------------------------------------------- 1 | TARGET = lib.a 2 | 3 | LIBFILES = simple_file.o guid.o console.o execute.o configtable.o shell.o variables.o security_policy.o 4 | 5 | EFI_INCLUDES = -I$(EFI_INCLUDE) -I$(EFI_INCLUDE)/$(ARCH) -I$(EFI_INCLUDE)/protocol -I../include 6 | 7 | lib.a: $(LIBFILES) 8 | ar rcs lib.a $(LIBFILES) 9 | 10 | all: $(TARGET) 11 | 12 | clean: 13 | rm -f lib.a 14 | rm -f $(LIBFILES) 15 | 16 | -------------------------------------------------------------------------------- /lib/guid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 3 | * 4 | * see COPYING file 5 | */ 6 | 7 | #include 8 | 9 | /* all the necessary guids */ 10 | EFI_GUID GV_GUID = EFI_GLOBAL_VARIABLE; 11 | EFI_GUID SIG_DB = { 0xd719b2cb, 0x3d3a, 0x4596, {0xa3, 0xbc, 0xda, 0xd0, 0xe, 0x67, 0x65, 0x6f }}; 12 | 13 | EFI_GUID X509_GUID = { 0xa5c059a1, 0x94e4, 0x4aa7, {0x87, 0xb5, 0xab, 0x15, 0x5c, 0x2b, 0xf0, 0x72} }; 14 | EFI_GUID RSA2048_GUID = { 0x3c5766e8, 0x269c, 0x4e34, {0xaa, 0x14, 0xed, 0x77, 0x6e, 0x85, 0xb3, 0xb6} }; 15 | EFI_GUID PKCS7_GUID = { 0x4aafd29d, 0x68df, 0x49ee, {0x8a, 0xa9, 0x34, 0x7d, 0x37, 0x56, 0x65, 0xa7} }; 16 | EFI_GUID IMAGE_PROTOCOL = LOADED_IMAGE_PROTOCOL; 17 | EFI_GUID SIMPLE_FS_PROTOCOL = SIMPLE_FILE_SYSTEM_PROTOCOL; 18 | EFI_GUID EFI_CERT_SHA1_GUID = { 0x826ca512, 0xcf10, 0x4ac9, {0xb1, 0x87, 0xbe, 0x1, 0x49, 0x66, 0x31, 0xbd }}; 19 | EFI_GUID EFI_CERT_SHA256_GUID = { 0xc1c41626, 0x504c, 0x4092, { 0xac, 0xa9, 0x41, 0xf9, 0x36, 0x93, 0x43, 0x28 } }; 20 | EFI_GUID MOK_OWNER = { 0x605dab50, 0xe046, 0x4300, {0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23} }; 21 | EFI_GUID SECURITY_PROTOCOL_GUID = { 0xA46423E3, 0x4617, 0x49f1, {0xB9, 0xFF, 0xD1, 0xBF, 0xA9, 0x11, 0x58, 0x39 } }; 22 | EFI_GUID SECURITY2_PROTOCOL_GUID = { 0x94ab2f58, 0x1438, 0x4ef1, {0x91, 0x52, 0x18, 0x94, 0x1a, 0x3a, 0x0e, 0x68 } }; 23 | -------------------------------------------------------------------------------- /lib/shell.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 3 | * 4 | * see COPYING file 5 | * 6 | * misc shell helper functions 7 | */ 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | EFI_STATUS 14 | argsplit(EFI_HANDLE image, int *argc, CHAR16*** ARGV) 15 | { 16 | unsigned int i, count = 1; 17 | EFI_STATUS status; 18 | EFI_LOADED_IMAGE *info; 19 | CHAR16 *start; 20 | 21 | *argc = 0; 22 | 23 | status = uefi_call_wrapper(BS->HandleProtocol, 3, image, &LoadedImageProtocol, (VOID **) &info); 24 | if (EFI_ERROR(status)) { 25 | Print(L"Failed to get arguments\n"); 26 | return status; 27 | } 28 | 29 | for (i = 0; i < info->LoadOptionsSize; i += 2) { 30 | CHAR16 *c = (CHAR16 *)(info->LoadOptions + i); 31 | if (*c == L' ' && *(c+1) != '\0') { 32 | (*argc)++; 33 | } 34 | } 35 | 36 | (*argc)++; /* we counted spaces, so add one for initial */ 37 | 38 | *ARGV = AllocatePool(*argc * sizeof(**ARGV)); 39 | if (!*ARGV) { 40 | return EFI_OUT_OF_RESOURCES; 41 | } 42 | (*ARGV)[0] = (CHAR16 *)info->LoadOptions; 43 | for (i = 0; i < info->LoadOptionsSize; i += 2) { 44 | CHAR16 *c = (CHAR16 *)(info->LoadOptions + i); 45 | if (*c == L' ') { 46 | *c = L'\0'; 47 | if (*(c + 1) == '\0') 48 | /* strip trailing space */ 49 | break; 50 | start = c + 1; 51 | (*ARGV)[count++] = start; 52 | } 53 | } 54 | 55 | return EFI_SUCCESS; 56 | } 57 | 58 | -------------------------------------------------------------------------------- /netboot.h: -------------------------------------------------------------------------------- 1 | #ifndef _NETBOOT_H_ 2 | #define _NETBOOT_H_ 3 | 4 | extern BOOLEAN findNetboot(EFI_HANDLE image_handle); 5 | 6 | extern EFI_STATUS parseNetbootinfo(EFI_HANDLE image_handle); 7 | 8 | extern EFI_STATUS FetchNetbootimage(EFI_HANDLE image_handle, VOID **buffer, UINT64 *bufsiz); 9 | #endif 10 | -------------------------------------------------------------------------------- /replacements.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Red Hat, Inc 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 8 | * Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 11 | * Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the 14 | * distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 20 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 21 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 25 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 27 | * OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | #ifndef SHIM_REPLACEMENTS_H 30 | #define SHIM_REPLACEMENTS_H 1 31 | 32 | typedef enum { 33 | VERIFIED_BY_NOTHING, 34 | VERIFIED_BY_CERT, 35 | VERIFIED_BY_HASH 36 | } verification_method_t; 37 | 38 | extern verification_method_t verification_method; 39 | extern int loader_is_participating; 40 | 41 | extern void hook_system_services(EFI_SYSTEM_TABLE *local_systab); 42 | extern void unhook_system_services(void); 43 | 44 | extern void hook_exit(EFI_SYSTEM_TABLE *local_systab); 45 | extern void unhook_exit(void); 46 | 47 | extern EFI_STATUS install_shim_protocols(void); 48 | extern void uninstall_shim_protocols(void); 49 | 50 | #endif /* SHIM_REPLACEMENTS_H */ 51 | -------------------------------------------------------------------------------- /shim.h: -------------------------------------------------------------------------------- 1 | #include "PeImage.h" 2 | 3 | extern EFI_GUID SHIM_LOCK_GUID; 4 | 5 | INTERFACE_DECL(_SHIM_LOCK); 6 | 7 | typedef 8 | EFI_STATUS 9 | (*EFI_SHIM_LOCK_VERIFY) ( 10 | IN VOID *buffer, 11 | IN UINT32 size 12 | ); 13 | 14 | typedef 15 | EFI_STATUS 16 | (*EFI_SHIM_LOCK_HASH) ( 17 | IN char *data, 18 | IN int datasize, 19 | PE_COFF_LOADER_IMAGE_CONTEXT *context, 20 | UINT8 *sha256hash, 21 | UINT8 *sha1hash 22 | ); 23 | 24 | typedef 25 | EFI_STATUS 26 | (*EFI_SHIM_LOCK_CONTEXT) ( 27 | IN VOID *data, 28 | IN unsigned int datasize, 29 | PE_COFF_LOADER_IMAGE_CONTEXT *context 30 | ); 31 | 32 | typedef struct _SHIM_LOCK { 33 | EFI_SHIM_LOCK_VERIFY Verify; 34 | EFI_SHIM_LOCK_HASH Hash; 35 | EFI_SHIM_LOCK_CONTEXT Context; 36 | } SHIM_LOCK; 37 | 38 | extern EFI_STATUS shim_init(void); 39 | extern void shim_fini(void); 40 | -------------------------------------------------------------------------------- /ucs2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * shim - trivial UEFI first-stage bootloader 3 | * 4 | * Copyright 2013 Red Hat, Inc 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 23 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * Significant portions of this code are derived from Tianocore 32 | * (http://tianocore.sf.net) and are Copyright 2009-2012 Intel 33 | * Corporation. 34 | */ 35 | 36 | #ifndef SHIM_UCS2_H 37 | #define SHIM_UCS2_H 38 | 39 | static inline INTN 40 | __attribute__((unused)) 41 | StrCaseCmp(CHAR16 *s0, CHAR16 *s1) 42 | { 43 | CHAR16 c0, c1; 44 | while (1) { 45 | if (*s0 == L'\0' || *s1 == L'\0') 46 | return *s1 - *s0; 47 | c0 = (*s0 >= L'a' && *s0 <= L'z') ? *s0 - 32 : *s0; 48 | c1 = (*s1 >= L'a' && *s1 <= L'z') ? *s1 - 32 : *s1; 49 | if (c0 != c1) 50 | return c1 - c0; 51 | s0++; 52 | s1++; 53 | } 54 | return 0; 55 | } 56 | 57 | static inline INTN 58 | __attribute__((unused)) 59 | StrnCaseCmp(CHAR16 *s0, CHAR16 *s1, int n) 60 | { 61 | CHAR16 c0, c1; 62 | int x = 0; 63 | while (n > x++) { 64 | if (*s0 == L'\0' || *s1 == L'\0') 65 | return *s1 - *s0; 66 | c0 = (*s0 >= L'a' && *s0 <= L'z') ? *s0 - 32 : *s0; 67 | c1 = (*s1 >= L'a' && *s1 <= L'z') ? *s1 - 32 : *s1; 68 | if (c0 != c1) 69 | return c1 - c0; 70 | s0++; 71 | s1++; 72 | } 73 | return 0; 74 | } 75 | 76 | static inline UINTN 77 | __attribute__((unused)) 78 | StrCSpn(const CHAR16 *s, const CHAR16 *reject) 79 | { 80 | UINTN ret; 81 | 82 | for (ret = 0; s[ret] != L'\0'; ret++) { 83 | int i; 84 | for (i = 0; reject[i] != L'\0'; i++) { 85 | if (reject[i] == s[ret]) 86 | return ret; 87 | } 88 | } 89 | return ret; 90 | } 91 | 92 | #endif /* SHIM_UCS2_H */ 93 | -------------------------------------------------------------------------------- /version.c.in: -------------------------------------------------------------------------------- 1 | 2 | #include "version.h" 3 | 4 | CHAR8 shim_version[] = 5 | "UEFI SHIM\n" 6 | "$Version: @@VERSION@@ $\n" 7 | "$BuildMachine: @@UNAME@@ $\n" 8 | "$Commit: @@COMMIT@@ $\n"; 9 | -------------------------------------------------------------------------------- /version.h: -------------------------------------------------------------------------------- 1 | #ifndef _SHIM_VERSION_H 2 | #define _SHIM_VERSION_H 1 3 | 4 | #include 5 | 6 | extern CHAR8 shim_version[]; 7 | 8 | #endif /* SHIM_VERSION_H */ 9 | --------------------------------------------------------------------------------