From 40720ce3caf44294b5b87a18856b7aef06123314 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Thu, 22 Jan 2015 02:47:42 +0000 Subject: Run util/openssl-format-source -v -c . Reviewed-by: Tim Hudson --- crypto/LPdir_nyi.c | 27 +- crypto/LPdir_unix.c | 123 +- crypto/LPdir_vms.c | 240 +- crypto/LPdir_win.c | 239 +- crypto/LPdir_win32.c | 7 +- crypto/LPdir_wince.c | 13 +- crypto/aes/aes.h | 106 +- crypto/aes/aes_cbc.c | 133 +- crypto/aes/aes_cfb.c | 184 +- crypto/aes/aes_ctr.c | 150 +- crypto/aes/aes_ecb.c | 18 +- crypto/aes/aes_ige.c | 454 +-- crypto/aes/aes_locl.h | 50 +- crypto/aes/aes_misc.c | 13 +- crypto/aes/aes_ofb.c | 50 +- crypto/aes/aes_wrap.c | 365 +-- crypto/asn1/a_bitstr.c | 336 +- crypto/asn1/a_bool.c | 97 +- crypto/asn1/a_bytes.c | 444 ++- crypto/asn1/a_d2i_fp.c | 378 ++- crypto/asn1/a_digest.c | 66 +- crypto/asn1/a_dup.c | 88 +- crypto/asn1/a_enum.c | 213 +- crypto/asn1/a_gentm.c | 353 +- crypto/asn1/a_hdr.c | 103 +- crypto/asn1/a_i2d_fp.c | 168 +- crypto/asn1/a_int.c | 718 ++--- crypto/asn1/a_mbstr.c | 553 ++-- crypto/asn1/a_meth.c | 46 +- crypto/asn1/a_object.c | 603 ++-- crypto/asn1/a_octet.c | 28 +- crypto/asn1/a_print.c | 126 +- crypto/asn1/a_set.c | 320 +- crypto/asn1/a_sign.c | 347 +- crypto/asn1/a_strex.c | 917 +++--- crypto/asn1/a_strnid.c | 327 +- crypto/asn1/a_time.c | 169 +- crypto/asn1/a_type.c | 165 +- crypto/asn1/a_utctm.c | 436 ++- crypto/asn1/a_utf8.c | 291 +- crypto/asn1/a_verify.c | 253 +- crypto/asn1/asn1.h | 1841 +++++------ crypto/asn1/asn1_err.c | 510 +-- crypto/asn1/asn1_gen.c | 1469 ++++----- crypto/asn1/asn1_lib.c | 721 +++-- crypto/asn1/asn1_mac.h | 959 +++--- crypto/asn1/asn1_par.c | 685 ++-- crypto/asn1/asn1t.h | 1084 +++---- crypto/asn1/asn_mime.c | 1357 ++++---- crypto/asn1/asn_moid.c | 146 +- crypto/asn1/asn_pack.c | 193 +- crypto/asn1/charmap.h | 22 +- crypto/asn1/d2i_pr.c | 174 +- crypto/asn1/d2i_pu.c | 122 +- crypto/asn1/evp_asn1.c | 262 +- crypto/asn1/f_enum.c | 274 +- crypto/asn1/f_int.c | 294 +- crypto/asn1/f_string.c | 281 +- crypto/asn1/i2d_pr.c | 49 +- crypto/asn1/i2d_pu.c | 46 +- crypto/asn1/n_pkey.c | 496 ++- crypto/asn1/nsseq.c | 23 +- crypto/asn1/p5_pbe.c | 115 +- crypto/asn1/p5_pbev2.c | 257 +- crypto/asn1/p8_key.c | 107 +- crypto/asn1/p8_pkey.c | 31 +- crypto/asn1/t_bitst.c | 65 +- crypto/asn1/t_crl.c | 111 +- crypto/asn1/t_pkey.c | 1408 ++++---- crypto/asn1/t_req.c | 389 ++- crypto/asn1/t_spki.c | 104 +- crypto/asn1/t_x509.c | 848 ++--- crypto/asn1/t_x509a.c | 93 +- crypto/asn1/tasn_dec.c | 2306 +++++++------ crypto/asn1/tasn_enc.c | 1151 ++++--- crypto/asn1/tasn_fre.c | 375 ++- crypto/asn1/tasn_new.c | 561 ++-- crypto/asn1/tasn_prn.c | 246 +- crypto/asn1/tasn_typ.c | 7 +- crypto/asn1/tasn_utl.c | 342 +- crypto/asn1/x_algor.c | 119 +- crypto/asn1/x_attrib.c | 79 +- crypto/asn1/x_bignum.c | 96 +- crypto/asn1/x_crl.c | 112 +- crypto/asn1/x_exten.c | 17 +- crypto/asn1/x_info.c | 89 +- crypto/asn1/x_long.c | 165 +- crypto/asn1/x_name.c | 355 +- crypto/asn1/x_pkey.c | 150 +- crypto/asn1/x_pubkey.c | 831 +++-- crypto/asn1/x_req.c | 48 +- crypto/asn1/x_sig.c | 16 +- crypto/asn1/x_spki.c | 27 +- crypto/asn1/x_val.c | 16 +- crypto/asn1/x_x509.c | 197 +- crypto/asn1/x_x509a.c | 153 +- crypto/bf/bf_cbc.c | 164 +- crypto/bf/bf_cfb64.c | 128 +- crypto/bf/bf_ecb.c | 62 +- crypto/bf/bf_enc.c | 434 ++- crypto/bf/bf_locl.h | 238 +- crypto/bf/bf_ofb64.c | 106 +- crypto/bf/bf_opts.c | 383 ++- crypto/bf/bf_pi.h | 800 +++-- crypto/bf/bf_skey.c | 98 +- crypto/bf/bfspeed.c | 306 +- crypto/bf/bftest.c | 920 +++--- crypto/bf/blowfish.h | 79 +- crypto/bio/b_dump.c | 203 +- crypto/bio/b_print.c | 366 +-- crypto/bio/b_sock.c | 1325 ++++---- crypto/bio/bf_buff.c | 863 ++--- crypto/bio/bf_lbuf.c | 580 ++-- crypto/bio/bf_nbio.c | 322 +- crypto/bio/bf_null.c | 208 +- crypto/bio/bio.h | 1101 +++---- crypto/bio/bio_cb.c | 147 +- crypto/bio/bio_err.c | 161 +- crypto/bio/bio_lcl.h | 42 +- crypto/bio/bio_lib.c | 844 +++-- crypto/bio/bss_acpt.c | 727 ++--- crypto/bio/bss_bio.c | 1467 ++++----- crypto/bio/bss_conn.c | 1047 +++--- crypto/bio/bss_dgram.c | 1205 ++++--- crypto/bio/bss_fd.c | 323 +- crypto/bio/bss_file.c | 659 ++-- crypto/bio/bss_log.c | 599 ++-- crypto/bio/bss_mem.c | 447 ++- crypto/bio/bss_null.c | 139 +- crypto/bio/bss_rtcp.c | 295 +- crypto/bio/bss_sock.c | 373 ++- crypto/bn/asm/x86_64-gcc.c | 1078 ++++--- crypto/bn/bn.h | 1201 +++---- crypto/bn/bn_add.c | 432 ++- crypto/bn/bn_asm.c | 1556 ++++----- crypto/bn/bn_blind.c | 474 +-- crypto/bn/bn_const.c | 921 +++--- crypto/bn/bn_ctx.c | 589 ++-- crypto/bn/bn_depr.c | 85 +- crypto/bn/bn_div.c | 1156 +++---- crypto/bn/bn_err.c | 152 +- crypto/bn/bn_exp.c | 1726 +++++----- crypto/bn/bn_exp2.c | 365 +-- crypto/bn/bn_gcd.c | 1126 +++---- crypto/bn/bn_gf2m.c | 2142 +++++++------ crypto/bn/bn_kron.c | 247 +- crypto/bn/bn_lcl.h | 578 ++-- crypto/bn/bn_lib.c | 1352 ++++---- crypto/bn/bn_mod.c | 353 +- crypto/bn/bn_mont.c | 1197 +++---- crypto/bn/bn_mpi.c | 130 +- crypto/bn/bn_mul.c | 1999 ++++++------ crypto/bn/bn_nist.c | 1437 +++++---- crypto/bn/bn_opt.c | 39 +- crypto/bn/bn_prime.c | 745 ++--- crypto/bn/bn_prime.h | 535 ++- crypto/bn/bn_print.c | 490 +-- crypto/bn/bn_rand.c | 316 +- crypto/bn/bn_recp.c | 316 +- crypto/bn/bn_shift.c | 283 +- crypto/bn/bn_sqr.c | 368 ++- crypto/bn/bn_sqrt.c | 682 ++-- crypto/bn/bn_word.c | 319 +- crypto/bn/bn_x931p.c | 334 +- crypto/bn/bnspeed.c | 245 +- crypto/bn/bntest.c | 3768 +++++++++++----------- crypto/bn/divtest.c | 37 +- crypto/bn/exp.c | 105 +- crypto/bn/expspeed.c | 396 +-- crypto/bn/exptest.c | 348 +- crypto/bn/vms-helper.c | 10 +- crypto/buffer/buf_err.c | 48 +- crypto/buffer/buf_str.c | 90 +- crypto/buffer/buffer.c | 228 +- crypto/buffer/buffer.h | 67 +- crypto/camellia/camellia.c | 2960 ++++++++--------- crypto/camellia/camellia.h | 97 +- crypto/camellia/cmll_cbc.c | 393 ++- crypto/camellia/cmll_cfb.c | 228 +- crypto/camellia/cmll_ctr.c | 162 +- crypto/camellia/cmll_ecb.c | 21 +- crypto/camellia/cmll_locl.h | 136 +- crypto/camellia/cmll_misc.c | 136 +- crypto/camellia/cmll_ofb.c | 51 +- crypto/cast/c_cfb64.c | 126 +- crypto/cast/c_ecb.c | 44 +- crypto/cast/c_enc.c | 276 +- crypto/cast/c_ofb64.c | 104 +- crypto/cast/c_skey.c | 207 +- crypto/cast/cast.h | 64 +- crypto/cast/cast_lcl.h | 240 +- crypto/cast/cast_s.h | 1075 ++++--- crypto/cast/cast_spd.c | 304 +- crypto/cast/castopts.c | 384 ++- crypto/cast/casttest.c | 312 +- crypto/cms/cms.h | 528 +-- crypto/cms/cms_asn1.c | 288 +- crypto/cms/cms_att.c | 112 +- crypto/cms/cms_cd.c | 104 +- crypto/cms/cms_dd.c | 139 +- crypto/cms/cms_enc.c | 382 +-- crypto/cms/cms_env.c | 1302 ++++---- crypto/cms/cms_err.c | 367 ++- crypto/cms/cms_ess.c | 605 ++-- crypto/cms/cms_io.c | 114 +- crypto/cms/cms_lcl.h | 618 ++-- crypto/cms/cms_lib.c | 927 +++--- crypto/cms/cms_sd.c | 1640 +++++----- crypto/cms/cms_smime.c | 1393 ++++---- crypto/comp/c_rle.c | 91 +- crypto/comp/c_zlib.c | 1315 ++++---- crypto/comp/comp.h | 89 +- crypto/comp/comp_err.c | 50 +- crypto/comp/comp_lib.c | 104 +- crypto/conf/cnf_save.c | 76 +- crypto/conf/conf.h | 235 +- crypto/conf/conf_api.c | 411 +-- crypto/conf/conf_api.h | 26 +- crypto/conf/conf_def.c | 1181 ++++--- crypto/conf/conf_def.h | 241 +- crypto/conf/conf_err.c | 112 +- crypto/conf/conf_lib.c | 550 ++-- crypto/conf/conf_mall.c | 22 +- crypto/conf/conf_mod.c | 867 +++-- crypto/conf/conf_sap.c | 68 +- crypto/conf/test.c | 63 +- crypto/constant_time_locl.h | 113 +- crypto/constant_time_test.c | 472 ++- crypto/cpt_err.c | 57 +- crypto/cryptlib.c | 769 ++--- crypto/cryptlib.h | 70 +- crypto/crypto.h | 767 ++--- crypto/cversion.c | 79 +- crypto/des/cbc3_enc.c | 80 +- crypto/des/cbc_cksm.c | 97 +- crypto/des/cbc_enc.c | 14 +- crypto/des/cfb64ede.c | 363 ++- crypto/des/cfb64enc.c | 127 +- crypto/des/cfb_enc.c | 244 +- crypto/des/des.c | 1563 +++++---- crypto/des/des.h | 308 +- crypto/des/des_enc.c | 633 ++-- crypto/des/des_lib.c | 70 +- crypto/des/des_locl.h | 710 ++-- crypto/des/des_old.c | 443 +-- crypto/des/des_old.h | 654 ++-- crypto/des/des_old2.c | 36 +- crypto/des/des_opts.c | 913 +++--- crypto/des/des_ver.h | 12 +- crypto/des/destest.c | 1699 +++++----- crypto/des/ecb3_enc.c | 53 +- crypto/des/ecb_enc.c | 42 +- crypto/des/ede_cbcm_enc.c | 250 +- crypto/des/enc_read.c | 293 +- crypto/des/enc_writ.c | 170 +- crypto/des/fcrypt.c | 265 +- crypto/des/fcrypt_b.c | 127 +- crypto/des/ncbc_enc.c | 162 +- crypto/des/ofb64ede.c | 126 +- crypto/des/ofb64enc.c | 105 +- crypto/des/ofb_enc.c | 146 +- crypto/des/pcbc_enc.c | 124 +- crypto/des/qud_cksm.c | 136 +- crypto/des/rand_key.c | 19 +- crypto/des/read2pwd.c | 54 +- crypto/des/read_pwd.c | 723 +++-- crypto/des/rpc_des.h | 61 +- crypto/des/rpc_enc.c | 72 +- crypto/des/rpw.c | 75 +- crypto/des/set_key.c | 626 ++-- crypto/des/speed.c | 349 +- crypto/des/spr.h | 321 +- crypto/des/str2key.c | 192 +- crypto/des/xcbc_enc.c | 279 +- crypto/dh/dh.h | 273 +- crypto/dh/dh_asn1.c | 34 +- crypto/dh/dh_check.c | 140 +- crypto/dh/dh_depr.c | 29 +- crypto/dh/dh_err.c | 66 +- crypto/dh/dh_gen.c | 187 +- crypto/dh/dh_key.c | 317 +- crypto/dh/dh_lib.c | 290 +- crypto/dh/dhtest.c | 303 +- crypto/dh/p1024.c | 62 +- crypto/dh/p192.c | 38 +- crypto/dh/p512.c | 48 +- crypto/dsa/dsa.h | 418 ++- crypto/dsa/dsa_asn1.c | 238 +- crypto/dsa/dsa_depr.c | 81 +- crypto/dsa/dsa_err.c | 90 +- crypto/dsa/dsa_gen.c | 538 ++-- crypto/dsa/dsa_key.c | 120 +- crypto/dsa/dsa_lib.c | 378 +-- crypto/dsa/dsa_ossl.c | 612 ++-- crypto/dsa/dsa_sign.c | 49 +- crypto/dsa/dsa_utl.c | 54 +- crypto/dsa/dsa_vrf.c | 31 +- crypto/dsa/dsagen.c | 82 +- crypto/dsa/dsatest.c | 322 +- crypto/dso/dso.h | 512 +-- crypto/dso/dso_dl.c | 480 ++- crypto/dso/dso_dlfcn.c | 529 ++- crypto/dso/dso_err.c | 145 +- crypto/dso/dso_lib.c | 687 ++-- crypto/dso/dso_null.c | 46 +- crypto/dso/dso_openssl.c | 24 +- crypto/dso/dso_vms.c | 801 +++-- crypto/dso/dso_win32.c | 1064 +++--- crypto/dyn_lck.c | 526 ++- crypto/ebcdic.c | 340 +- crypto/ebcdic.h | 12 +- crypto/ec/ec.h | 586 ++-- crypto/ec/ec2_mult.c | 621 ++-- crypto/ec/ec2_smpl.c | 1705 +++++----- crypto/ec/ec2_smpt.c | 153 +- crypto/ec/ec_asn1.c | 2358 +++++++------- crypto/ec/ec_check.c | 115 +- crypto/ec/ec_curve.c | 2087 ++++++------ crypto/ec/ec_cvt.c | 139 +- crypto/ec/ec_err.c | 366 ++- crypto/ec/ec_key.c | 683 ++-- crypto/ec/ec_lcl.h | 540 ++-- crypto/ec/ec_lib.c | 1875 ++++++----- crypto/ec/ec_mult.c | 1555 +++++---- crypto/ec/ec_print.c | 216 +- crypto/ec/ecp_mont.c | 455 ++- crypto/ec/ecp_nist.c | 287 +- crypto/ec/ecp_smpl.c | 3203 +++++++++--------- crypto/ec/ectest.c | 2757 +++++++++------- crypto/ecdh/ecdh.h | 54 +- crypto/ecdh/ecdhtest.c | 568 ++-- crypto/ecdh/ech_err.c | 46 +- crypto/ecdh/ech_key.c | 17 +- crypto/ecdh/ech_lib.c | 240 +- crypto/ecdh/ech_locl.h | 47 +- crypto/ecdh/ech_ossl.c | 229 +- crypto/ecdsa/ecdsa.h | 120 +- crypto/ecdsa/ecdsatest.c | 906 +++--- crypto/ecdsa/ecs_asn1.c | 6 +- crypto/ecdsa/ecs_err.c | 60 +- crypto/ecdsa/ecs_lib.c | 257 +- crypto/ecdsa/ecs_locl.h | 54 +- crypto/ecdsa/ecs_ossl.c | 719 ++--- crypto/ecdsa/ecs_sign.c | 62 +- crypto/ecdsa/ecs_vrf.c | 69 +- crypto/engine/eng_all.c | 112 +- crypto/engine/eng_cnf.c | 331 +- crypto/engine/eng_cryptodev.c | 1667 +++++----- crypto/engine/eng_ctrl.c | 620 ++-- crypto/engine/eng_dyn.c | 922 +++--- crypto/engine/eng_err.c | 198 +- crypto/engine/eng_fat.c | 146 +- crypto/engine/eng_init.c | 171 +- crypto/engine/eng_int.h | 209 +- crypto/engine/eng_lib.c | 421 +-- crypto/engine/eng_list.c | 614 ++-- crypto/engine/eng_openssl.c | 491 +-- crypto/engine/eng_padlock.c | 1854 ++++++----- crypto/engine/eng_pkey.c | 226 +- crypto/engine/eng_table.c | 440 +-- crypto/engine/engine.h | 1119 ++++--- crypto/engine/enginetest.c | 406 ++- crypto/engine/tb_cipher.c | 124 +- crypto/engine/tb_dh.c | 84 +- crypto/engine/tb_digest.c | 124 +- crypto/engine/tb_dsa.c | 84 +- crypto/engine/tb_ecdh.c | 84 +- crypto/engine/tb_ecdsa.c | 84 +- crypto/engine/tb_rand.c | 84 +- crypto/engine/tb_rsa.c | 84 +- crypto/engine/tb_store.c | 84 +- crypto/err/err.c | 504 +-- crypto/err/err.h | 427 +-- crypto/err/err_all.c | 140 +- crypto/err/err_bio.c | 27 +- crypto/err/err_def.c | 798 ++--- crypto/err/err_prn.c | 181 +- crypto/err/err_str.c | 310 +- crypto/evp/bio_b64.c | 1006 +++--- crypto/evp/bio_enc.c | 674 ++-- crypto/evp/bio_md.c | 327 +- crypto/evp/bio_ok.c | 969 +++--- crypto/evp/c_all.c | 44 +- crypto/evp/c_allc.c | 274 +- crypto/evp/c_alld.c | 72 +- crypto/evp/dig_eng.c | 120 +- crypto/evp/digest.c | 562 ++-- crypto/evp/e_aes.c | 96 +- crypto/evp/e_bf.c | 47 +- crypto/evp/e_camellia.c | 100 +- crypto/evp/e_cast.c | 51 +- crypto/evp/e_des.c | 181 +- crypto/evp/e_des3.c | 311 +- crypto/evp/e_dsa.c | 24 +- crypto/evp/e_idea.c | 87 +- crypto/evp/e_null.c | 72 +- crypto/evp/e_old.c | 129 +- crypto/evp/e_rc2.c | 292 +- crypto/evp/e_rc4.c | 122 +- crypto/evp/e_rc5.c | 102 +- crypto/evp/e_seed.c | 27 +- crypto/evp/e_xcbc_d.c | 99 +- crypto/evp/enc_min.c | 557 ++-- crypto/evp/encode.c | 685 ++-- crypto/evp/evp.h | 1504 +++++---- crypto/evp/evp_acnf.c | 22 +- crypto/evp/evp_cnf.c | 95 +- crypto/evp/evp_enc.c | 646 ++-- crypto/evp/evp_err.c | 236 +- crypto/evp/evp_key.c | 207 +- crypto/evp/evp_lib.c | 317 +- crypto/evp/evp_locl.h | 243 +- crypto/evp/evp_pbe.c | 163 +- crypto/evp/evp_pkey.c | 1252 ++++---- crypto/evp/evp_test.c | 538 ++-- crypto/evp/m_dss.c | 65 +- crypto/evp/m_dss1.c | 79 +- crypto/evp/m_ecdsa.c | 65 +- crypto/evp/m_md2.c | 77 +- crypto/evp/m_md4.c | 77 +- crypto/evp/m_md5.c | 79 +- crypto/evp/m_mdc2.c | 73 +- crypto/evp/m_null.c | 65 +- crypto/evp/m_ripemd.c | 77 +- crypto/evp/m_sha.c | 75 +- crypto/evp/m_sha1.c | 279 +- crypto/evp/names.c | 112 +- crypto/evp/openbsd_hw.c | 527 ++- crypto/evp/p5_crpt.c | 162 +- crypto/evp/p5_crpt2.c | 326 +- crypto/evp/p_dec.c | 40 +- crypto/evp/p_enc.c | 41 +- crypto/evp/p_lib.c | 619 ++-- crypto/evp/p_open.c | 109 +- crypto/evp/p_seal.c | 85 +- crypto/evp/p_sign.c | 116 +- crypto/evp/p_verify.c | 97 +- crypto/ex_data.c | 845 ++--- crypto/fips_err.c | 2 +- crypto/fips_err.h | 129 +- crypto/hmac/hmac.c | 202 +- crypto/hmac/hmac.h | 57 +- crypto/hmac/hmactest.c | 188 +- crypto/idea/i_cbc.c | 209 +- crypto/idea/i_cfb64.c | 127 +- crypto/idea/i_ecb.c | 51 +- crypto/idea/i_ofb64.c | 105 +- crypto/idea/i_skey.c | 196 +- crypto/idea/idea.h | 56 +- crypto/idea/idea_lcl.h | 247 +- crypto/idea/idea_spd.c | 336 +- crypto/idea/ideatest.c | 313 +- crypto/jpake/jpake.c | 335 +- crypto/jpake/jpake.h | 93 +- crypto/jpake/jpake_err.c | 67 +- crypto/jpake/jpaketest.c | 127 +- crypto/krb5/krb5_asn.c | 95 +- crypto/krb5/krb5_asn.h | 242 +- crypto/lhash/lh_stats.c | 322 +- crypto/lhash/lh_test.c | 54 +- crypto/lhash/lhash.c | 670 ++-- crypto/lhash/lhash.h | 213 +- crypto/md2/md2.c | 105 +- crypto/md2/md2.h | 47 +- crypto/md2/md2_dgst.c | 305 +- crypto/md2/md2_one.c | 64 +- crypto/md2/md2test.c | 135 +- crypto/md32_common.h | 442 ++- crypto/md4/md4.c | 106 +- crypto/md4/md4.h | 67 +- crypto/md4/md4_dgst.c | 230 +- crypto/md4/md4_locl.h | 73 +- crypto/md4/md4_one.c | 61 +- crypto/md4/md4test.c | 119 +- crypto/md5/md5.c | 106 +- crypto/md5/md5.h | 67 +- crypto/md5/md5_dgst.c | 264 +- crypto/md5/md5_locl.h | 87 +- crypto/md5/md5_one.c | 61 +- crypto/md5/md5test.c | 128 +- crypto/mdc2/mdc2.h | 49 +- crypto/mdc2/mdc2_one.c | 36 +- crypto/mdc2/mdc2dgst.c | 243 +- crypto/mdc2/mdc2test.c | 137 +- crypto/mem.c | 693 ++-- crypto/mem_clr.c | 32 +- crypto/mem_dbg.c | 1228 ++++--- crypto/o_dir.c | 25 +- crypto/o_dir.h | 20 +- crypto/o_dir_test.c | 34 +- crypto/o_init.c | 69 +- crypto/o_str.c | 75 +- crypto/o_str.h | 13 +- crypto/o_time.c | 289 +- crypto/o_time.h | 11 +- crypto/objects/o_names.c | 610 ++-- crypto/objects/obj_dat.c | 1281 ++++---- crypto/objects/obj_err.c | 54 +- crypto/objects/obj_lib.c | 127 +- crypto/objects/obj_mac.h | 7139 ++++++++++++++++++++--------------------- crypto/objects/objects.h | 1724 +++++----- crypto/ocsp/ocsp.h | 579 ++-- crypto/ocsp/ocsp_asn.c | 97 +- crypto/ocsp/ocsp_cl.c | 539 ++-- crypto/ocsp/ocsp_err.c | 141 +- crypto/ocsp/ocsp_ext.c | 809 ++--- crypto/ocsp/ocsp_ht.c | 715 ++--- crypto/ocsp/ocsp_lib.c | 397 +-- crypto/ocsp/ocsp_prn.c | 428 +-- crypto/ocsp/ocsp_srv.c | 365 +-- crypto/ocsp/ocsp_vfy.c | 727 +++-- crypto/opensslv.h | 50 +- crypto/ossl_typ.h | 94 +- crypto/pem/pem.h | 1213 ++++--- crypto/pem/pem2.h | 2 +- crypto/pem/pem_all.c | 468 ++- crypto/pem/pem_err.c | 123 +- crypto/pem/pem_info.c | 586 ++-- crypto/pem/pem_lib.c | 1314 ++++---- crypto/pem/pem_oth.c | 42 +- crypto/pem/pem_pk8.c | 259 +- crypto/pem/pem_pkey.c | 168 +- crypto/pem/pem_seal.c | 250 +- crypto/pem/pem_sign.c | 71 +- crypto/pem/pem_x509.c | 8 +- crypto/pem/pem_xaux.c | 10 +- crypto/pkcs12/p12_add.c | 245 +- crypto/pkcs12/p12_asn.c | 56 +- crypto/pkcs12/p12_attr.c | 114 +- crypto/pkcs12/p12_crpt.c | 110 +- crypto/pkcs12/p12_crt.c | 519 ++- crypto/pkcs12/p12_decr.c | 207 +- crypto/pkcs12/p12_init.c | 56 +- crypto/pkcs12/p12_key.c | 256 +- crypto/pkcs12/p12_kiss.c | 427 +-- crypto/pkcs12/p12_mutl.c | 207 +- crypto/pkcs12/p12_npas.c | 268 +- crypto/pkcs12/p12_p8d.c | 16 +- crypto/pkcs12/p12_p8e.c | 66 +- crypto/pkcs12/p12_utl.c | 107 +- crypto/pkcs12/pk12err.c | 145 +- crypto/pkcs12/pkcs12.h | 352 +- crypto/pkcs7/pk7_asn1.c | 147 +- crypto/pkcs7/pk7_attr.c | 134 +- crypto/pkcs7/pk7_dgst.c | 13 +- crypto/pkcs7/pk7_doit.c | 2048 ++++++------ crypto/pkcs7/pk7_enc.c | 21 +- crypto/pkcs7/pk7_lib.c | 970 +++--- crypto/pkcs7/pk7_mime.c | 90 +- crypto/pkcs7/pk7_smime.c | 847 +++-- crypto/pkcs7/pkcs7.h | 570 ++-- crypto/pkcs7/pkcs7err.c | 199 +- crypto/pqueue/pq_compat.h | 152 +- crypto/pqueue/pq_test.c | 53 +- crypto/pqueue/pqueue.c | 324 +- crypto/pqueue/pqueue.h | 37 +- crypto/rand/md_rand.c | 807 +++-- crypto/rand/rand.h | 143 +- crypto/rand/rand_egd.c | 356 +- crypto/rand/rand_eng.c | 143 +- crypto/rand/rand_err.c | 79 +- crypto/rand/rand_lcl.h | 109 +- crypto/rand/rand_lib.c | 285 +- crypto/rand/rand_nw.c | 110 +- crypto/rand/rand_os2.c | 74 +- crypto/rand/rand_unix.c | 384 +-- crypto/rand/rand_vms.c | 147 +- crypto/rand/rand_win.c | 1169 ++++--- crypto/rand/randfile.c | 385 +-- crypto/rand/randtest.c | 278 +- crypto/rc2/rc2.h | 64 +- crypto/rc2/rc2_cbc.c | 334 +- crypto/rc2/rc2_ecb.c | 45 +- crypto/rc2/rc2_locl.h | 153 +- crypto/rc2/rc2_skey.c | 181 +- crypto/rc2/rc2cfb64.c | 127 +- crypto/rc2/rc2ofb64.c | 105 +- crypto/rc2/rc2speed.c | 305 +- crypto/rc2/rc2test.c | 366 +-- crypto/rc2/tab.c | 160 +- crypto/rc4/rc4.c | 232 +- crypto/rc4/rc4.h | 38 +- crypto/rc4/rc4_enc.c | 488 +-- crypto/rc4/rc4_fblk.c | 24 +- crypto/rc4/rc4_locl.h | 6 +- crypto/rc4/rc4_skey.c | 160 +- crypto/rc4/rc4speed.c | 284 +- crypto/rc4/rc4test.c | 319 +- crypto/rc5/rc5.h | 86 +- crypto/rc5/rc5_ecb.c | 45 +- crypto/rc5/rc5_enc.c | 292 +- crypto/rc5/rc5_locl.h | 221 +- crypto/rc5/rc5_skey.c | 122 +- crypto/rc5/rc5cfb64.c | 127 +- crypto/rc5/rc5ofb64.c | 105 +- crypto/rc5/rc5speed.c | 306 +- crypto/rc5/rc5test.c | 585 ++-- crypto/ripemd/ripemd.h | 66 +- crypto/ripemd/rmd160.c | 106 +- crypto/ripemd/rmd_dgst.c | 477 +-- crypto/ripemd/rmd_locl.h | 75 +- crypto/ripemd/rmd_one.c | 39 +- crypto/ripemd/rmdconst.h | 13 +- crypto/ripemd/rmdtest.c | 138 +- crypto/rsa/rsa.h | 682 ++-- crypto/rsa/rsa_asn1.c | 79 +- crypto/rsa/rsa_chk.c | 281 +- crypto/rsa/rsa_depr.c | 64 +- crypto/rsa/rsa_eay.c | 1519 +++++---- crypto/rsa/rsa_eng.c | 456 +-- crypto/rsa/rsa_err.c | 227 +- crypto/rsa/rsa_gen.c | 328 +- crypto/rsa/rsa_lib.c | 288 +- crypto/rsa/rsa_none.c | 64 +- crypto/rsa/rsa_null.c | 122 +- crypto/rsa/rsa_oaep.c | 453 ++- crypto/rsa/rsa_pk1.c | 410 +-- crypto/rsa/rsa_pss.c | 347 +- crypto/rsa/rsa_saos.c | 158 +- crypto/rsa/rsa_sign.c | 394 ++- crypto/rsa/rsa_ssl.c | 161 +- crypto/rsa/rsa_test.c | 423 ++- crypto/rsa/rsa_x931.c | 198 +- crypto/rsa/rsa_x931g.c | 377 ++- crypto/seed/seed.c | 1042 ++++-- crypto/seed/seed.h | 73 +- crypto/seed/seed_cbc.c | 134 +- crypto/seed/seed_cfb.c | 68 +- crypto/seed/seed_ecb.c | 17 +- crypto/seed/seed_locl.h | 33 +- crypto/seed/seed_ofb.c | 39 +- crypto/sha/sha.c | 106 +- crypto/sha/sha.h | 187 +- crypto/sha/sha1.c | 106 +- crypto/sha/sha1_one.c | 35 +- crypto/sha/sha1dgst.c | 30 +- crypto/sha/sha1test.c | 206 +- crypto/sha/sha256.c | 619 ++-- crypto/sha/sha256t.c | 241 +- crypto/sha/sha512.c | 1011 +++--- crypto/sha/sha512t.c | 312 +- crypto/sha/sha_dgst.c | 25 +- crypto/sha/sha_locl.h | 711 ++-- crypto/sha/sha_one.c | 35 +- crypto/sha/shatest.c | 206 +- crypto/stack/safestack.h | 3836 +++++++++++----------- crypto/stack/stack.c | 541 ++-- crypto/stack/stack.h | 70 +- crypto/store/store.h | 819 ++--- crypto/store/str_err.c | 321 +- crypto/store/str_lib.c | 3083 +++++++++--------- crypto/store/str_locl.h | 113 +- crypto/store/str_mem.c | 565 ++-- crypto/store/str_meth.c | 378 ++- crypto/symhacks.h | 632 ++-- crypto/threads/mttest.c | 1863 +++++------ crypto/threads/th-lock.c | 458 ++- crypto/tmdiff.c | 233 +- crypto/tmdiff.h | 46 +- crypto/txt_db/txt_db.c | 589 ++-- crypto/txt_db/txt_db.h | 71 +- crypto/ui/ui.h | 315 +- crypto/ui/ui_compat.c | 20 +- crypto/ui/ui_compat.h | 33 +- crypto/ui/ui_err.c | 75 +- crypto/ui/ui_lib.c | 1448 ++++----- crypto/ui/ui_locl.h | 182 +- crypto/ui/ui_openssl.c | 756 ++--- crypto/ui/ui_util.c | 62 +- crypto/uid.c | 35 +- crypto/x509/by_dir.c | 547 ++-- crypto/x509/by_file.c | 405 ++- crypto/x509/x509.h | 1895 +++++------ crypto/x509/x509_att.c | 463 +-- crypto/x509/x509_cmp.c | 601 ++-- crypto/x509/x509_d2.c | 82 +- crypto/x509/x509_def.c | 39 +- crypto/x509/x509_err.c | 188 +- crypto/x509/x509_ext.c | 163 +- crypto/x509/x509_lu.c | 899 +++--- crypto/x509/x509_obj.c | 278 +- crypto/x509/x509_r2x.c | 89 +- crypto/x509/x509_req.c | 381 +-- crypto/x509/x509_set.c | 147 +- crypto/x509/x509_trs.c | 321 +- crypto/x509/x509_txt.c | 212 +- crypto/x509/x509_v3.c | 356 +- crypto/x509/x509_vfy.c | 2591 ++++++++------- crypto/x509/x509_vfy.h | 680 ++-- crypto/x509/x509_vpm.c | 551 ++-- crypto/x509/x509cset.c | 179 +- crypto/x509/x509name.c | 576 ++-- crypto/x509/x509rset.c | 40 +- crypto/x509/x509spki.c | 92 +- crypto/x509/x509type.c | 112 +- crypto/x509/x_all.c | 597 ++-- crypto/x509v3/ext_dat.h | 91 +- crypto/x509v3/pcy_cache.c | 361 +-- crypto/x509v3/pcy_data.c | 116 +- crypto/x509v3/pcy_int.h | 198 +- crypto/x509v3/pcy_lib.c | 172 +- crypto/x509v3/pcy_map.c | 243 +- crypto/x509v3/pcy_node.c | 160 +- crypto/x509v3/pcy_tree.c | 1084 +++---- crypto/x509v3/tabtest.c | 48 +- crypto/x509v3/v3_addr.c | 1860 +++++------ crypto/x509v3/v3_akey.c | 252 +- crypto/x509v3/v3_akeya.c | 13 +- crypto/x509v3/v3_alt.c | 926 +++--- crypto/x509v3/v3_asid.c | 1198 +++---- crypto/x509v3/v3_bcons.c | 100 +- crypto/x509v3/v3_bitst.c | 137 +- crypto/x509v3/v3_conf.c | 740 ++--- crypto/x509v3/v3_cpols.c | 664 ++-- crypto/x509v3/v3_crld.c | 151 +- crypto/x509v3/v3_enum.c | 59 +- crypto/x509v3/v3_extku.c | 125 +- crypto/x509v3/v3_genn.c | 44 +- crypto/x509v3/v3_ia5.c | 93 +- crypto/x509v3/v3_info.c | 237 +- crypto/x509v3/v3_int.c | 57 +- crypto/x509v3/v3_lib.c | 367 ++- crypto/x509v3/v3_ncons.c | 252 +- crypto/x509v3/v3_ocsp.c | 322 +- crypto/x509v3/v3_pci.c | 523 ++- crypto/x509v3/v3_pcia.c | 17 +- crypto/x509v3/v3_pcons.c | 113 +- crypto/x509v3/v3_pku.c | 56 +- crypto/x509v3/v3_pmaps.c | 142 +- crypto/x509v3/v3_prn.c | 311 +- crypto/x509v3/v3_purp.c | 945 +++--- crypto/x509v3/v3_skey.c | 144 +- crypto/x509v3/v3_sxnet.c | 271 +- crypto/x509v3/v3_utl.c | 1321 ++++---- crypto/x509v3/v3conf.c | 114 +- crypto/x509v3/v3err.c | 310 +- crypto/x509v3/v3prin.c | 70 +- crypto/x509v3/x509v3.h | 957 +++--- 738 files changed, 142961 insertions(+), 141338 deletions(-) (limited to 'crypto') diff --git a/crypto/LPdir_nyi.c b/crypto/LPdir_nyi.c index 6c1a50e6a8..283d5b0636 100644 --- a/crypto/LPdir_nyi.c +++ b/crypto/LPdir_nyi.c @@ -1,4 +1,6 @@ -/* $LP: LPlib/source/LPdir_win.c,v 1.1 2004/06/14 10:07:56 _cvs_levitte Exp $ */ +/* + * $LP: LPlib/source/LPdir_win.c,v 1.1 2004/06/14 10:07:56 _cvs_levitte Exp $ + */ /* * Copyright (c) 2004, Richard Levitte * All rights reserved. @@ -26,17 +28,20 @@ */ #ifndef LPDIR_H -#include "LPdir.h" +# include "LPdir.h" #endif -struct LP_dir_context_st { void *dummy; }; +struct LP_dir_context_st { + void *dummy; +}; const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) - { - errno = EINVAL; - return 0; - } +{ + errno = EINVAL; + return 0; +} + int LP_find_file_end(LP_DIR_CTX **ctx) - { - errno = EINVAL; - return 0; - } +{ + errno = EINVAL; + return 0; +} diff --git a/crypto/LPdir_unix.c b/crypto/LPdir_unix.c index b004cd99e8..bead6abd71 100644 --- a/crypto/LPdir_unix.c +++ b/crypto/LPdir_unix.c @@ -1,4 +1,7 @@ -/* $LP: LPlib/source/LPdir_unix.c,v 1.11 2004/09/23 22:07:22 _cvs_levitte Exp $ */ +/* + * $LP: LPlib/source/LPdir_unix.c,v 1.11 2004/09/23 22:07:22 _cvs_levitte Exp + * $ + */ /* * Copyright (c) 2004, Richard Levitte * All rights reserved. @@ -11,7 +14,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -33,95 +36,91 @@ #include #include #ifndef LPDIR_H -#include "LPdir.h" +# include "LPdir.h" #endif -/* The POSIXly macro for the maximum number of characters in a file path - is NAME_MAX. However, some operating systems use PATH_MAX instead. - Therefore, it seems natural to first check for PATH_MAX and use that, - and if it doesn't exist, use NAME_MAX. */ +/* + * The POSIXly macro for the maximum number of characters in a file path is + * NAME_MAX. However, some operating systems use PATH_MAX instead. + * Therefore, it seems natural to first check for PATH_MAX and use that, and + * if it doesn't exist, use NAME_MAX. + */ #if defined(PATH_MAX) # define LP_ENTRY_SIZE PATH_MAX #elif defined(NAME_MAX) # define LP_ENTRY_SIZE NAME_MAX #endif -/* Of course, there's the possibility that neither PATH_MAX nor NAME_MAX - exist. It's also possible that NAME_MAX exists but is define to a - very small value (HP-UX offers 14), so we need to check if we got a - result, and if it meets a minimum standard, and create or change it - if not. */ +/* + * Of course, there's the possibility that neither PATH_MAX nor NAME_MAX + * exist. It's also possible that NAME_MAX exists but is define to a very + * small value (HP-UX offers 14), so we need to check if we got a result, and + * if it meets a minimum standard, and create or change it if not. + */ #if !defined(LP_ENTRY_SIZE) || LP_ENTRY_SIZE<255 # undef LP_ENTRY_SIZE # define LP_ENTRY_SIZE 255 #endif -struct LP_dir_context_st -{ - DIR *dir; - char entry_name[LP_ENTRY_SIZE+1]; +struct LP_dir_context_st { + DIR *dir; + char entry_name[LP_ENTRY_SIZE + 1]; }; const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) { - struct dirent *direntry = NULL; + struct dirent *direntry = NULL; - if (ctx == NULL || directory == NULL) - { - errno = EINVAL; - return 0; + if (ctx == NULL || directory == NULL) { + errno = EINVAL; + return 0; } - errno = 0; - if (*ctx == NULL) - { - *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX)); - if (*ctx == NULL) - { - errno = ENOMEM; - return 0; - } - memset(*ctx, '\0', sizeof(LP_DIR_CTX)); + errno = 0; + if (*ctx == NULL) { + *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX)); + if (*ctx == NULL) { + errno = ENOMEM; + return 0; + } + memset(*ctx, '\0', sizeof(LP_DIR_CTX)); - (*ctx)->dir = opendir(directory); - if ((*ctx)->dir == NULL) - { - int save_errno = errno; /* Probably not needed, but I'm paranoid */ - free(*ctx); - *ctx = NULL; - errno = save_errno; - return 0; - } + (*ctx)->dir = opendir(directory); + if ((*ctx)->dir == NULL) { + int save_errno = errno; /* Probably not needed, but I'm paranoid */ + free(*ctx); + *ctx = NULL; + errno = save_errno; + return 0; + } } - direntry = readdir((*ctx)->dir); - if (direntry == NULL) - { - return 0; + direntry = readdir((*ctx)->dir); + if (direntry == NULL) { + return 0; } - strncpy((*ctx)->entry_name, direntry->d_name, sizeof((*ctx)->entry_name) - 1); - (*ctx)->entry_name[sizeof((*ctx)->entry_name) - 1] = '\0'; - return (*ctx)->entry_name; + strncpy((*ctx)->entry_name, direntry->d_name, + sizeof((*ctx)->entry_name) - 1); + (*ctx)->entry_name[sizeof((*ctx)->entry_name) - 1] = '\0'; + return (*ctx)->entry_name; } int LP_find_file_end(LP_DIR_CTX **ctx) { - if (ctx != NULL && *ctx != NULL) - { - int ret = closedir((*ctx)->dir); + if (ctx != NULL && *ctx != NULL) { + int ret = closedir((*ctx)->dir); - free(*ctx); - switch (ret) - { - case 0: - return 1; - case -1: - return 0; - default: - break; - } + free(*ctx); + switch (ret) { + case 0: + return 1; + case -1: + return 0; + default: + break; + } } - errno = EINVAL; - return 0; + errno = EINVAL; + return 0; } diff --git a/crypto/LPdir_vms.c b/crypto/LPdir_vms.c index d3ea7ff10a..b3b6b07463 100644 --- a/crypto/LPdir_vms.c +++ b/crypto/LPdir_vms.c @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -37,168 +37,152 @@ #include #include #ifndef LPDIR_H -#include "LPdir.h" +# include "LPdir.h" #endif /* Because some compiler options hide this macor */ #ifndef EVMSERR -#define EVMSERR 65535 /* error for non-translatable VMS errors */ +# define EVMSERR 65535 /* error for non-translatable VMS errors */ #endif -struct LP_dir_context_st -{ - unsigned long VMS_context; +struct LP_dir_context_st { + unsigned long VMS_context; #ifdef NAML$C_MAXRSS - char filespec[NAML$C_MAXRSS+1]; - char result[NAML$C_MAXRSS+1]; + char filespec[NAML$C_MAXRSS + 1]; + char result[NAML$C_MAXRSS + 1]; #else - char filespec[256]; - char result[256]; + char filespec[256]; + char result[256]; #endif - struct dsc$descriptor_d filespec_dsc; - struct dsc$descriptor_d result_dsc; + struct dsc$descriptor_d filespec_dsc; + struct dsc$descriptor_d result_dsc; }; const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) { - int status; - char *p, *r; - size_t l; - unsigned long flags = 0; + int status; + char *p, *r; + size_t l; + unsigned long flags = 0; #ifdef NAML$C_MAXRSS - flags |= LIB$M_FIL_LONG_NAMES; + flags |= LIB$M_FIL_LONG_NAMES; #endif - if (ctx == NULL || directory == NULL) - { - errno = EINVAL; - return 0; + if (ctx == NULL || directory == NULL) { + errno = EINVAL; + return 0; } - errno = 0; - if (*ctx == NULL) - { - size_t filespeclen = strlen(directory); - char *filespec = NULL; - - if (filespeclen == 0) - { - errno = ENOENT; - return 0; - } - - /* MUST be a VMS directory specification! Let's estimate if it is. */ - if (directory[filespeclen-1] != ']' - && directory[filespeclen-1] != '>' - && directory[filespeclen-1] != ':') - { - errno = EINVAL; - return 0; - } - - filespeclen += 4; /* "*.*;" */ - - if (filespeclen > + errno = 0; + if (*ctx == NULL) { + size_t filespeclen = strlen(directory); + char *filespec = NULL; + + if (filespeclen == 0) { + errno = ENOENT; + return 0; + } + + /* MUST be a VMS directory specification! Let's estimate if it is. */ + if (directory[filespeclen - 1] != ']' + && directory[filespeclen - 1] != '>' + && directory[filespeclen - 1] != ':') { + errno = EINVAL; + return 0; + } + + filespeclen += 4; /* "*.*;" */ + + if (filespeclen > #ifdef NAML$C_MAXRSS - NAML$C_MAXRSS + NAML$C_MAXRSS #else - 255 + 255 #endif - ) - { - errno = ENAMETOOLONG; - return 0; - } - - *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX)); - if (*ctx == NULL) - { - errno = ENOMEM; - return 0; - } - memset(*ctx, '\0', sizeof(LP_DIR_CTX)); - - strcpy((*ctx)->filespec,directory); - strcat((*ctx)->filespec,"*.*;"); - (*ctx)->filespec_dsc.dsc$w_length = filespeclen; - (*ctx)->filespec_dsc.dsc$b_dtype = DSC$K_DTYPE_T; - (*ctx)->filespec_dsc.dsc$b_class = DSC$K_CLASS_S; - (*ctx)->filespec_dsc.dsc$a_pointer = (*ctx)->filespec; - (*ctx)->result_dsc.dsc$w_length = 0; - (*ctx)->result_dsc.dsc$b_dtype = DSC$K_DTYPE_T; - (*ctx)->result_dsc.dsc$b_class = DSC$K_CLASS_D; - (*ctx)->result_dsc.dsc$a_pointer = 0; + ) { + errno = ENAMETOOLONG; + return 0; + } + + *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX)); + if (*ctx == NULL) { + errno = ENOMEM; + return 0; + } + memset(*ctx, '\0', sizeof(LP_DIR_CTX)); + + strcpy((*ctx)->filespec, directory); + strcat((*ctx)->filespec, "*.*;"); + (*ctx)->filespec_dsc.dsc$w_length = filespeclen; + (*ctx)->filespec_dsc.dsc$b_dtype = DSC$K_DTYPE_T; + (*ctx)->filespec_dsc.dsc$b_class = DSC$K_CLASS_S; + (*ctx)->filespec_dsc.dsc$a_pointer = (*ctx)->filespec; + (*ctx)->result_dsc.dsc$w_length = 0; + (*ctx)->result_dsc.dsc$b_dtype = DSC$K_DTYPE_T; + (*ctx)->result_dsc.dsc$b_class = DSC$K_CLASS_D; + (*ctx)->result_dsc.dsc$a_pointer = 0; } - (*ctx)->result_dsc.dsc$w_length = 0; - (*ctx)->result_dsc.dsc$b_dtype = DSC$K_DTYPE_T; - (*ctx)->result_dsc.dsc$b_class = DSC$K_CLASS_D; - (*ctx)->result_dsc.dsc$a_pointer = 0; + (*ctx)->result_dsc.dsc$w_length = 0; + (*ctx)->result_dsc.dsc$b_dtype = DSC$K_DTYPE_T; + (*ctx)->result_dsc.dsc$b_class = DSC$K_CLASS_D; + (*ctx)->result_dsc.dsc$a_pointer = 0; - status = lib$find_file(&(*ctx)->filespec_dsc, &(*ctx)->result_dsc, - &(*ctx)->VMS_context, 0, 0, 0, &flags); + status = lib$find_file(&(*ctx)->filespec_dsc, &(*ctx)->result_dsc, + &(*ctx)->VMS_context, 0, 0, 0, &flags); - if (status == RMS$_NMF) - { - errno = 0; - vaxc$errno = status; - return NULL; + if (status == RMS$_NMF) { + errno = 0; + vaxc$errno = status; + return NULL; } - if(!$VMS_STATUS_SUCCESS(status)) - { - errno = EVMSERR; - vaxc$errno = status; - return NULL; + if (!$VMS_STATUS_SUCCESS(status)) { + errno = EVMSERR; + vaxc$errno = status; + return NULL; } - /* Quick, cheap and dirty way to discard any device and directory, - since we only want file names */ - l = (*ctx)->result_dsc.dsc$w_length; - p = (*ctx)->result_dsc.dsc$a_pointer; - r = p; - for (; *p; p++) - { - if (*p == '^' && p[1] != '\0') /* Take care of ODS-5 escapes */ - { - p++; - } - else if (*p == ':' || *p == '>' || *p == ']') - { - l -= p + 1 - r; - r = p + 1; - } - else if (*p == ';') - { - l = p - r; - break; - } + /* + * Quick, cheap and dirty way to discard any device and directory, since + * we only want file names + */ + l = (*ctx)->result_dsc.dsc$w_length; + p = (*ctx)->result_dsc.dsc$a_pointer; + r = p; + for (; *p; p++) { + if (*p == '^' && p[1] != '\0') { /* Take care of ODS-5 escapes */ + p++; + } else if (*p == ':' || *p == '>' || *p == ']') { + l -= p + 1 - r; + r = p + 1; + } else if (*p == ';') { + l = p - r; + break; + } } - strncpy((*ctx)->result, r, l); - (*ctx)->result[l] = '\0'; - str$free1_dx(&(*ctx)->result_dsc); + strncpy((*ctx)->result, r, l); + (*ctx)->result[l] = '\0'; + str$free1_dx(&(*ctx)->result_dsc); - return (*ctx)->result; + return (*ctx)->result; } int LP_find_file_end(LP_DIR_CTX **ctx) { - if (ctx != NULL && *ctx != NULL) - { - int status = lib$find_file_end(&(*ctx)->VMS_context); - - free(*ctx); - - if(!$VMS_STATUS_SUCCESS(status)) - { - errno = EVMSERR; - vaxc$errno = status; - return 0; - } - return 1; + if (ctx != NULL && *ctx != NULL) { + int status = lib$find_file_end(&(*ctx)->VMS_context); + + free(*ctx); + + if (!$VMS_STATUS_SUCCESS(status)) { + errno = EVMSERR; + vaxc$errno = status; + return 0; + } + return 1; } - errno = EINVAL; - return 0; + errno = EINVAL; + return 0; } - diff --git a/crypto/LPdir_win.c b/crypto/LPdir_win.c index a202bcddf5..a2f15a7e98 100644 --- a/crypto/LPdir_win.c +++ b/crypto/LPdir_win.c @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -26,13 +26,14 @@ #include #include #ifndef LPDIR_H -#include "LPdir.h" +# include "LPdir.h" #endif -/* We're most likely overcautious here, but let's reserve for - broken WinCE headers and explicitly opt for UNICODE call. - Keep in mind that our WinCE builds are compiled with -DUNICODE - [as well as -D_UNICODE]. */ +/* + * We're most likely overcautious here, but let's reserve for broken WinCE + * headers and explicitly opt for UNICODE call. Keep in mind that our WinCE + * builds are compiled with -DUNICODE [as well as -D_UNICODE]. + */ #if defined(LP_SYS_WINCE) && !defined(FindFirstFile) # define FindFirstFile FindFirstFileW #endif @@ -41,149 +42,131 @@ #endif #ifndef NAME_MAX -#define NAME_MAX 255 +# define NAME_MAX 255 #endif -struct LP_dir_context_st -{ - WIN32_FIND_DATA ctx; - HANDLE handle; - char entry_name[NAME_MAX+1]; +struct LP_dir_context_st { + WIN32_FIND_DATA ctx; + HANDLE handle; + char entry_name[NAME_MAX + 1]; }; const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) { - struct dirent *direntry = NULL; + struct dirent *direntry = NULL; - if (ctx == NULL || directory == NULL) - { - errno = EINVAL; - return 0; + if (ctx == NULL || directory == NULL) { + errno = EINVAL; + return 0; } - errno = 0; - if (*ctx == NULL) - { - const char *extdir = directory; - char *extdirbuf = NULL; - size_t dirlen = strlen (directory); - - if (dirlen == 0) - { - errno = ENOENT; - return 0; - } - - *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX)); - if (*ctx == NULL) - { - errno = ENOMEM; - return 0; - } - memset(*ctx, '\0', sizeof(LP_DIR_CTX)); - - if (directory[dirlen-1] != '*') - { - extdirbuf = (char *)malloc(dirlen + 3); - if (extdirbuf == NULL) - { - free(*ctx); - *ctx = NULL; - errno = ENOMEM; - return 0; - } - if (directory[dirlen-1] != '/' && directory[dirlen-1] != '\\') - extdir = strcat(strcpy (extdirbuf,directory),"/*"); - else - extdir = strcat(strcpy (extdirbuf,directory),"*"); - } - - if (sizeof(TCHAR) != sizeof(char)) - { - TCHAR *wdir = NULL; - /* len_0 denotes string length *with* trailing 0 */ - size_t index = 0,len_0 = strlen(extdir) + 1; - - wdir = (TCHAR *)calloc(len_0, sizeof(TCHAR)); - if (wdir == NULL) - { - if (extdirbuf != NULL) - { - free (extdirbuf); - } - free(*ctx); - *ctx = NULL; - errno = ENOMEM; - return 0; - } - + errno = 0; + if (*ctx == NULL) { + const char *extdir = directory; + char *extdirbuf = NULL; + size_t dirlen = strlen(directory); + + if (dirlen == 0) { + errno = ENOENT; + return 0; + } + + *ctx = (LP_DIR_CTX *)malloc(sizeof(LP_DIR_CTX)); + if (*ctx == NULL) { + errno = ENOMEM; + return 0; + } + memset(*ctx, '\0', sizeof(LP_DIR_CTX)); + + if (directory[dirlen - 1] != '*') { + extdirbuf = (char *)malloc(dirlen + 3); + if (extdirbuf == NULL) { + free(*ctx); + *ctx = NULL; + errno = ENOMEM; + return 0; + } + if (directory[dirlen - 1] != '/' && directory[dirlen - 1] != '\\') + extdir = strcat(strcpy(extdirbuf, directory), "/*"); + else + extdir = strcat(strcpy(extdirbuf, directory), "*"); + } + + if (sizeof(TCHAR) != sizeof(char)) { + TCHAR *wdir = NULL; + /* len_0 denotes string length *with* trailing 0 */ + size_t index = 0, len_0 = strlen(extdir) + 1; + + wdir = (TCHAR *)calloc(len_0, sizeof(TCHAR)); + if (wdir == NULL) { + if (extdirbuf != NULL) { + free(extdirbuf); + } + free(*ctx); + *ctx = NULL; + errno = ENOMEM; + return 0; + } #ifdef LP_MULTIBYTE_AVAILABLE - if (!MultiByteToWideChar(CP_ACP, 0, extdir, len_0, (WCHAR *)wdir, len_0)) + if (!MultiByteToWideChar + (CP_ACP, 0, extdir, len_0, (WCHAR *)wdir, len_0)) #endif - for (index = 0; index < len_0; index++) - wdir[index] = (TCHAR)extdir[index]; - - (*ctx)->handle = FindFirstFile(wdir, &(*ctx)->ctx); - - free(wdir); - } - else - { - (*ctx)->handle = FindFirstFile((TCHAR *)extdir, &(*ctx)->ctx); - } - if (extdirbuf != NULL) - { - free (extdirbuf); - } - - if ((*ctx)->handle == INVALID_HANDLE_VALUE) - { - free(*ctx); - *ctx = NULL; - errno = EINVAL; - return 0; - } - } - else - { - if (FindNextFile((*ctx)->handle, &(*ctx)->ctx) == FALSE) - { - return 0; - } + for (index = 0; index < len_0; index++) + wdir[index] = (TCHAR)extdir[index]; + + (*ctx)->handle = FindFirstFile(wdir, &(*ctx)->ctx); + + free(wdir); + } else { + (*ctx)->handle = FindFirstFile((TCHAR *)extdir, &(*ctx)->ctx); + } + if (extdirbuf != NULL) { + free(extdirbuf); + } + + if ((*ctx)->handle == INVALID_HANDLE_VALUE) { + free(*ctx); + *ctx = NULL; + errno = EINVAL; + return 0; + } + } else { + if (FindNextFile((*ctx)->handle, &(*ctx)->ctx) == FALSE) { + return 0; + } } - if (sizeof(TCHAR) != sizeof(char)) - { - TCHAR *wdir = (*ctx)->ctx.cFileName; - size_t index, len_0 = 0; + if (sizeof(TCHAR) != sizeof(char)) { + TCHAR *wdir = (*ctx)->ctx.cFileName; + size_t index, len_0 = 0; - while (wdir[len_0] && len_0 < (sizeof((*ctx)->entry_name) - 1)) len_0++; - len_0++; + while (wdir[len_0] && len_0 < (sizeof((*ctx)->entry_name) - 1)) + len_0++; + len_0++; #ifdef LP_MULTIBYTE_AVAILABLE - if (!WideCharToMultiByte(CP_ACP, 0, (WCHAR *)wdir, len_0, (*ctx)->entry_name, - sizeof((*ctx)->entry_name), NULL, 0)) + if (!WideCharToMultiByte + (CP_ACP, 0, (WCHAR *)wdir, len_0, (*ctx)->entry_name, + sizeof((*ctx)->entry_name), NULL, 0)) #endif - for (index = 0; index < len_0; index++) - (*ctx)->entry_name[index] = (char)wdir[index]; - } - else - strncpy((*ctx)->entry_name, (const char *)(*ctx)->ctx.cFileName, - sizeof((*ctx)->entry_name)-1); + for (index = 0; index < len_0; index++) + (*ctx)->entry_name[index] = (char)wdir[index]; + } else + strncpy((*ctx)->entry_name, (const char *)(*ctx)->ctx.cFileName, + sizeof((*ctx)->entry_name) - 1); - (*ctx)->entry_name[sizeof((*ctx)->entry_name)-1] = '\0'; + (*ctx)->entry_name[sizeof((*ctx)->entry_name) - 1] = '\0'; - return (*ctx)->entry_name; + return (*ctx)->entry_name; } int LP_find_file_end(LP_DIR_CTX **ctx) { - if (ctx != NULL && *ctx != NULL) - { - FindClose((*ctx)->handle); - free(*ctx); - *ctx = NULL; - return 1; + if (ctx != NULL && *ctx != NULL) { + FindClose((*ctx)->handle); + free(*ctx); + *ctx = NULL; + return 1; } - errno = EINVAL; - return 0; + errno = EINVAL; + return 0; } diff --git a/crypto/LPdir_win32.c b/crypto/LPdir_win32.c index e39872da52..b1c983d87f 100644 --- a/crypto/LPdir_win32.c +++ b/crypto/LPdir_win32.c @@ -1,4 +1,7 @@ -/* $LP: LPlib/source/LPdir_win32.c,v 1.3 2004/08/26 13:36:05 _cvs_levitte Exp $ */ +/* + * $LP: LPlib/source/LPdir_win32.c,v 1.3 2004/08/26 13:36:05 _cvs_levitte Exp + * $ + */ /* * Copyright (c) 2004, Richard Levitte * All rights reserved. @@ -11,7 +14,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR diff --git a/crypto/LPdir_wince.c b/crypto/LPdir_wince.c index ab0e1e6f4f..ae8a56f4be 100644 --- a/crypto/LPdir_wince.c +++ b/crypto/LPdir_wince.c @@ -1,4 +1,7 @@ -/* $LP: LPlib/source/LPdir_wince.c,v 1.3 2004/08/26 13:36:05 _cvs_levitte Exp $ */ +/* + * $LP: LPlib/source/LPdir_wince.c,v 1.3 2004/08/26 13:36:05 _cvs_levitte Exp + * $ + */ /* * Copyright (c) 2004, Richard Levitte * All rights reserved. @@ -11,7 +14,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -26,6 +29,8 @@ */ #define LP_SYS_WINCE -/* We might want to define LP_MULTIBYTE_AVAILABLE here. It's currently - under investigation what the exact conditions would be */ +/* + * We might want to define LP_MULTIBYTE_AVAILABLE here. It's currently under + * investigation what the exact conditions would be + */ #include "LPdir_win.c" diff --git a/crypto/aes/aes.h b/crypto/aes/aes.h index 450f2b4051..83c13c93d7 100644 --- a/crypto/aes/aes.h +++ b/crypto/aes/aes.h @@ -7,7 +7,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -50,25 +50,27 @@ */ #ifndef HEADER_AES_H -#define HEADER_AES_H +# define HEADER_AES_H -#include +# include -#ifdef OPENSSL_NO_AES -#error AES is disabled. -#endif +# ifdef OPENSSL_NO_AES +# error AES is disabled. +# endif -#define AES_ENCRYPT 1 -#define AES_DECRYPT 0 +# define AES_ENCRYPT 1 +# define AES_DECRYPT 0 -/* Because array size can't be a const in C, the following two are macros. - Both sizes are in bytes. */ -#define AES_MAXNR 14 -#define AES_BLOCK_SIZE 16 +/* + * Because array size can't be a const in C, the following two are macros. + * Both sizes are in bytes. + */ +# define AES_MAXNR 14 +# define AES_BLOCK_SIZE 16 -#ifdef OPENSSL_FIPS -#define FIPS_AES_SIZE_T int -#endif +# ifdef OPENSSL_FIPS +# define FIPS_AES_SIZE_T int +# endif #ifdef __cplusplus extern "C" { @@ -76,11 +78,11 @@ extern "C" { /* This should be a hidden type, but EVP requires that the size be known */ struct aes_key_st { -#ifdef AES_LONG - unsigned long rd_key[4 *(AES_MAXNR + 1)]; -#else - unsigned int rd_key[4 *(AES_MAXNR + 1)]; -#endif +# ifdef AES_LONG + unsigned long rd_key[4 * (AES_MAXNR + 1)]; +# else + unsigned int rd_key[4 * (AES_MAXNR + 1)]; +# endif int rounds; }; typedef struct aes_key_st AES_KEY; @@ -88,61 +90,61 @@ typedef struct aes_key_st AES_KEY; const char *AES_options(void); int AES_set_encrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); + AES_KEY *key); int AES_set_decrypt_key(const unsigned char *userKey, const int bits, - AES_KEY *key); + AES_KEY *key); void AES_encrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key); + const AES_KEY *key); void AES_decrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key); + const AES_KEY *key); void AES_ecb_encrypt(const unsigned char *in, unsigned char *out, - const AES_KEY *key, const int enc); + const AES_KEY *key, const int enc); void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, - const unsigned long length, const AES_KEY *key, - unsigned char *ivec, const int enc); + const unsigned long length, const AES_KEY *key, + unsigned char *ivec, const int enc); void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out, - const unsigned long length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); + const unsigned long length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out, - const unsigned long length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); + const unsigned long length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out, - const unsigned long length, const AES_KEY *key, - unsigned char *ivec, int *num, const int enc); -void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out, - const int nbits,const AES_KEY *key, - unsigned char *ivec,const int enc); + const unsigned long length, const AES_KEY *key, + unsigned char *ivec, int *num, const int enc); +void AES_cfbr_encrypt_block(const unsigned char *in, unsigned char *out, + const int nbits, const AES_KEY *key, + unsigned char *ivec, const int enc); void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out, - const unsigned long length, const AES_KEY *key, - unsigned char *ivec, int *num); + const unsigned long length, const AES_KEY *key, + unsigned char *ivec, int *num); void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out, - const unsigned long length, const AES_KEY *key, - unsigned char ivec[AES_BLOCK_SIZE], - unsigned char ecount_buf[AES_BLOCK_SIZE], - unsigned int *num); + const unsigned long length, const AES_KEY *key, + unsigned char ivec[AES_BLOCK_SIZE], + unsigned char ecount_buf[AES_BLOCK_SIZE], + unsigned int *num); /* For IGE, see also http://www.links.org/files/openssl-ige.pdf */ /* NB: the IV is _two_ blocks long */ void AES_ige_encrypt(const unsigned char *in, unsigned char *out, - const unsigned long length, const AES_KEY *key, - unsigned char *ivec, const int enc); + const unsigned long length, const AES_KEY *key, + unsigned char *ivec, const int enc); /* NB: the IV is _four_ blocks long */ void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out, - const unsigned long length, const AES_KEY *key, - const AES_KEY *key2, const unsigned char *ivec, - const int enc); + const unsigned long length, const AES_KEY *key, + const AES_KEY *key2, const unsigned char *ivec, + const int enc); int AES_wrap_key(AES_KEY *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, unsigned int inlen); + unsigned char *out, + const unsigned char *in, unsigned int inlen); int AES_unwrap_key(AES_KEY *key, const unsigned char *iv, - unsigned char *out, - const unsigned char *in, unsigned int inlen); + unsigned char *out, + const unsigned char *in, unsigned int inlen); #ifdef __cplusplus } #endif -#endif /* !HEADER_AES_H */ +#endif /* !HEADER_AES_H */ diff --git a/crypto/aes/aes_cbc.c b/crypto/aes/aes_cbc.c index 373864cd4b..dff5cd8df9 100644 --- a/crypto/aes/aes_cbc.c +++ b/crypto/aes/aes_cbc.c @@ -7,7 +7,7 @@ * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -61,73 +61,74 @@ #if !defined(OPENSSL_FIPS_AES_ASM) void AES_cbc_encrypt(const unsigned char *in, unsigned char *out, - const unsigned long length, const AES_KEY *key, - unsigned char *ivec, const int enc) { + const unsigned long length, const AES_KEY *key, + unsigned char *ivec, const int enc) +{ - unsigned long n; - unsigned long len = length; - unsigned char tmp[AES_BLOCK_SIZE]; - const unsigned char *iv = ivec; + unsigned long n; + unsigned long len = length; + unsigned char tmp[AES_BLOCK_SIZE]; + const unsigned char *iv = ivec; - assert(in && out && key && ivec); - assert((AES_ENCRYPT == enc)||(AES_DECRYPT == enc)); + assert(in && out && key && ivec); + assert((AES_ENCRYPT == enc) || (AES_DECRYPT == enc)); - if (AES_ENCRYPT == enc) { - while (len >= AES_BLOCK_SIZE) { - for(n=0; n < AES_BLOCK_SIZE; ++n) - out[n] = in[n] ^ iv[n]; - AES_encrypt(out, out, key); - iv = out; - len -= AES_BLOCK_SIZE; - in += AES_BLOCK_SIZE; - out += AES_BLOCK_SIZE; - } - if (len) { - for(n=0; n < len; ++n) - out[n] = in[n] ^ iv[n]; - for(n=len; n < AES_BLOCK_SIZE; ++n) - out[n] = iv[n]; - AES_encrypt(out, out, key); - iv = out; - } - memcpy(ivec,iv,AES_BLOCK_SIZE); - } else if (in != out) { - while (len >= AES_BLOCK_SIZE) { - AES_decrypt(in, out, key); - for(n=0; n < AES_BLOCK_SIZE; ++n) - out[n] ^= iv[n]; - iv = in; - len -= AES_BLOCK_SIZE; - in += AES_BLOCK_SIZE; - out += AES_BLOCK_SIZE; - } - if (len) { - AES_decrypt(in,tmp,key); - for(n=0; n < len; ++n) - out[n] = tmp[n] ^ iv[n]; - iv = in; - } - memcpy(ivec,iv,AES_BLOCK_SIZE); - } else { - while (len >= AES_BLOCK_SIZE) { - memcpy(tmp, in, AES_BLOCK_SIZE); - AES_decrypt(in, out, key); - for(n=0; n < AES_BLOCK_SIZE; ++n) - out[n] ^= ivec[n]; - memcpy(ivec, tmp, AES_BLOCK_SIZE); - len -= AES_BLOCK_SIZE; - in += AES_BLOCK_SIZE; - out += AES_BLOCK_SIZE; - } - if (len) { - memcpy(tmp, in, AES_BLOCK_SIZE); - AES_decrypt(tmp, out, key); - for(n=0; n < len; ++n) - out[n] ^= ivec[n]; - for(n=len; n < AES_BLOCK_SIZE; ++n) - out[n] = tmp[n]; - memcpy(ivec, tmp, AES_BLOCK_SIZE); - } - } + if (AES_ENCRYPT == enc) { + while (len >= AES_BLOCK_SIZE) { + for (n = 0; n < AES_BLOCK_SIZE; ++n) + out[n] = in[n] ^ iv[n]; + AES_encrypt(out, out, key); + iv = out; + len -= AES_BLOCK_SIZE; + in += AES_BLOCK_SIZE; + out += AES_BLOCK_SIZE; + } + if (len) { + for (n = 0; n < len; ++n) + out[n] = in[n] ^ iv[n]; + for (n = len; n < AES_BLOCK_SIZE; ++n) + out[n] = iv[n]; + AES_encrypt(out, out, key); + iv = out; + } + memcpy(ivec, iv, AES_BLOCK_SIZE); + } else if (in != out) { + while (len >= AES_BLOCK_SIZE) { + AES_decrypt(in, out, key); + for (n = 0; n < A